Several points to pay attention to in css layout
The layout of a web page has a significant impact on user experience and Baidu rankings. No matter how good the content of your website is, it is useless as long as the layout is poor, so when we get it from the design You can't just add pictures to your web page casually. Only after analyzing the pictures can you make a good CSS layout.
Layout accounts for a large part in 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. CSS layout analysis directly affects the future css reconstruction of html. Whether the page is easy to write is one step.
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 CSS layout analysis. We use the DIVCSS5 list page to analyze the css layout:
First we can analyze our DIV CSS layout and reconstruct this page We can see the structural frame as 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 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>css布局案例实验页面-www.divcss5.com.cn</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> index .css的CSS代码如下:
The following is the 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 take the test Create a new try out of these two pieces of code. 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.
About css layout_div css layout is so important, I hope it will be helpful to you. The above cases are not explained in detail. I hope you can practice more in person. Only by practicing can you improve your skills.
Related reading:
Super lightweight web flow layout JS plug-in Macy.js
Detailed explanation of Flex layout in CSS3
Detailed graphic explanation of layout tags and list tags in html
The above is the detailed content of Several points to pay attention to in 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.

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.

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 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-
