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

The method of absolute Positioning layout in DIV CSS

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the relevant knowledge of "the method of DIV CSS absolute positioning layout". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "the method of absolute positioning layout of DIV CSS" can help you solve the problem.

First, the use of CSS and HTML tags and corresponding instructions

1. Use CSS fancy words and explain them.

Position: absolute positioning fancy completion DIV positioning structure its setting value absolute and relative application

Width: width, configuration object width

Height: height, setting object height

Line-height: line height, configuration text line height

Left: configuring the div object to the left

Right: configure div objects to be spaced to the left

Top: configure div objects to be isolated to the left

Bottom: configure div objects to be partitioned to the left

Bac kg round: backing, setting up equipment, backup pictures and tones

Color: configuring font color

Font-size: configuring font siz

Font-weight: setting font bold

2. Use HTML tags and interpretations

Div tags: used to construct structural frames

Ul li tags: for layout column phenotypic data list

H4 label: used for layout column refers to the title

Second, relative to the positioning of real cases, organizational thinking to explain the introduction.

CSS5 uses the latent calligraphy after the whole picture as the outermost large box DIV backing picture, named bg.jpg.

The latent picture material can be used directly in daily life.

This outermost DIV, set the width and height, the backer picture, and set the equipment position:relative. This box is divided into three small DIV boxes, set the width and height of the equipment separately, and set the relative positioning of position:absolute, and then use the colors of left, right, top and bottom to locate the position of the three boxes.

After the above organization can structure three DIV boxes, and then separately construct the column refers to the title and content can be realized.

At the same time, in this case, we can initialize the template provided by CSS5, so as to be compatible with all major hunters.

Third, relative to the location of the case requires code

The following is the outermost DIV box and CSS code and content 3 small box office code.

1. HTML code

Absolute positioning example online demonstration CSS5

The above HTML constructs a large box using ID, and three small DIV boxes use CLASS.

2. CSS code

# wrapper {margin:0 auto;position:relative;width:610px;height:559px;background:url (bg.jpg) no-repeat}

/ * position:relative is relative positioning, parent configuration * /

.box1 {position:absolute; width:147px; height:140px; left:198px; top:14px}

.box2 {position:absolute; width:141px; height:186px; left:31px; bottom:17px}

.box3 {position:absolute; width:132px; height:188px; right:28px; bottom:67px}

/ * three small boxes use position:relative to configure width and height left right top bottom at the same time to realize construction and accurate positioning * /

Rating clarifies: the accurate values of the relative positioning width, height, top, left, right and bottom of the above three small boxes must be lost by PS software. It is believed that students who have quit CSS5 training have learned to obtain the door path of various attributes and values through class. (the introduction and video coaxing in the CSS5 class demonstrated the skills and techniques of how to acquire each value of PS.) there is no more specific introduction and teaching here.

3. Screenshots of Dayao's attainments

Screenshots of grades in DW software

From the above picture, we can see the initial appearance of the layout structure. Based on the above, the agency can be completed in accordance with the title of the agency column and the corresponding model.

IV. Incomplete case code

1. Complete CSS code

@ charset "utf-8"

/ * CSS5-CSS initialization template-css5.com.cn * /

Body, div, ul, li,h4 {margin:0; padding:0;font-style: normal;font:12px/22px "\ 5B8B\ 4F53", Arial, Helvetica, sans-serif}

/ *\ 5B8B\ 4F53 stands for Song style, more Chinese fonts are converted to Unicode / / www.css5.com.cn/jiqiao/325.shtml * /

Ol, ul, li {list-style:none}

Img {border: 0; vertical-align:middle}

Body {color:#FFF;bac kg round:#FFF; text-align:center}

A {color:#FFF;text-decoration:none}

A:hover {color:#BA2636;text-decoration:underline}

/ * follow this example to set the device to show white hyperlink fonts and no hyperlink fonts * /

# wrapper {margin:0 auto;position:relative;width:610px;height:559px;bac kilogram round: url (bg.jpg) no-repeat}

/ * position:relative is the relative positioning key, and the parent sets the equipment * /

.box1 {position:absolute; width:147px; height:140px; left:198px; top:14px}

.box2 {position:absolute; width:141px; height:186px; left:31px; bottom:17px}

.box3 {position:absolute; width:132px; height:188px; right:28px; bottom:67px}

/ * position:absolute is the crux of relative positioning. Set up the equipment and equipment at the same time and use lef right top bottom together * /

H4.title {height:32px; line-height:32px; font-size:14px; font-weight:bold; text-align:left}

/ * problem counterbalance configuration * /

Ul.list {text-align:left; width:100%; padding-top:8px}

Ul.list li {width:100%; text-align:left; height:22px;overflow:hidden}

/ * after adding too much overflow:hidden prevention content, take the initiative to change lines and override mode * /

2. Incomplete HTML code:

Online demonstration of CSS5 for relative positioning examples

news information

Can't you learn CSS every time?

Is it difficult to learn DIVCSS?

I want to be included in the CSS5 training.

All versions of jQuery are arranged together.

CSS5 column

Basic course of CSS

HTML basic tutorial

CSS problem

CSS production equipment

DIV CSS intelligence

DIV+CSS+JS special effects

Website column

Getting started with DIV CSS

HTML getting started tutorial

CSS instance

CSS5 Home Page

DIV CSS module template

DIV CSS WEB standard

This is the end of the introduction to "the method of absolute positioning layout of DIV CSS". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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