国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

HTML+CSS Easy to Get Started with Floating Model

-shaped elements are so overbearing that they occupy one line. What if we want two block-shaped elements to be displayed side by side? Don't worry, setting the element to float can achieve this wish.

Any element cannot float by default, but it can be defined as floating using CSS. Elements such as div, p, table, img, etc. can be defined as floating.

Let’s do this Write a floating example, the code is as follows

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>流動模式下的內(nèi)聯(lián)元素</title>
<style type="text/css">
    #dv1{
      width:100px;
      height:100px;
      background:green;
    }

    #dv2{
      width:100px;
      height:100px;
      background:red;
    }
</style>
</head>
<body>
      <div id="dv1"></div>
      <div id="dv2"></div>
</body>
</html>

The above code is that the block element div occupies an exclusive line. Now we need to display them on one line, and then add some distance between the two divs. Please see the following code:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>流動模式下的內(nèi)聯(lián)元素</title>
<style type="text/css">
    #dv1{
      width:100px;
      height:100px;
      background:green;
      float:left;
    }

    #dv2{
      width:100px;
      height:100px;
      background:red;
      float:left;
      margin-left:5px;  /*調(diào)節(jié)倆個div之間的距離*/
    }
</style>
</head>
<body>
      <div id="dv1"></div>
      <div id="dv2"></div>
</body>
</html>

In this way, the effect we want is completed. First, we need to make a float to the left for the first div, and the same for the second one. Then the two will be linked together and displayed on the same line.

Next we make a left border for the second div and that’s it

Continuing Learning
||
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>流動模式下的內(nèi)聯(lián)元素</title> <style type="text/css"> #dv1{ width:100px; height:100px; background:green; float:left; } #dv2{ width:100px; height:100px; background:red; float:left; margin-left:5px; /*調(diào)節(jié)倆個div之間的距離*/ } </style> </head> <body> <div id="dv1"></div> <div id="dv2"></div> </body> </html>
submitReset Code