border



значения свойства:


  • border-width
  • border-style
  • border-color
  • inherit



css/style.css
  • * {
  •  margin: 0;
  •  padding: 0;
  • }
  •  
  • .main {
  •  height: 600px;
  •  width: 800px;
  •  position: absolute;
  •  top: 50%;
  •  left: 50%;
  •  margin-top: -300px;
  •  margin-left: -400px;
  • }
  •  
  • .wrapper {
  •  width: 33.3%;
  •  height: 100%;
  •  float: left;
  • }
  •  
  • #div1, #div2, #div3 {
  •  height: 250px;
  •  width: 250px;
  •  float: left;
  •  position: relative;
  •  top: 50%;
  •  left: 50%;
  •  margin-top: -125px;
  •  margin-left: -125px;
  • }
  •  
  • #div1 {
  •  border: 1px solid #FF0000;
  • }
* {
 margin: 0;
 padding: 0;
}

.main {
 height: 600px;
 width: 800px;
 position: absolute;
 top: 50%;
 left: 50%;
 margin-top: -300px;
 margin-left: -400px;
}

.wrapper {
 width: 33.3%;
 height: 100%;
 float: left;
}

#div1, #div2, #div3 {
 height: 250px;
 width: 250px;
 float: left;
 position: relative;
 top: 50%;
 left: 50%;
 margin-top: -125px;
 margin-left: -125px;
} 

#div1 {
 border: 1px solid #FF0000;
}


index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  •  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  • </head>
  • <body>
  •   <div class="main">
  •    <div class="wrapper">
  •     <div id="div1"></div>
  •    </div>
  •    <div class="wrapper">
  •     <div id="div2"></div>
  •    </div>
  •    <div class="wrapper">
  •     <div id="div3"></div>
  •    </div>
  •   </div>
  • <script>
  •  /*JavaScript*/
  •  document.getElementById("div2").style.border = "2px dotted #0000FF";
  •  /*jQuery*/
  •  $(document).ready(function () {
  •   $("#div3").css({ "border": "3px dashed #00FF00" });
  •  });
  • </script>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  •  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  • </head>
  • <body>
  •   <div class="main">
  •    <div class="wrapper">
  •     <div id="div1"></div>
  •    </div>
  •    <div class="wrapper">
  •     <div id="div2"></div>
  •    </div>
  •    <div class="wrapper">
  •     <div id="div3"></div>
  •    </div>
  •   </div>
  • <script>
  •  /*JavaScript*/
  •  document.getElementById("div2").style.border = "2px dotted #0000FF";
  •  /*jQuery*/
  •  $(document).ready(function () {
  •   $("#div3").css({ "border": "3px dashed #00FF00" });
  •  });
  • </script>
  • </body>
  • </html>