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
Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS, and JavaScript: Essential Tools for Web DevelopersHTML, CSS, and JavaScript: Essential Tools for Web DevelopersApr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesThe Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesApr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

Is HTML easy to learn for beginners?Is HTML easy to learn for beginners?Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

What is an example of a starting tag in HTML?What is an example of a starting tag in HTML?Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

How to use CSS's Flexbox layout to achieve centering alignment of dotted line segmentation effect in menu?How to use CSS's Flexbox layout to achieve centering alignment of dotted line segmentation effect in menu?Apr 05, 2025 pm 01:24 PM

How to design the dotted line segmentation effect in the menu? When designing menus, it is usually not difficult to align left and right between the dish name and price, but how about the dotted line or point in the middle...

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version