What are the techniques for CSS layout?
How does CSS need to be laid out? What aspects should be paid attention to when designing CSS layout? What are the techniques for CSS layout? Today we will summarize them one by one for you. How to have good CSS layout.
Everyone knows that when the PS (pictures) taken from graphic designers are refactored by CSS reconstructors, the web page art pictures need to be analyzed. Only through good analysis can CSS layout be achieved.
Therefore, DIV CSS layout accounts for a large part of the analysis. When we analyze web page art pictures, we do not analyze whether the pictures are good-looking, but analyze the art pictures of the web page based on the css layout, and CSS layout analysis directly affects future css. A step to reconstruct whether the html page is easy to write.
Layout knowledge:
DIV+CSS layout, CSS layout is the collective name for web pages (html) developed and produced through div tags + css style sheet code.
Benefits of div+css layout: easy to maintain, beneficial to SEO (Google uses webpage opening speed as a ranking factor and SEO factor), webpage opening speed is faster, and it complies with web standards, etc.
Think about the layout before making a div+css webpage:
First we get a webpage art picture and we will layout it from top to bottom, top to middle and bottom, left and right, top to middle (including left and right) framework to think about.
The following is a example to explain the CSS layout analysis. We use the list page to analyze the CSS layout:
First we can analyze our DIV CSS layout and reconstruct the structure of this page. We can see that the frame has upper, middle and lower structures, including left and right structures.
Therefore, when we write the CSS and HTML of this page, we should first write the CSS and HTML from top to bottom and from the outside to the inside.
We first create a web folder and create a new html page in this folder named index.html and a css file named index.css. The trick here is to import the template to build the CSS and HTML initial page, and then reference the CSS file to the HTML, which is the CSS template I introduced in the template, and then write and add CSS based on the CSS template.
The following is the html code of index.html:
The following is the quoted content:
<!DOCTYPE "> <html "> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>css布局案例实验页面</title> <link href="index.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="header">我是头部(上)</div> <div id="centers"> <div class="c_left">我是中的左</div> <div class="c_right">我是中的右</div> <div class="clear"> </div> </div> <div id="footer">我是底部(下)</div> </body> </html>
The CSS code of index .css is as follows:
The following is Quoted content:
body, div, address, blockquote, iframe, ul, ol, dl, dt, dd, li, dl, h1, h2, h3, h4, h5, h6, p, pre, table, caption, th, td, form, legend, fieldset, input, button, select, textarea {margin:0; padding:0; font-weight: normal;font-style: normal;font-size: 100%; font-family: inherit;} ol, ul ,li{list-style: none;} img {border: 0;} body {color:#000;background:#FFF; text-align: center; font: 12px/1.5 Arial, Helvetica, sans-serif;} .clearfix:after {clear:both; content:"."; display:block; height:0pt; visibility:hidden; overflow:hidden;} .clear{clear:both;height:1px; margin-top:-1px; width:100%;} .dis{display:block;} .undis{display:none;} /*此上面代码是初始CSS模板,下面是新写CSS布局框架代码*/ #header ,#centers ,#footer{ width:100%; margin:0 auto; clear:both;font-size:18px; line-height:68px; font-weight:bold;} #header{ height:68px; border:1px solid #CCCCCC; } #centers{ padding:8px 0;} #footer{ border-top:1px solid #CCCCCC; background:#F2F2F2;} #centers .c_left{ float:left; width:230px; border:1px solid #00CC66; background:#F7F7F7; margin-right:5px; } #centers .c_right{ float:left; width:500px;border:1px solid #00CC66; background:#F7F7F7}
You can try out these two pieces of code and create a new one. We will lay out the CSS and html framework of the above art page, and then continue to add CSS and html source code according to each content.
I believe everyone already understands the importance and explanation of css layout. For more exciting content, please pay attention to other related articles on the php Chinese website!
Related reading:
How to use min-height and max-height in CSS
How to display circular images in css3
The above is the detailed content of What are the techniques for CSS layout?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

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.

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

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-
