Home  >  Article  >  Web Front-end  >  Complete the storage example of div position through css layout

Complete the storage example of div position through css layout

零下一度
零下一度Original
2017-06-24 11:43:231394browse

CSS+DIV

Encapsulate data into divs. The page is composed of many divs. The storage of these div positions is completed through css layout (through css attribute layout). A div is a box. .

border:{

    ——left

   ——right

   ——top

   ——bottom

  };

#div_1{

   border-top:1px solid #ccc;

   border-bottom:1px dashed #ccc;

   border -right:1px dotted #ccc;

  border-left:1px double #ccc;

};

solid:solid line

dashed:dashed line

dotted:dotted line

double:double line

Padding/Padding

Attribute: padding{

   ——top

    ——bottom

    ——right

    ——left

#};

padding: 20px 20px 20px 20px;

Margin

margin attribute{

     --top

    --bottom

   ——right

   ——left

};

margin:20px 20px 20px 20px

In the div, if the margin is 0,px , why is there still a blank space? The blank space is the distance between the body itself and the browser border.

So you need to set body{margin:0px};

Browsers parse the body in different ways, resulting in different widths and widths.

The above is the detailed content of Complete the storage example of div position through css layout. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn