What style is used when the same HTML element is defined by more than one style?
Generally, all styles are stacked in a new virtual style sheet according to the following rules, where the number 4 has the highest precedence.
- Browser default settings
- External style sheet
- Internal style sheet (inside the
- Inline style (inside HTML elements)
Therefore, the inline style (inside the HTML element) has the highest precedence, which means that it will take precedence over the style declarations in the:
CSS style:
CSS consists of two parts: the selector (the element tag you want to change, such as Div), the declaration (the style you want, such as: width) background color (background ...).
Eg:
. div1{//statement
width:500px;//style
height:100px;
background-color:red;
}
Floating and positioning:
The positioning is divided into two categories: absolute positioning (absolute), and relative positioning (Relative). Absolute positioning means that the positioning will not change with the background image changes, and the absolute positioning of a block-level element can no longer be used floating (that is, absolute positioning and floating cannot coexist). Relative positioning refers to the change of the background image, which can coexist with relative floating and positioning.
Block-level elements on the background change with the mouse pull:
Set width and height in CSS, in two ways: {
width:100px;
height:100px;
}//block-level elements are fixed and do not change with the mouse pull
{
width:100%;
height:100%;
}//block-level elements will follow the mouse pull and the length of the width will also change
CSS Learning Essays