Get the App
SLTechnology News&Howtos  ›  Development  › 

How to parse the usage of four attributes in DIV layout

Shulou Source: shulou.com Published: 2022-06-02 13:53:36 11月16日 Update

This article introduces how to analyze the usage of the four attributes in the DIV layout, the content is very detailed, interested friends can refer to it, I hope it can be helpful to you.

In the process of learning page layout, whether you understand the attributes of DIV layout, in the previous HTML, the location of elements can only be felt by the arrangement of elements in turn, while in CSS you can locate elements more accurately.

DIV layout properties:

In the previous HTML, the position of elements can only be felt by the arrangement of elements in turn, but in CSS you can locate elements more accurately. Netscape has proposed Layer markup, which is good for precise layout, but it has not been recognized by the W3C, which has proposed a function similar to Layer tagging in CSS.

Position property of ◆ DIV layout:

The position attribute is used to determine the location type of the element, as detailed in the attribute:

Attribute name: 'position'

Attribute value: absoluterelativestatic

Initial value: static

Fit objects: all elements

Whether to inherit: no

Percentage remarks: prohibited

The attribute values represent:

Absolute: the absolute position on the screen.

Relative: the relative position on the screen.

Static: inherent position.

Direction property of ◆ DIV layout:

The direction attribute determines the orientation of the BOX. For more information, please see the attribute:

Attribute name: 'direction'

Attribute value: ltrrtl

Initial value: ltr

Fit objects: all elements

Whether to inherit: yes

Percentage remarks: prohibited

The float and clear properties of the ◆ DIV layout:

In HTML, the picture can choose the floating position, and now the BOX object can also choose the floating position through CSS. Change the float attribute of BOX, and BOX floats to the left or right of other elements:

Attribute name: 'float'

Attribute value: leftrightnone

Initial value: none

Fit objects: all elements

Whether to inherit: no

Percentage remarks: prohibited

For example:

IMG {float:left} BODY,P,IMG {margin:2em}

Somesampletextthathasnoother...

◆ conversely, using the clear attribute prevents the element from floating to the left or right of the BOX:

Attribute name: 'clear'

Attribute value: leftrightbothnone

Initial value: none

Fit objects: all elements

Whether to inherit: no

Percentage remarks: prohibited

On how to analyze the use of the four attributes in the DIV layout to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Attributes elements layout location object name remarks percent percentage accuracy content screen more tags positioning help selection good representative interest Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno macOS MariaDB Redmi Apple