Common techniques for CSS compatibilityPlease try to write code in XHTML format, and DOCTYPE affect the CSS processing, as a standard, must add DOCTYPE declaration. Vertical centering problem for 1.divVertical-align:middle; Increase the line spacing to as high as the whole Div line-height:200px; Then insert the text and center it vertically. The disadvantage is
; }DescriptionThe text-align:center is defined first in the parent element, which means that the content within the parent element is centered, and the setting for IE is already available.But it can't be centered in Mozilla. The solution is to add "Margin-right:auto" when the child element is defined; Margin-left:auto; ”It should be explained that if you want to use this method to
CSS Compatibility common skills
Please try to write code in strict XHTML format, must add DOCTYPE declaration, because DOCTYPE affect the CSS processing, affect the standard of the consortium.
Vertical center of text in 1.div
Vertical-align:middle; Increase line spacing to be as high as the entire Div line-height:20
DIV+CSS compatible with browser methods such as IE6 IE7 IE8 IE9 and Firefox Chrome1.DOCTYPE affects CSS processing 2. Ff:div set Margin-left, margin-right for Auto is already centered, IE not 3. Ff:body when setting text-align, Div needs to set Margin:auto (mainly margin-lef
contents of , and then extract keywords, so that others in the search engine input keywords, it will be easier to find your site yo ~ then the flow of the swish drop ~ ^_^For the content of the article, we put it in the OK, the corresponding code is as follows: HTML code:Welcome to We are a group of enthusiastic friends who love the front page technology and are keen to promote the standard of the Web, if you want to learn or are learning div+
css| Tutorials | Getting Started
Second, write the whole layer structure and CSSNext we create a new folder on the desktop named "Div+css layout Exercise", create a new two blank Notepad document under the folder, and enter the following:
Untitled Document
This is the basic structure of XHTML, named Index.htm, and another Notepad document named Css.c
One, with CSS to make the div layer horizontally centered
Add the following properties to the DIV layer that needs to be centered horizontally:
Margin-left:auto;Margin-right:auto;
This is already
When using the Div+css layout, you should first structure the content of the Web page, carefully analyze and plan your page structure, and you might get a few pieces like this:Page-level containers, page headers, flags and site names, site navigation (main menu), master content, submenus, search boxes, footers (copyright and related legal notices).You typically use DIV
How does CSS display two columns of div side by side? CSS displays two columns of div
How to make the two columns of div display side by side in CSS:Suggestion: writing code as much as possible can effectively improve learning eff
, you can define the border of a table as a uniform style, or you can define top, right, respectively, the color, size, and style of the bottom and left border.
You can use the table, td or th selectors.
If you need to set the border-less effect, you can use the CSS definition: border-collapse: collapse;
Clear: left;
Clear: right;
Clear: both;
Many 2-or 3-column la s are located using the float attribute. If you define the background color or
a line.
To vertically center a single line of text, you only need to ensure that the DIV height and the row height are consistent. Use the following code:
CSS code:# Div-{Height: 60px;Line-Height: 60px;}
XHTML code:Vertical center of Div text
If you want to center the text in the
*/* + Html #1 {color: #999;}/* ie */
The font color in Firefox is displayed as #333, the font color in IE6 is displayed as #666, And the font color in IE7 is displayed as #999.
2. center problem in CSS layout
The main style definition is as follows:
Body {text-align: center ;}# Center {margin-Right: auto; margin-left: auto ;}
Note:
First, define text-align: center in the parent element. This means that the content in the parent element is
yourself a website reconfiguration engineer, what a nice name, can not let others call you div+ CSS staff bar.
In the "Beyond the CSS", they still recommend less use Div, more reasonable use of tags, do not forget in the XHTML there are many p,form tags. Reasonable use of tags, a reasonable page structure will
DIV CSS OptimizationDIVCSS5 to introduce simple CSS optimizations for you.Involves optimizing content:Optimization of CSS code optimization, CSS reuse optimization, shortening characters, deleting line breaks, etc.DirectoryCSS style word shorthand optimizationPunctuation opt
:
Flag and Site name
Home Page Content
Site navigation (Main menu)
Sub Menu
Search box
Ribbon (e.g. shopping cart, cashier)
Footer (copyright and related legal notices)
We usually use DIV elements to define these structures, like this:
This is not a layout, it is a structure. This is a semantic description of the content block. When you understand your structure, you can add the corresponding ID to the
Reference URL: http://www.jb51.net/css/140685.htmlWith Microsoft's new operating system listed, IE6 now use fewer people, but the XP system seems to be too classic, there are still a considerable number of users in use, and most of this group of people do not have the habit of upgrading the browser alone, so IE6 is still the most used browser version. According to the traffic statistics of this station, the visit proportion from IE6 is 72.6%. Show the
DIV+CSS Resolving IE6,IE7,IE8,FF compatibility issues1.IE8 compatibility issues, this best deal, converted into IE7 compatible can be. Add the following piece of code to the head, and then as long as it is compatible under IE7, IE8 below is also compatible:1.2.2.flaot floating caused IE6 double margin problem, this is the most common, but also best to deal with,!important solve, such asUnder the MARGIN-LEFT
background image material.Cut out such a complete vertical bar image as Div+css layout footage, save as saved usingIi. Instance-specific layout code (HTML+CSS)-TOPThe case code layout is based on the inductive DIVCSS5 initialization template.1. HTML code
ul class="Array">
li>a href="http://www.divcss5.com/
Let the contents of the div be centered vertically, but there are several ways to do so, and so I enumerate:
Line height (line-height) method
If you want to center vertically with only one line or several words, it is the easiest to make, as long as the line height of the text and the height of the container can be the same, such as:
The code is as
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.