search
HomeWeb Front-endHTML TutorialStanding on top of DIV CSS_html/css_WEB-ITnose

As a programmer, you can’t just learn technology. When appropriate, you need to stand higher, so that you can see further and achieve higher achievements!

If you are doing web development, then DIV CSS will be the basis for our learning. Many people think that DIV CSS is very simple. It is true. A good programmer can imitate almost all displayed web pages. And it achieves very cool page special effects, giving people a refreshing feeling. I am often excited to see a beautiful web page. But if the level of learning is limited to this, then what else can you do besides being a coder!

Awareness of global thinking

The first thing to do in any page design is to use DIV to design the framework, for example, consider what the page should be as a whole The structure looks like three layers: upper, middle, and lower, or three layers left, middle, and right, or only part of it, etc.


<div style="border:1px solidred;margin:1px;height:100px;">这是top部分</div><div style="border:1px solidred;margin:1px;height:500px;">这是middle部分</div><div style="border:1px solidred;margin:1px;height:100px;">这是bottom部分</div> <div style="border:1px solidred;margin:1px;width:200px;float:left;">这是left部分</div><div style="border:1px solidred;margin:1px;width:400px;float:left;">这是center部分</div><div style="border:1px solidred;margin:1px;width:200px;float:left;">这是right部分</div>

Although this has become the case for all web development It is the first step for people to make web pages, and they have been on this road for many years, but the wisdom in this is not something that everyone will think about. The framework requires designers to think from a high point and be able to think about problems from a global perspective, rather than blindly moving forward at one level. Otherwise, your design will be a mess of eyebrows and beards, with neither a clear overall structure nor a clear Attention to detail!

Find commonalities

After completing the DIV frame design, it is usually necessary to classify the page elements, so that the modification of the page style will It will become very convenient. For example, the common blog columns on the left side of CSDN all have their own styles. In this way, when we modify the style, we can ensure the unity of the page style as much as possible and avoid the page being unreadable due to different styles. Eyes!

In this way, for the above DIV code, we can abstract its public components to form a class, and retain their different parts in each div block. The code is as follows

<div class="style1" style="height:100px;">这是top部分</div><div class="style1" style="height:500px;">这是middle部分</div><div class="style1" style="height:100px;">这是bottom部分</div> <div class="style1" style="width:200px;float:left;">这是left部分</div><div class="style1" style="width:400px;float:left;">这是center部分</div><div class="style1" style="width:200px;float:left;">这是right部分</div>


The public components proposed are placed in the CSS file, as follows:

.style1{	border:1pxsolid red;	margin:1px;}

For web developers, the extraction of public parts is an important part of the difference between rookies and veterans! This way of thinking when it comes to learning is: putting what we have not learned on the basis of what we have learned. The wisdom in this is actually more worthy of praise for you and me than learning a very good technology!

No matter how awesome the technology is, it can be seen and touched. As long as you want to learn it, there is nothing you can’t learn! However, condensation of thoughts is not something everyone can do, so thinking more, summarizing learning experiences, and refining methods are the shortcuts for friends to make progress!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What is the difference between an HTML tag and an HTML attribute?What is the difference between an HTML tag and an HTML attribute?May 14, 2025 am 12:01 AM

HTMLtagsdefinethestructureofawebpage,whileattributesaddfunctionalityanddetails.1)Tagslike,,andoutlinethecontent'splacement.2)Attributessuchassrc,class,andstyleenhancetagsbyspecifyingimagesources,styling,andmore,improvingfunctionalityandappearance.

The Future of HTML: Evolution and TrendsThe Future of HTML: Evolution and TrendsMay 13, 2025 am 12:01 AM

The future of HTML will develop in a more semantic, functional and modular direction. 1) Semanticization will make the tag describe the content more clearly, improving SEO and barrier-free access. 2) Functionalization will introduce new elements and attributes to meet user needs. 3) Modularity will support component development and improve code reusability.

Why are HTML attributes important for web development?Why are HTML attributes important for web development?May 12, 2025 am 12:01 AM

HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

What is the purpose of the alt attribute? Why is it important?What is the purpose of the alt attribute? Why is it important?May 11, 2025 am 12:01 AM

The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

HTML, CSS, and JavaScript: Examples and Practical ApplicationsHTML, CSS, and JavaScript: Examples and Practical ApplicationsMay 09, 2025 am 12:01 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

How do you set the lang attribute on the  tag? Why is this important?How do you set the lang attribute on the tag? Why is this important?May 08, 2025 am 12:03 AM

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

What is the purpose of HTML attributes?What is the purpose of HTML attributes?May 07, 2025 am 12:01 AM

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

How do you create a list in HTML?How do you create a list in HTML?May 06, 2025 am 12:01 AM

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools