1.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 compatible2.flaot floating caused IE6 double margin problem, this is the most common, but also best to deal with,!important solve, such asmargin-left:10px!important;margin-left:5px;+height:120px;5. Sometimes, in the layout of the time, found that there is a div
CSS layout skills-center various css la s
Center is a common situation when css is used for layout. When css is used for residence, sometimes a single attribute can be done, and sometimes some skills are required to be compatible
Center horizontally, if you know the width of an element, you can use the
The code is as follows
. cell{width:300px margin:0 Auto; text-align:center;}
If the inline element is centered, use the text-align:center directly.
If the element width is unknown and is not inline, then several scenarios given below are also appropriate for you.
Using CSS to achieve
When building a webpage layout, we often face a problem, that is, to align a div horizontally and vertically. Although there are several ways to achieve it, my favorite method is introduced today, implemented through CSS and jquery.
1. Implement horizontal center through CSS
This is my interview in a company encountered problems, then did not answer!!So see the small partners must pay attention to!!Change the browser width to see the effect:Right and left.Then we'll look at the code:First method: (floating)styletype= "Text/css">. Left,.right,.center{Border:1px solid;Height:100px;text-align:Center;Line-height:100px;font-size:50px; }. Left{float: Left;width:100px; }
[Bootstrap] How bootstrap2 directs div vertical center-CQ_LQJ URL: http://www.4byte.cn/question/138712/bootstrap-how-to-center-vertical.html
Some of them refer to the method on the webpage above. Those who have used bootstrap know that in bootsrap2, the grid layout can be used to center p
Often have a friend asked about the Div horizontal Center and vertical center of the problem, today is written before a jquery implementation method to share;
Remember, jquery.js do not refer to the 2.0.0 version above, to refer to the version of 1.10.1, or IE9 the following incompatible;
Compatible with various browsers:
jquery method
The code is
, and then set a child div class named childDiv. The html code is as follows:
Implements the background color and border size of the box width and height of parentDiv and childDiv Parent and Child div. The CSS code is as follows:
{ :; :; :; } { :; :; :; :; } { :; :; :; }
2.1 horizontal center (UseMar
When building a webpage layout, we often face a problem, that is, to align a div horizontally and vertically. Although there are several ways to achieve it, my favorite method is introduced today, implemented through css and jQuery.
1. Implement horizontal center through css
When it comes to this question, perhaps someone will ask that CSS does not have the Vertical-align property to set the vertical center? Even some browsers do not support I just need to do a little CSSHack technology can be AH! So here I have to say two more words, CSS does have a vertical-align property, but it only for the (X) HTML element has the valign attribu
Beginner html+css Layout, try to write a Baidu home, but the location of footer encountered trouble and Baidu has no good solution, in this record the gradual process. Record, Memo.Beginner, the solution will inevitably appear inappropriate, but also please see this article of the predecessors pointing twos, in this first thanked.The first is set tofooter{Clear:both; Display:block; Position:absolute; bottom:100px;}is absolutely positioned to the
; justify-content:center; align-items:center;}* * Demo Program: * *Demo Code3.4 Using the Grid layoutUsing grid to achieve horizontal vertical centering, poor compatibility, not recommended.* * Core Code: * *.parent{ height:140px; display: grid;}.child{ margin:auto;}* * Demo Program: * *Demo Code3.5 Horizontal vertical centering on the screenHorizontal vertical centering on the screen is common, and regular login and registration pages are required. To ensure good compatibility, you al
Method One: Through the parent Overflow:hidden, you set Padding-bottom and Margin-bottom to achieve.1 #wrap{2 Overflow:Hidden;3 width:1000px;4 margin:0 Auto;5}6 #left, #center{7 Margin-bottom:-10000px;8 Padding-bottom:10000px;9}Ten #left{ One float: Left; A width:250px; - background:#00FFFF; -} the #center{ - float: Left; - width:500px; - background:#FF0000; +}Reference link: pure
hack. (Note the wording. Remember that the statement location needs to be advanced.)2, Ie6/ie77 to Firefox*+html and *html is the unique label of IE, Firefox is not supported. And *+html is a special label for IE7.Note: *+html's hack to IE7 must ensure that the HTML top has the following declaration:Second, universal float closure on the principle of clear float see [How to clear floats without Structural Markup] Add the following code to the global CSS
CSS + DIV layout application, css div LayoutDiv + css layout Application 1. html element classification 2.1, Top-level element)
Definition
Html pageTopTag
Features
1. The width and height cannot be set;
2. It must be at the highest level in the document stream;
3. All block-
of the -100px;/* value equals half the width of the element */top:50%;/* vertical centering with negative values of margin-top */Margin-top: The size of the -100px;/* value equals half the height of the element */}This method can achieve the horizontal vertical center of the element, often used in the most middle of the page layout, using this method must be grasped:horizontally vertically centered elements should have a definite size (in other words
: The size of the -100px;/* value equals half the width of the element */
top:50%;/* vertical centering with negative values of margin-top */
Margin-top: The size of the -100px;/* value equals half the height of the element */
}
Copy CodeThis method can achieve the horizontal vertical center of the element, often used in the layout of the most middle of the page, use this method must be grasped: Horizontal vertical
This article introduces various center methods in CSS. The implementation methods of the eight methods are described in detail, and corresponding, for more information about how to center CSS, see the following section.
First
Horizontal CenterThe simplest way is, of course
The Code is as follows:
Margin: 0 auto;
Th
Original address: https://www.cnblogs.com/cbza/p/7145384.htmlMethod One: Through the parent Overflow:hidden, you set Padding-bottom and Margin-bottom to achieve.(Method One pro-test effective)#wrap{Overflow:Hidden;width:1000px;margin:0 Auto;}#left, #center{Margin-bottom:-10000px;Padding-bottom:10000px;}#left{float: Left;width:250px;background:#00FFFF; }#center{float: Left;width:500px;background:#FF0000; }Me
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.