to block, you can make inline elements (for example, But in one case. Block-level elements are created, even if they are not explicitly defined. This happens when you add some text to the beginning of a block-level element, such as a Div. Even if the text is not defined as a paragraph. It will also be treated as a paragraph.CSS positioning mechanismThere are three main positioning mechanisms for CSS: norma
. Universal float closure (very important !) You can use this to solve the incorrect spacing when multiple Div alignment occurs,
For details about the principle of clear float, refer to [How to clear floats without structural markup]Add the following code to global CSS and add class = "Clearfix" to the DIV to be closed.
Code:
*************************************
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
Read Catalogue1. What is a CSS box model 2. IE box model and box model 3. CSS3 Property box-sizing 4. About the use of box models In the initial contact with CSS, the
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
. Other compatibility skills
1. Setting padding for Div under FF will increase the width and height, but IE will not. (available! Important solution)2. center problem.1). Vertical center. Set line-height to the same height of the current Div, and then use vertical-align: middle. (Note that do not wrap the content .)2). horizontal center. Margin: 0 auto; (of course not omnipotent)3. To add a style to the con
brings a lot of problems while providing great power. A notable problem is that when a parent node includes several floating child elements, the layout of the parent node takes into account the size and position of the floating child element, but the child element does not affect the size of the parent node.In this case, the parent node's height becomes 0, and other properties are ignored. Most of the time, this problem has not been noticed, especially if the parent node is not attached to any
navigation (Main menu)Sub MenuSearch boxRibbon (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 div. The
CSS positioning and floating
CSS provides some attributes for positioning and floating. With these attributes, you can create a columnar layout that overlaps one part of the layout with the other, you can also complete tasks that require multiple tables for years.
The basic idea of positioning is simple. It allows you to define the position of an element box rela
control it using his ID.13.Table layout, garbage code will be many, some of the modified style and layout of the code mixed together, it is not conducive to intuitive. The DIV is more able to embody the separation of style and structure, and the structure is strong in reconstruction.14. Can be used on almost all browsers.15. Previously, some features that had to be implemented through image conversion are now easy to implement with
navigation (Main menu)Sub MenuSearch boxRibbon (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 div. The
-left:auto;Text-align only applies to text.Block levels such as div,p can be passed through Margin-right:auto; and Margin-left:auto; to center horizontallySome unfortunate skills and working environmentBecause browsers are not perfect for CSS support, we sometimes have to take some skill (hacks) or create an environment (workarounds) to make the CSS implement the
top, right, bottom, and left
Border= "3"
cellspacing= "3" BORDER-WIDTH:3PX; With CSS, you can define a table's border as a uniform style, or you can define the color, size, and style of top, right, bottom and left borders, respectively.
You can use table, TD or th these selectors.
If you need to set no border effect, you can use the CSS definition: border-collapse:collapse;
Clear:left;
Clear:right;
Clear
Box Model prefaceBox model, English is box models. Whether it's div, span, or a is a box.However, images and form elements are all treated as text, and they are not boxes. This is a good understanding, for example, a picture does not put things, it is their own content.The area in the boxThe main attributes in a box ar
(Main menu)Sub MenuSearch boxRibbon (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 div. The div con
A detailed explanation of the Box Model in CSS and a detailed explanation of the CSS Box Model
Many people are confused about the box model. The following uses a simple code to analyze the structure of the box model!
For easy view
circle/elliptic, and use border to create a triangle/trapezoid.
We can also use CSS to create other images, but most of them can be simply combined with these basic images. These simple images are the easiest to create and modify.
Multiple identical shapes
With the stacked box-shadow, we can create multiple identical shapes with different sizes, colors, and blur effects. We can move these images on the x
of IE7.
Code:
Note:* + For HTML compatibility with IE7, the following declaration must be made on the top of HTML:
Code:
2. Universal float closure (very important !) You can use this to solve the incorrect spacing when multiple Div alignment occurs,
For details about the principle of clear float, refer to [How to clear floats without structural markup]Add the following code to global CSS and add class = "
div CSS text font line Gao Xing distance DIVCSS5 takes you in-depth understanding of CSS line spacing settings, how font spacing is most easily set. In the article, to achieve the adjustment, set the text font spacing (line spacing) to use the Line-height property. To make the text of each line a certain distance, it can be implemented by Line-height style. Next,
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.