亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

HTML+CSS easy entry layer model

What is the layer model?

What is the layer layout model? The layer layout model is like the very popular layer editing function in the image software PhotoShop. Each layer can be accurately positioned and operated. However, in the field of web design, layer layout has not been popular due to the mobility of web page sizes. However, there are still advantages to using layer layout locally on a web page. Let's learn about the layer layout in html.

How to accurately position html elements in web pages, just like the layers in the image software PhotoShop, each layer can be accurately positioned and operated. CSS defines a set of positioning properties to support the layer layout model.

The layer model has three forms:

1. Absolute positioning (position: absolute)

2. Relative positioning (position: relative)

3. Fixed positioning (position: fixed)

Absolute positioning The code is as follows:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>層模型</title>
<style type="text/css">
    #dv1{
      width:100px;
      height:100px;
      background:green;
      position:absolute;   /*絕對(duì)定位*/
      left:50px;
      top:50px;
    }
   
</style>
</head>
<body>
      <div id="dv1"></div>
</body>
</html>

Relative positioning, the code is as follows:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>層模型</title>
<style type="text/css">
    #dv1{
      width:100px;
      height:100px;
      background:green;
      position:relative;
      left:50px;
      top:50px;

    }
   
</style>
</head>
<body>
      <div id="dv1"></div>
</body>
</html>

If you want to set a layer for the element Relative positioning in the model requires setting position:relative (indicating relative positioning), which determines the offset position of the element in the normal document flow through the left, right, top, and bottom attributes. The process of relative positioning is to first generate an element in static (float) mode (and the element floats like a layer), and then moves relative to the previous position. The direction and amplitude of the movement are determined by the left, right, top, and bottom attributes. , the position before offset remains unchanged.

Fixed positioning

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>層模型</title>
<style type="text/css">
    #dv1{
      width:100px;
      height:100px;
      background:green;
      position:fixed;
      left:50px;
      top:50px;

    }
   
</style>
</head>
<body>
      <div id="dv1"></div>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>
      <p>php 中文網(wǎng)</p>
      <p>學(xué)習(xí)電腦</p>
      <p>二次開(kāi)發(fā)</p>


</body>
</html>


Continuing Learning
||
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>層模型</title> <style type="text/css"> #dv1{ width:100px; height:100px; background:green; margin-left:50px; margin-top:50px; position:absolute; /*絕對(duì)定位*/ } </style> </head> <body> <div id="dv1"></div> </body> </html>
submitReset Code