When the body has only one div, you can make the div fill the entire screen in such a way.1. Set the positioning for the Div. Review--There are five properties of position in CSS:Static: Default value, no positioningAbsolute: Absolute positioning, positioning relative to the parent elementRelative: Relative positionin
Center horizontally:inline element: Text-align:center; Center display relative to parentBlock-level elements: margin:0 auto; But you need to have width at the same time, otherwise you can't see the effectMultiple block-level elements centered: Here you want to explore display:inline-block; and Display:flex;Method 1: Set the Text-align:center on the parent, set on the element: Display:inline-block, and in order to
Use Div and CSS to create triangle effects:This section describes how to use the div and CSS to achieve the triangle effect, although it looks like the table is magical, but the principle is very simple.The code is as follows:DOCTYPE HTML>HTML>Head>MetaCharSet= "Utf-8">Metaname= "Author"content= "http://www.softwhy.com
css| Web page
The Web pages that meet the standards are DIV+CSS made, so are table tables that we used to be useful? Do you want to give up completely?
About the use of div and table tables There are many people are very confused, sorting out the idea!
About tables
After using web standards, it's not about excluding
-left-color:For example:border-left-width:1px;Border-left-style: solid; Border-left-color: #000000; Note:In the page app, the set of border also occupies the page space. So, when the layout is accurately calculated,Even in the case of border 1px, it is important to take into account the influence of border on width and height.2. CSS padding (padding) propertiesProperties: Padding (padding-top, padding-right, Padding-bottom, padding-left) Propert
css| Beginners | Web page
Many of the people I contacted asked how to learn Web standards to make Web pages. I think everyone who has just contacted the Web standards will ask such questions, and I will summarize them according to my own experience.
1. Do not blindly use the DW and other tools to design Web pages to familiarize yourself with (X) HTML and CSS lang
DIV + CSS as a summary of the mistakes that are easy to make on the Web page 1. Check whether the HTML element has a spelling error and whether it has forgotten the ending mark.
Even veteran engineers often mistake the nested relationship of p. You can use the dreamweaver verification function to check whether there are any errors.
2. Check whether
This article mainly introduces the way to let div fill the entire screen (CSS), has a certain reference value, now share to everyone, the need for friends can refer to
When the body has only one P, you can make P fill the entire screen in such a way.
1. Set the positioning for P.
Review--
There are five properties of position in
Ideas:1. Because it is a vertical list, the outer layer is relatively positioned so that it does not overlap together relative2. Absolute the inside with absolute position, cover the picture above3. Here is a little trick, I have a special effect, text erect, and rotate to the right 90 degrees (WebKit core) width:20px; font-size:20px; -webkit-transform:rotate (90DEG);"position:relative; max-width:560px; min-height:115px ;">"/resources/images/hongbao_ky.png"style="width:100%; max-width:560px; min
of the table depends on the length of its text), so it can be regarded as a fixed-width block element , and then the method of the fixed-width blocky-centered margin is used to center it horizontally. 2, by setting the child element Display:inline method: Similar to the first, the display type is set to the inline element, the property of the variable width element is set 3. By setting float to the parent element and then setting position:rela
How do I get content vertically centered in a div source: Huang ChaoTo make the content in the div vertically centered, there are only a few ways, and so I enumerate:First, row height (line-height) methodIf you want to vertically center only one line or a few words, it is th
create a vertical center effect.link { padding-top: 30px; padding-bottom: 30px;}=code Example 2:When a padding fill is not appropriate in some cases, you can make its text line height = The parent element's height is centered vertically.=>html Code=>CSS Codebody { background: #f06d06; font-size: 80%;}main { background: white; margin: 20px 0; padding: 40px
In general, we say that there are two kinds of center, the center of the layer and the center of the layer, the center of the layer I generally use: margin:0 auto; (or Margin-left:auto;margin-right:auto;) This type of writing, in the middle of the layer (I am generally used in layers of text): Text-align:center;
This code can be centered in FF, but not in IE6/7/8. Replaced by: Margin-right:auto; Margin-left:auto, and also, the right margin:0pt 0pt 0p
First look at the following: Here is the CSS code: Here is the HTML code: H3>Implement images with unknown dimensions, single line of text, horizontal vertical centering of multiline textH3> Divclass= "Wrap"> Divclass= "Subwrap"> Divclass= "Content"> imgsrc= "Http://static.cnblogs.com/images/logo_small.gif" /> Div>
The code is as follows:
Block 1
Block 2
Should be centered below the IE9, the result appears to be left.Solve:1.In IE9 above version, only need to set margin:0px auto; You can make the DIV center2.In the version below IE9, the following settings are required
The code is as follows:
The child div side of which can be
horizontal vertical centering of the div in the window, regardless of whether the window is resized or not. Some friends may say that this is vertically centered in the window, how to implement a div in a normal blessing object vertically centered, the code is modified as follows:DOCTYPE HTML>HTML>Head>MetaCharSet= "U
1, through the CSS to achieve horizontal center:
Copy Code code as follows:
. classname{
margin:0 Auto;
width:200px;
height:200px;
}
2, through the CSS to achieve horizontal center and vertical CenterCreating a horizontally centered and vertically centered
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.