HTML/CSS/CSS Attributes and Javascript Style Properties/border top — различия между версиями

Материал из Web эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 08:16, 26 мая 2010

border-top: 3px double red

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title></title>
<style type="text/css" media="Screen">
* .myStyle {
  border-top: 3px double red;
}
</style>
</head>
<body>
<p> 
    <code>border</code>: 
    <span class="myStyle">Over 7</span> &nbsp; 
</p> 
</body>
</html>



border-top: 4px groove blue

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title></title>
<style type="text/css" media="Screen">
* .myStyle {
  border-top: 4px groove blue;
}
</style>
</head>
<body>
<p> 
    <code>border</code>: 
    <span class="myStyle">Over 8</span> &nbsp; 
</p> 
</body>
</html>



border-top: 6px ridge green

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title></title>
<style type="text/css" media="Screen">
* .myStyle {
  border-top: 6px ridge green;
}
</style>
</head>
<body>
<p> 
    <code>border</code>: 
    <span class="myStyle">Over 9</span> &nbsp; 
</p> 
</body>
</html>



"border-top" Example

    
<html>
<head>
<style>
.style1 { 
    border:5px solid #cccccc; 
    border-top:5px solid red; 
    font-family:verdana; 
    font-weight:bold
}
.style2 { 
    border:"none"; 
    font-family:verdana; 
    font-weight:bold 
}
</style>
</head>
<body>
Move your mouse in and out to see the style change.
<div style="width:230; 
           height:100; 
           background-color:beige"
     onmouseover="this.className="style1""
     onmouseout="this.className="style2"">This is a div element.
</div>
</body>
</html>



Four shorthand properties can be used to specify border-width,border-style, and border-color in just one property.

 

<!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" xml:lang="en">
    <head>
        <title>border</title>
        <style rel="stylesheet" type="text/css">
div#shorthand-sides {
    border-top: 1px solid pink;
    border-right: 1px solid crimson;
    border-bottom: 1px solid pink;
    border-left: 1px solid crimson;
    padding: 5px;
}
        </style>
    </head>
    <body>
        <div id="shorthand-sides">
            border-top, border-right, border-bottom, border-left
        </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. 
      </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. 
      </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.       </p>
        </body>
    </html>



The 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>