这是一个设置边框为不同宽度的例子,其实学习CSS一定要搞清楚它们的继承与覆盖关系。
<html>
<head>
<style type="text/css">
p.one
{
border-style: solid;
/*上下左右宽度一样*/
border-width: 5px
}
p.two
{
border-style: solid;
/*内部值指定*/
border-width: thick
}
p.three
{
border-style: solid;
/*上下为5,左右10*/
border-width: 5px 10px
}
p.four
{
border-style: solid;
/*上5,左右10,下1*/
border-width: 5px 10px 1px
}
p.five
{
border-style: solid;
/*上右下左,medium一般为2px*/
border-width: 5px 10px 1px medium
}
</style>
</head>
<body>
<p class="one">Some text</p>
<p class="two">Some text</p>
<p class="three">Some text</p>
<p class="four">Some text</p>
<p class="five">Some text</p>
<p><b>注释:</b>"border-width" 属性如果单独使用的话是不会起作用的。请首先使用 "border-style" 属性来设置边框。</p>
</body>
</html>