CSS lets div overlap instances Summarize

Source: Internet
Author: User
CSS layering refers to CSS styles when configuring the same property for the same element, according to the cascading rules (weights) to handle the conflict, select the application of high-weighted CSS selectors specified by the properties, generally also described as a high weight of the coverage weight is low, so also known as cascading.

1. Parsing CSS style inheritance and cascading

Basic Selector

Tag selection: Select from the tag name on the page to apply the style directly to the specified label.

Characteristics:

1. The tag selector selects all the specified tags in the current year's page;

2. The tag Selector has no association with the current tag hierarchy of the code and can be selected as long as it is on the current page.

ID Selection: You need to specify a label setting ID value (the ID value cannot be repeated only on the entire page).

Class Selection: Select the specified label through the class selector by giving the tag a class name.

2. CSS margin overlap and prevention methods

Boundary overlap refers to two or more boxes (which may or may be nested) adjacent boundaries (in which there is no non-empty content, padding, borders) coincident together to form a single boundary. The vertical adjacent boundary of two or more block-level boxes is coincident. The boundary width of the result is the largest value in the width of the adjacent boundary. If there is a negative boundary, the maximum negative boundary of the absolute value is subtracted from the largest positive boundary. If there is no positive boundary, the maximum negative boundary of the absolute value is subtracted from zero. Note: Adjacent boxes may not be generated by the elements of a parent-child or sibling relationship.

3. Parsing the stacking order of elements in CSS

When you do not include the Z-index property and the Position property, the stacking order of all elements is consistent with the order in which they appear in the HTML document in which they are placed. (except for exceptions that use negative margin to overlap an inline element.) )

When the element floats float, the floating block element is placed between the non-anchored block element and the anchor block element, in other words, the floating element is displayed above the descendant block element in the normal stream, below the descendant inline element in the normal stream.

When an element is added to the position Location property, all elements with the position attribute and their child elements are displayed on other elements that do not have the position attribute.

4. CSS implementation of the random overlap method of P Introduction

This article mainly for the introduction of let p overlap and in order to overlap the need for CSS to achieve, that is, CSS absolute positioning to implement, the need for friends can refer to the next to let p overlap and in order to overlap the need for CSS to achieve, that is, CSS absolute positioning to implement.
Overlapping styles require major CSS style explanations

5. css to overlap two div

Do the page in P put a page in the weather plug-in, but clicked will jump to the ads page, want to go online to find a ban p click Method, but found no, using the JS method seems to have no success, later felt or with two layers overlapping method to prevent click, although positioning is a bit of trouble

6. DIV overlap Issues

I defined two p in the HTML but the result is two P part coincident, I don't know which key I touched. The layer is coincident at run time I put the two P alone to show the normal I just want to ask what is the reason for this situation?

Related Questions and answers:

1. JavaScript-Why do div overlaps occur when using properties such as top in relative positioning?

2. JavaScript-two div overlap, in the page to regenerate a Div, just create one, how does this effect write?

"Recommended"

On the overlap of margin in CSS

Canvas dynamic ball overlap effect

Why floats enable text to wrap around pictures without overlapping

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.