【问题标题】:How to set fieldset border from legend bottom?如何从图例底部设置字段集边框?
【发布时间】:2011-04-09 00:30:44
【问题描述】:
我有字段集和图例。字段集边框出现在图例的中间,如下所示
但我想要像下面这样的边框
边界线应位于图例下方。
我正在使用下面的 css。
.fieldSet
{
width: 97%;
margin-left: 10px;
border-color: #003366;
}
.legendStyle
{
border-style:none;
background-color: #003366;
font-family: Tahoma, Arial, Helvetica;
font-weight: bold;
font-size: 9.5pt;
Color: White;
width:30%;
padding-left:10px;
}
【问题讨论】:
标签:
css
forms
stylesheet
legend
fieldset
【解决方案1】:
试试这个:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title></title>
<style type="text/css">
fieldSet
{
width: 97%;
margin-left: 10px;
border:0;
margin:0;
}
legend
{
border-style:none;
background-color: #003366;
font-family: Tahoma, Arial, Helvetica;
font-weight: bold;
font-size: 9.5pt;
Color: White;
width:30%;
padding-left:10px;
}
fieldset div { border:1px solid #003366; position:relative; top:-6px }
</style>
</head>
<body>
<fieldset>
<legend>Employee Information</legend>
<div>
<label for="x">some label</label>
<input type="text" name="x" />
</div>
</fieldset>
</body>
</html>