clear



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

values of the property:


  • none
  • left
  • right
  • both
  • inherit



css/style.css
  • .left, .right, .both {
  •  height: 150px;
  •  width: 400px;
  •  border: 1px solid #808080;
  • }
  •  
  • .one, .two {
  •  height: 50px;
  •  width: 100px;
  •  background-color: #3BA9DE;
  •  margin: 5px;
  • }
  •  
  • .one {
  •  float: left;
  • }
  •  
  • .two {
  •  float: right;
  • }
  •  
  • .text {
  •  text-align: justify;
  • }
  •  
  • .clear-left {
  •  clear: left;
  • }
.left, .right, .both {
 height: 150px;
 width: 400px;
 border: 1px solid #808080;
}

.one, .two {
 height: 50px;
 width: 100px;
 background-color: #3BA9DE;
 margin: 5px;
}

.one {
 float: left;
}

.two {
 float: right;
}

.text {
 text-align: justify;
}

.clear-left {
 clear: left;
}


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="left">
  •   <div class="one"></div>
  •   <p class="clear-left text">
  •    I was dreaming about Hawaii. I was dreaming about my holiday. In
  •    my dream, I was on the beach in Hawaii. The hot sun was shining on
  •    my face. The sound of the sea was all around me.
  •   </p>
  •  </div>
  •  <br />
  •  <br />
  •  <div class="right">
  •   <div class="two"></div>
  •   <p id="p1" class="text">
  •    I was dreaming about Hawaii. I was dreaming about my holiday. In
  •    my dream, I was on the beach in Hawaii. The hot sun was shining on
  •    my face. The sound of the sea was all around me.
  •   </p>
  •  </div>
  •  <br />
  •  <br />
  •  <div class="both">
  •   <div class="one"></div>
  •   <div class="two"></div>
  •   <p class="clear-both text">
  •    I was dreaming about Hawaii. I was dreaming about my holiday. In
  •    my dream, I was on the beach in Hawaii. The hot sun was shining on
  •    my face. The sound of the sea was all around me.
  •   </p>
  •  </div>
  • <script>
  •  /*JavaScript*/
  •  document.getElementById("p1").style.clear = "right";
  •  /*jQuery*/
  •  $(document).ready(function () {
  •   $(".clear-both").css({ "clear": "both" });
  •  });
  • </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="left">
  •   <div class="one"></div>
  •   <p class="clear-left text">
  •    I was dreaming about Hawaii. I was dreaming about my holiday. In
  •    my dream, I was on the beach in Hawaii. The hot sun was shining on
  •    my face. The sound of the sea was all around me.
  •   </p>
  •  </div>
  •  <br />
  •  <br />
  •  <div class="right">
  •   <div class="two"></div>
  •   <p id="p1" class="text">
  •    I was dreaming about Hawaii. I was dreaming about my holiday. In
  •    my dream, I was on the beach in Hawaii. The hot sun was shining on
  •    my face. The sound of the sea was all around me.
  •   </p>
  •  </div>
  •  <br />
  •  <br />
  •  <div class="both">
  •   <div class="one"></div>
  •   <div class="two"></div>
  •   <p class="clear-both text">
  •    I was dreaming about Hawaii. I was dreaming about my holiday. In
  •    my dream, I was on the beach in Hawaii. The hot sun was shining on
  •    my face. The sound of the sea was all around me.
  •   </p>
  •  </div>
  • <script>
  •  /*JavaScript*/
  •  document.getElementById("p1").style.clear = "right";
  •  /*jQuery*/
  •  $(document).ready(function () {
  •   $(".clear-both").css({ "clear": "both" });
  •  });
  • </script>
  • </body>
  • </html>