HTML/CSS/Box Model/border top
Содержание
- 1 border-top: 1px solid #003
- 2 border top one value
- 3 border-top shortcut: 10px solid black;
- 4 border top style color
- 5 Independently set border-left, border-right, border-top, and border-bottom.
- 6 The top border of this paragraph has a medium width and the color specified for text
- 7 The top border of this paragraph has is 1 pixel width, solid and black.
- 8 The top border of this paragraph is of medium thickness.
- 9 Top border a medium width and the color specified for text.
- 10 top border of this paragraph is the same color as the text color
border-top: 1px solid #003
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
#navsite ul li {
margin: 0;
border-top: 1px solid #003;
}
</style>
</head>
<body id="pagespk">
<div id="navsite">
<h5>Site navigation:</h5>
<ul>
<li><a href="" id="linkhom">Home</a></li>
<li><a href="" id="linkabt">About</a></li>
<li><a href="" id="linkarh">Archives</a></li>
<li><a href="" id="linkwri">Writing</a></li>
<li><a href="" id="linkspk">Speaking</a></li>
<li><a href="" id="linkcnt">Contact</a></li>
</ul>
</div>
</body>
</html>
border top one value
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<style type="text/css">
p {
border-top: solid;
}
</style>
</head>
<body>
<p>
This is a test. This is a test.
</p>
</body>
</html>
border-top shortcut: 10px solid black;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>border-top shortcut: 10px solid black;</title>
<style type="text/css">
h2 {
border-top: 10px solid black;
}
</style>
</head>
<body>
<h2>This is a header</h2>
<p>This is a test</p>
</body>
</html>
border top style color
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<style type="text/css">
p {
border-top: solid black;
}
</style>
</head>
<body>
<p>
This is a test. This is a test.
</p>
</body>
</html>
Independently set border-left, border-right, border-top, and border-bottom.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
.container{
position: relative;
width: 800px;
height: 800px;
background: pink;
}
* .box {
float: right;
overflow: auto;
visibility: visible;
width: auto;
height: 100px;
margin: 10px;
padding: 10px;
background: red;
}
* .small {
position: absolute;
border-left: 10px dotted black;
background: yellow;
}
</style>
</head>
<body>
<div class="container">
<div class="small">this is a test. <BR/>this is a test. this is a test. this is a test. </div>
<div class="box">this is a test</div>
</div>
</body>
</html>
The top border of this paragraph has a medium width and the color specified for text
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<style type="text/css">
p {
border-top: solid;
}
</style>
</head>
<body>
<p>
This is a test. This is a test.
</p>
</body>
</html>
The top border of this paragraph has is 1 pixel width, solid and black.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<style type="text/css">
p {
border-top: 1px solid black;
}
</style>
</head>
<body>
<p>
This is a test. This is a test.
</p>
</body>
</html>
The top border of this paragraph is of medium thickness.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<style type="text/css">
p {
border-top: solid black;
}
</style>
</head>
<body>
<p>
This is a test. This is a test.
</p>
</body>
</html>
Top border a medium width and the color specified for text.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<style type="text/css">
p {
border-top: solid;
}
</style>
</head>
<body>
<p>
This is a test. This is a test.
</p>
</body>
</html>
top border of this paragraph is the same color as the text color
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<style type="text/css">
p {
border-top: thin solid;
}
</style>
</head>
<body>
<p>
This is a test. .
</p>
</body>
</html>