Div code Daquan Div code instructions for use

Source: Internet
Author: User

I. Div code syntax-top

Div code is placed in the less than or greater than symbol, that is, "<div> ".

DIV is a pair of closed labels, that is, the box labels of "start and end.

Syntax structure:

 

<Div> I am the content </div>

Note: The DIV code must be closed at the beginning. Start with "<div>" and close "/Div.

Ii. Div nested div-top

An infinite Div can be nested in a div tag.

<Div> independent Div </div> <Div class = "box"> <Div class = "Left"> </div> <Div class = "right"> </Div> </div>

 

Independent Div

The code above can also be used as a separate Div code, and the nested DIV in the DIV can also be used.

Div nested Div layout is very common and inevitable. Common Div + CSS layout a large frame Div contains several Div boxes, and several Div boxes are nested with the lower Div box, implement various web page la S.

We compare the outermost Div to a room, where there are various boxes containing items and small boxes. We can also think of these boxes as Div, therefore, it is better to understand the nesting from the space imagination.

 

Iii. Div layout structure-top

In general, div is used to layout the webpage structure, such as the upper and lower structures, the left and right structures, and more complex and comprehensive structures. We use Div for layout. In addition to using the DIV layout with a large structure and a small structure, you can set various CSS styles to achieve a variety of beautiful artist la S.

 

Iv. Use CSS code-top in style in Div

You can directly write the CSS style code in the Div. You only need to use the style attribute in the DIV code (TAG) to directly write the CSS style.

Case:

1. Div code:

<Div style = "color: # f00; Border: 1px solid #000; width: 300px; Height: 100px"> Hello divcss5 </div>

 

2. Complete case code and results

  

Div directly writes CSS

3. Complete HTML case code

<! Doctype HTML> 

 

The above HTML code can be directly copied and used before the browser can observe the effect.

 

V. ID and class-top in Div

Use Id or class in the DIV label to set the CSS style sheet.

Demonstration of ID and class in Div:

  

    <div id=”header”></div>     <div class=”box”></div> 
I. Div code syntax-top

Div code is placed in the less than or greater than symbol, that is, "<div> ".
DIV isOne pair of closedTag, that is, "<div>"Start, "</Div>"End.

Syntax structure:

  1. <Div> I am the content </div>

Note: The DIV code must be closed at the beginning.
Start with "<div>" and close with "</div>.

Ii. Div nested div-top

An infinite Div can be nested in a div tag.

  1. <Div> separate Div </div>
  2.  
  3. <Div class = "box">
  4. <Div class = "Left"> </div>
  5. <Div class = "right"> </div>
  6. </Div>

The code above can also be used as a separate Div code, and the nested DIV in the DIV can also be used. Div nested Div layout is very common and inevitable. Common Div + CSS layout a large frame Div contains several Div boxes, and several Div boxes are nested with the lower Div box, implement various web page la S.

We compare the outermost Div to a room, where there are various boxes containing items and small boxes. We can also think of these boxes as Div, therefore, it is better to understand the nesting from the space imagination.

Iii. Div layout structure-top

Generally, div is used to layout the webpage structure, such as the upper and lower structures, left and right structures, and more complex and comprehensive structures. Div is used for layout (divcss5 online VIP tutorial also provides graphic layout tutorials with basic structure ). In addition to using the DIV layout with a large structure and a small structure, you can set various CSS styles to achieve a variety of beautiful artist la S.

Iv. Use CSS code-top in style in Div

You can directly write the CSS style code in the Div. You only need to use the style attribute in the DIV code (TAG) to directly write the CSS style.

Case:
1. Div code:

  1. <Div style = "color: # f00; Border: 1px solid #000; width: 300px; Height: 100px"> Hello divcss5 </div>

2. Complete case code and results


Div directly writes CSS

3. Complete HTML case code

  1. <! Doctype HTML>
  2. <HTML>
  3. <Head>
  4. <Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
  5. <Title> case study of Div writing CSS divcss5 </title>
  6. </Head>
  7.  
  8. <Body>
  9.  
  10. <Div style = "color: # f00; Border: 1px solid #000; width: 300px; Height: 100px"> Hello divcss5 </div>
  11.  
  12. </Body>
  13. </Html>

The above HTML code can be directly copied and used before the browser can observe the effect.

V. ID and class-top in Div

Use Id or class in the DIV label to set the CSS style sheet.

Demonstration of ID and class in Div:

  1. <Div id = "Header"> </div>
  2. <Div class = "box"> </div>
6. For details about Div ID and class usage and tutorials, see the following Div CSS articles:-top

1. How to Select ID class
2. Differences between ID and class
3. ID and class
4. Usage and difference of class and ID
5. Div ID
6. Div class
7. Div attributes
8. view the style set by Div

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.