Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deeply analyze the use of DIV tags

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

How to in-depth analysis of the use of DIV tags, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

To describe the use of the DIV tag, the DIV tag is called a partition tag. Function: set the position of words, paintings, tables, etc. When you put text, image, or something else in DIV, it can be called "DIV block", or "DIV element" or "CSS-layer", or simply "layer".

DIV tag

DIV elements are elements that provide structure and background for block-level content in an HTML document. Everything between the start and end tags of the DIV is used to form this block, and the properties of the elements contained in it are controlled by the attributes of the DIV tag, or by formatting the block using a style sheet.

The DIV tag is called a partition tag. Function: set the position of words, paintings, tables, etc. When you put text, image, or something else in DIV, it can be called "DIV block", or "DIV element" or "CSS-layer", or simply "layer". In Chinese, we call it "hierarchy". So when you see these nouns later, you will know that they refer to a HTML in DIV.

DIV tag applied to Style Sheet (style sheet) will be more powerful, its ultimate goal is to give the designer another organizational ability, there are Class; Style; title; ID and other attributes, will be detailed in the [Style Sheet] section, where only one property setting is introduced.

Use DIV tags (div)

When we use CSS-P, we mainly use it on DIV (division) tag. When you put text, image, or something else in DIV, it can be called "DIV block", or "DIV element" or "CSS-layer", or simply "layer". In Chinese, we call it "hierarchy". So when you see these nouns later, you will know that they refer to a HTML in DIV.

Use DIV tags in the same way as other tag:

This is a DIV tag.

If you use the DIV tag alone without any CSS-P, it will have the same effect on a web page as it does in a web page.

But when we use CSS-P in DIV, we can strictly set its position. First we need to give the DIV that can be controlled by CSS-P an ID or its name. For example, we give the following DIV the name truck. The purpose of giving a name is that we can use JavaScript to control it later, such as moving it or changing some of its properties, and so on.

This is a truck

The name for the hierarchy is arbitrary. The name can be any English letter or number, but * must be a letter. There are two ways to apply CSS-P to DIV.

Inline CSS:Inline is the most commonly used method.

External STYLE tag: the result of using the External method is the same. We will explain this method in more detail in a later course. Now let's focus on the Inline method. Notice the relationship between ID and DIV in the External method, in the STYLE.

Nature of Cross-Browser CSS:

The main purpose of our course is to make the web pages you write work on both NS4 and IE4, so we focus on properties that are common to both. The following properties conform to the standards given by the W3C.

◆ position determines how the DIV tag is placed. "relative" means that the position of the DIV tag is relative to other tag, while "absolute" means that the position of the DIV tag is relative to the window in which it is located.

The position of left relative to the left side of the window

The position of top relative to the top of the window

Width of the width DIV tag. All the text or html in the DIV tag is inside.

Height of the height DIV tag. This property is rarely used unless you want to Clip the hierarchy.

◆ clip gives the clipping (visible) portion of layer. Clip makes the DIV appear as an accurate square that can be defined. You can use the following four values to give the location and size of the square in DIV.

Clip:rect (top,right,bottom,left)

Visibility conceals or shows DIV according to its values "visible", "hidden", "inherit".

The stereoscopic position of the z-index DIV tag. The higher the value, the higher the position of DIV.

The color of the background of the background-color DIV tag.

The DIV background color of the layer-background-color Netscape.

The background image of the background-image DIV tag.

The background image of layer-background-image Netscape's DIV.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report