Home  >  Article  >  Web Front-end  >  Several points to pay attention to in css layout

Several points to pay attention to in css layout

php中世界最好的语言
php中世界最好的语言Original
2017-11-20 17:07:181770browse

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!

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