HTML/CSS/CSS Attributes and Javascript Style Properties/border width

Материал из Web эксперт
Версия от 08:16, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"border-width" Example

    
<html>
<head>
<style>
.style1 { 
    border:5px solid #cccccc; 
    border-width:6px; 
}
.style2 { 
    border:"none"; 
    font-family:verdana; 
    font-weight:bold 
}
</style>
</head>
<body>
Move 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>



border-width: medium

 
<!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-width</title>
        <style rel="stylesheet" type="text/css">
div {
    padding: 3px;
    border-color: black;
    border-style: solid;
    background: mistyrose;
    margin: 5px;
}
div#medium {
    border-width: medium;
}   
        </style>
    </head>
    <body>
        <div id="medium">medium</div>
    </body>
</html>



border width: medium solid 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">
        div {
          padding: 10px;
          margin: 10px;
        }
      </style>
    </head>
    <body>
      <div style="border: medium solid black;">
          border-width: medium;
      </div>
    </body>
  </html>



border width shorthand with three values

 

<!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 {
            margin: 20px;
            padding: 20px;
            width: 200px;
            border-width: thin medium thick;
            border-style: solid dashed dotted;
        }
            </style>
        </head>
        <body>
            <p>
                This is a test. This is a test. 
            </p>
        </body>
    </html>



border width shorthand with two values

 

<!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 {
            margin: 20px;
            padding: 20px;
            width: 200px;
            border-width: thin thick;
            border-style: solid dotted;
        }
            </style>
        </head>
        <body>
            <p>
                This is a test. This is a test. 
            </p>
        </body>
    </html>



border-width: thick

 
<!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-width</title>
        <style rel="stylesheet" type="text/css">
div {
    padding: 3px;
    border-color: black;
    border-style: solid;
    background: mistyrose;
    margin: 5px;
}
div#thick {
    border-width: thick;
}   
        </style>
    </head>
    <body>
        <div id="thick">thick</div>
    </body>
</html>



border width: thick solid 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">
        div {
          padding: 10px;
          margin: 10px;
        }
      </style>
    </head>
    <body>
      <div style="border: thick solid black;">
          border-width: thick;
      </div>
    </body>
  </html>



border-width: thin

 
<!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-width</title>
        <style rel="stylesheet" type="text/css">
div {
    padding: 3px;
    border-color: black;
    border-style: solid;
    background: mistyrose;
    margin: 5px;
}
div#thin {
    border-width: thin;
}
     
        </style>
    </head>
    <body>
        <div id="thin">thin</div>
    </body>
</html>



border-width: thin medium 30px thick;

 

<!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 {
                    margin: 20px;
                    padding: 20px;
                    width: 200px;
                    border-width: thin medium 30px thick;
                    border-style: solid dashed double dotted;
                }
            </style>
        </head>
        <body>
      <p>
          This is a test. This is a test. 
      </p>
        </body>
    </html>



border-width: thin medium thick;

 

<!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 {
            margin: 20px;
            padding: 20px;
            width: 200px;
            border-width: thin medium thick;
            border-style: solid dashed dotted;
        }
            </style>
        </head>
        <body>
            <p>
                This is a test. This is a test. 
            </p>
        </body>
    </html>



border width: thin solid 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">
        div {
          padding: 10px;
          margin: 10px;
        }
      </style>
    </head>
    <body>
      <div style="border: thin solid black;">
          border-width: thin;
      </div>
    </body>
  </html>



border-width: thin thick;

 

<!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 {
            margin: 20px;
            padding: 20px;
            width: 200px;
            border-width: thin thick;
            border-style: solid dotted;
        }
            </style>
        </head>
        <body>
            <p>
                This is a test. This is a test. 
            </p>
        </body>
    </html>



Border width with four values

 

<!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-width</title>
        <style rel="stylesheet" type="text/css">
div {
    padding: 3px;
    border-color: khaki;
    border-style: solid;
    background: lightyellow;
    margin: 5px;
    float: left;
    width: 50px;
    height: 50px;
}
div#four {
    border-width: 2px 4px 8px 10px;
}
      
        </style>
    </head>
    <body>
        <div id="four"></div>
    </body>
</html>



Border width with one value

 

<!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-width</title>
        <style rel="stylesheet" type="text/css">
div {
    padding: 3px;
    border-color: khaki;
    border-style: solid;
    background: lightyellow;
    margin: 5px;
    float: left;
    width: 50px;
    height: 50px;
}
div#one {
    border-width: 4px;
}   
      
        </style>
    </head>
    <body>
        <div id="one"></div>
    </body>
</html>



Border width with three values

 

<!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-width</title>
        <style rel="stylesheet" type="text/css">
div {
    padding: 3px;
    border-color: khaki;
    border-style: solid;
    background: lightyellow;
    margin: 5px;
    float: left;
    width: 50px;
    height: 50px;
}
div#three {
    border-width: 2px 4px 8px;
}
      
        </style>
    </head>
    <body>
        <div id="three"></div>
    </body>
</html>



Border width with two values

 

<!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-width</title>
        <style rel="stylesheet" type="text/css">
div {
    padding: 3px;
    border-color: khaki;
    border-style: solid;
    background: lightyellow;
    margin: 5px;
    float: left;
    width: 50px;
    height: 50px;
}
div#two {
    border-width: 8px 4px;
}
      
        </style>
    </head>
    <body>
        <div id="two"></div>
    </body>
</html>