left



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


  • auto
  • value
  • %
  • inherit



css/style.css
  • * {
  •  margin: 0;
  •  padding: 0;
  • }
  •  
  • .main {
  •  height: 200px;
  •  width: 950px;
  •  position: absolute;
  •  top: 50%;
  •  left: 50%;
  •  margin-top: -100px;
  •  margin-left: -475px;
  • }
  •  
  • .wrapper {
  •  width: 198px;
  •  height: 198px;
  •  float: left;
  •  border: 1px solid #808080;
  • }
  •  
  • .empty {
  •  width: 50px;
  •  height: 200px;
  •  float: left;
  • }
  •  
  • .a, #div1, .b, .c, .d, .e {
  •  width: 50px;
  •  height: 50px;
  •  background-color: #7092BE;
  • }
  •  
  • .a {
  •  position: relative;
  •  left: auto;
  • }
  •  
  • #div1 {
  •  position: relative;
  • }
  •  
  • .c {
  •  position: relative;
  •  left: 50%;
  • }
  •  
  • .d {
  •  position: fixed;
  •  left: 10px;
  • }
  •  
  • .e {
  •  position: absolute;
  •  left: 100px;
  • }
* {
 margin: 0;
 padding: 0;
}

.main {
 height: 200px;
 width: 950px;
 position: absolute;
 top: 50%;
 left: 50%;
 margin-top: -100px;
 margin-left: -475px;
}

.wrapper {
 width: 198px;
 height: 198px;
 float: left;
 border: 1px solid #808080;
}

.empty {
 width: 50px;
 height: 200px;
 float: left;
}

.a, #div1, .b, .c, .d, .e {
 width: 50px;
 height: 50px;
 background-color: #7092BE;
}

.a {
 position: relative;
 left: auto;
}

#div1 {
 position: relative;
}

.c {
 position: relative;
 left: 50%;
}

.d {
 position: fixed;
 left: 10px;
}

.e {
 position: absolute;
 left: 100px;
}


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 class="a"></div>
  •   </div>
  •   <div class="empty"></div>
  •   <div class="wrapper">
  •    <div id="div1"></div>
  •   </div>
  •   <div class="empty"></div>
  •   <div class="wrapper">
  •    <div class="b"></div>
  •   </div>
  •   <div class="empty"></div>
  •   <div class="wrapper">
  •    <div class="c"></div>
  •   </div>
  •  </div>
  •  <div class="d"></div>
  •  <div class="e"></div>
  • <script>
  •  /*JavaScript*/
  •  document.getElementById("div1").style.left = "25px";
  •  /*jQuery*/
  •  $(document).ready(function () {
  •   $(".b").css({ "left": "-25px", "position": "relative" });
  •  });
  • </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 class="a"></div>
  •   </div>
  •   <div class="empty"></div>
  •   <div class="wrapper">
  •    <div id="div1"></div>
  •   </div>
  •   <div class="empty"></div>
  •   <div class="wrapper">
  •    <div class="b"></div>
  •   </div>
  •   <div class="empty"></div>
  •   <div class="wrapper">
  •    <div class="c"></div>
  •   </div>
  •  </div>
  •  <div class="d"></div>
  •  <div class="e"></div>
  • <script>
  •  /*JavaScript*/
  •  document.getElementById("div1").style.left = "25px";
  •  /*jQuery*/
  •  $(document).ready(function () {
  •   $(".b").css({ "left": "-25px", "position": "relative" });
  •  });
  • </script>
  • </body>
  • </html>