This article mainly introduces the use of negative margin value in CSS to adjust the center position of the method, the article also mentions the common method of some noteworthy places, the need for friends can refer to the following
This is perhaps the most commonly used centering method. If you know the size of each element, set a negative margin value equal
1, not fixed wide-height fixed frame, horizontal vertical Center. tab{position:fixed;width:302px;border:1px solid #cccccc;border-radius:5px;left:50%;top:50%;Transform:translate ( -50%,-50%);margin:0 Auto;Box-sizing:border-box;z-index:9999;}Here the width is fixed, but the height is not fixed. Therefore, the Margin:auto is used and the horizontal vertical centering condition cannot be satisfied. This applies left:50%;top:50%;transform:translate ( -50%,
Learning this series of tutorials requires a certain HTML and CSS basis, which means that you have done Web pages before and will use a table layout. If you are just beginning to learn web production, do not know what is the table layout and HTML and CSS, we recommend that you first to recharge, otherwise you will be very difficult to learn this tutorial or do not understand.
Due to the time relationship,
CSS power: drawing with a DIV and css power div
These images are drawn using a DIV, but the principle is not complicated.
These images are all drawn by CSS and implemented through the combination of background-image,
For example,
The use of negative margins is very simple
The code is as follows
Copy Code
How to change the overlay order
Where the negative margins can be used
The code is as follows
Copy Code
Note: Firefox below. Nav Li does not need to add position:relative; can also cover the following Div, but ie below to add.
Fix IE Bugs
I believe you all know IE's 3-pixel bug, an
sum of width is less than 99%. 9. Have you reset the default style? Some attributes, such as margin and padding, are explained differently in different browsers. Therefore, it is best to set all the margin, padding to 0, and list style to none before development. 10. Have you forgotten to write the DTD? If the display results of different browsers are different, check whether the following line of DTD has
How does css + div solve content overflow and css div content overflow?In normal times, when we layout, some text content will exceed the height of our limit, and some images will break through the DIV, causing webpage dislocation. CSS
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
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
How does CSS implement adaptive div width based on content and CSS div width
How does CSS implement adaptive div width based on content:Suggestion: writing code as much as possible can effectively improve learning efficiency and d
: #404040 #808080;-moz-border-bottom-colors: #404040 #808080;
11. ie supports the CSS method cursor: URL () to customize the Color Style of the cursor Style File and scroll bar. Firefox does not support either of the above.
12. ie has the bug that the select control is always at the top layer, and all CSS does not work for the select control.
13. ie supports label labels in form, including images and
. 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 cours
[CSS] for processing that exceeds the div part, css exceeds the div
A normal front-end attacker usually does not deploy the content outside the div, but if the content is input by the user and then retrieved from the database, in this way, it is normal that the content excee
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 efficiency and depth.This may be the most basic
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
CSS sets the minimum height and width of the div, CSS sets the div
CSS sets the minimum height and width of the div:
The minimum height and width of a div are set to a value. If the a
How does CSS implement the transparent effect of div, and css implements div
How to Implement div transparency in CSS:In general, you can use the following code to set the div transparency:
Filter: alpha (opacity = 50);-moz-op
. P is a structured tag, margin is a manifestation attribute, the former belongs to HTML, and the latter belongs to CSS. (This is the phase separation structure .)
The HTML page with a good structure has almost no labels showing attributes. The code is very clean and concise. For example, the original code
Practice structuring in person
The above is just the most basic structure. In actual application, y
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.