或许你想到可以用图片来实现这样的效果,但图片除了体积稍大,语义上也很欠缺。这样的效果如何用xhtml+css实现呢?首先我们通过 fieldset设置一个方框(也译作域),然后通过特定的标签legend域标题,设置一个标题,并对它们进行相应的样式定义即可实现这样效果。我们首 先来了解一下fieldset方框、legend域标题这两个标签的知识。
html元素 fieldset方框
draws a box around the text and other elements that the field set contains.
在字段集包含的文本和其它元素外面画一个方框。
fieldset元素用于对表单中的元素进行分组并在文档中区别标出文本。它与窗口框架的行为有些相似。fieldset在 internet explorer 4.0 及以上版本的html 和的脚本中可用。
fieldset元素元素是块元素。 并且需要关闭标签,即必须成对出现:
form#staff_info fieldset { background: rgba(255,255,255,.3); border-color: rgba(255,255,255,.6); border-style: solid; border-width: 2px; -moz-border-radius: 5px; -webkit-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px; line-height: 30px; list-style: none; padding: 5px 10px; margin-bottom: 2px; } form#staff_info fieldset legend { color:#302A2A; font: bold 16px/2 Verdana, Geneva, sans-serif; font-weight: bold; text-align: left; text-shadow: 2px 2px 2px rgb(88, 126, 156); }
<fieldset style="max-width:90%"> <legend>系统使用说明</legend> </fieldset>
其中border-width: 1px;是边的粗细,border-color: #008000;为边色,最好给他一个border-width: 1px;这个值不然会显不出来想要的粗细的.
样式标签为:border-bottom-color,是设置底部边框颜色的,其它三个边框则把中间的bottom分别改为Top(上部)、Left(左部)、Right(右部)即可。
以上就是html中fieldset边框样式设置的详细内容,更多请关注php中文网其它相关文章!
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号