[英]How do I make CSS sharp “V” like horizontal corners for `<legend>` and `<fieldset>`?
How do I make in CSS sharp "V" like horizontal corners? 如何在CSS中使“ V”像水平角一样锋利? Corners that look like this < > as if the corners were arose to left and right in both the
<legend>
and then in the <fieldset>
as well. 看起来像这样的拐角>,好像在
<legend>
和<fieldset>
中都是左右拐角。
#FieldsetSeekBox { padding: 8px 1px; border: 1px solid #a1a1a1; } #LegendStyle { border-style: none; background-color: #a1a1a1; font: bold 13px Tahoma, Arial, Helvetica; color: #000000; padding-left: 10px; position: relative; border-radius: 8px 8px 0px 0px; }
<fieldset id="FieldsetSeekBox"> <legend id="LegendStyle"> Web Search </legend> <input type="text" name="u" size="70" value="" placeholder="Type your Search here and click Search..." id="SeekBox"> </fieldset>
In general, you need to set some content with the css pseudo elements :before
or :after
. 通常,您需要使用css伪元素
:before
或:after
来设置一些内容。 Then by setting the border widths for top/bottom you can create a triangle shape. 然后,通过设置顶部/底部的边框宽度,您可以创建一个三角形。
See css-triangle demo, or below example. 请参阅css-triangle演示,或以下示例。
#FieldsetSeekBox { padding: 8px 1px; border: 1px solid #a1a1a1; } #LegendStyle { border-style: none; background-color: #a1a1a1; font: bold 13px Tahoma, Arial, Helvetica; color: #000000; padding-left: 10px; position: relative; } #LegendStyle:after { content: " "; display: block; position: absolute; right: -10px; top: 0; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 10px solid #a1a1a1; }
<fieldset id="FieldsetSeekBox"> <legend id="LegendStyle"> Web Search </legend> <input type="text" name="u" size="70" value="" placeholder="Type your Search here and click Search..." id="SeekBox"> </fieldset>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.