Selector is usually the HTML element you need to change the style.
Each statement consists of a attribute and a value.
// Define a name calledpara1
ID type
Class
// Define a name calledcenter
exclusive to the Class of P element
Insert style tables: There are three ways to insert style tables:
- (1) External style table
- <head>
<link rel=”stylesheet” type=”text/css” href=”mystyle.css”>//mystyle.css is an external style
</head>
// First define onemystyle.css style tables are stored. - (2) Internal style table
- <head>
<style>
hr {color:sienna;}
p {margin-left:20px;}
body {background-image:url(“images/back40.gif”);}
</style>
</head> - // Internal insertion<style></style>CSS style editing in it can define multiple element styles.
- (3) Inner United style
- <p style=”color:sienna;margin-left:20px”>This is a paragraph.</p>
- // Style settings in separate elements
(4) Multiple styles will be stacked into one
style table allows style information in multiple ways. The style can be stipulated in a single HTML element, in the head element of the HTML page, or in an external CSS file. You can even quote multiple external style tables inside the same HTML document.
layer stack sequence
When the same HTML element is defined by more than one style, which one will it use?
Generally speaking, all styles will be stacked in a new virtual style table according to the following rules, where the number 4 has the highest priority.
- Browser default settings
- outer style table
- Internal style table (located inside the <head> label)
- Inner couplet style (within HTML elements)
css background
- background-color // Background Color
- background-image // Background Picture
- background-repeat // Background style (horizontal or vertical, or not flat)
- background-attachment// Background Attachment:Define the background picture with the rolling shaft movement method
- background-position// Background Picture location
In
CSS, the color value is usually defined in the following ways:
- Sixteen Entry -Ru: “# FF0000”
- RGB -Such as: “RGB (255,0,0)”
- color name -such as: “red”
;
;
Generally use Background-Repeat: Repeat-X; Make the picture horizontally flat; no-Repeat
Represents the picture in the upper right part
CSS text format
attribute | Description |
---|---|
color | Set text color |
direction | Set text direction. |
letter-spacing | Set the character spacing |
line-height | Setting height |
text-align | Text in alignment elements |
text-decoration | Add modification to text |
text-indent | In the first line of the Chinese text in Chinese |
text-shadow | Set text shadow |
text-transform | Letter in the control element |
unicode-bidi | Settings or whether the text is rewritten |
vertical-align | Set the vertical alignment of the element |
white-space | Set the blank processing method in the element |
word-spacing | Set the word spacing |
color:
direction: Text direction
ltr | default. The direction of the text is from left to right. |
rtl | The direction of text from right to left.
The |
inherit | regulations should inherit the value of the Direction property from the parent element. |
letter-spacing: Text character spacing
normal | default. There is no extra space between characters. |
length | Define the fixed space between characters (allowed negative values).
The |
inherit | regulations should inherit the value of the Letter-Spacing property from the parent element. |
line-height:
normal | default. Set reasonable line spacing. |
number | Set the number, this number will be multiplied with the current font size to set the line spacing. |
length | Set a fixed spacing. |
% | Percent pitch based on the current font size.
The |
inherit | regulations should inherit the value of the LINE-Height attribute from the parent element. |
text-align:
left | Set the text to the left. The default value: determined by the browser. |
right | Set the text to the right. |
center | Set the text into the middle. |
justify | to achieve the effect of alignment at both ends.
The |
inherit | regulations should inherit the value of the text-align attribute from the parent element. |
text-decoration
Almost all mainstream browsers do not support the Text-DECORATION-COLOR property.
none | default. Define the standard text. |
underline | Define a line under the text. |
overline | Define a line on the text. |
line-through | Define a line through the text. |
blink | Define the flickering text.
The |
inherit | regulations should inherit the value of the Text-DECORATION attribute from the parent element. |
text-indent
length | Define the fixed indentation. Default value: 0. |
% | Define the percentage of the width of the parent element.
The |
inherit | regulations should inherit the value of the Text-indent property from the parent element. |
text-shadow
h-shadow | must. The position of the horizontal shadow. Make negative values. |
v-shadow | must. The position of vertical shadow. Make negative values. |
blur | Optional. Vague distance. |
color | Optional. The color of the shadow. |
text-transform
none | default. Definition text with standards with lowercase letters and uppercase letters. |
capitalize | Each word in the text starts with capital letters. |
uppercase | Definition only has uppercase letters. |
lowercase | Define the non -uppercase letters, only lowercase letters. |
inherit | The regulations should inherit the value of the Text-Transform attribute from the parent element. |
unicode-bidi
normal | default. No additional embedded level. | |
embed | Create an additional embedded level. | |
bidi-override | Create an additional embedded level. Re -sort depending on the Direction property. | |
initial | Set this attribute to its default value. Seeinitial。 | |
inherit |
Inherit the attribute from the parent element. Seeinherit。
|
vertical-align
baseline | default. The elements are placed on the baseline of the parent element. |
sub | Vertical settlement of alignment text. |
super | Vertical alignment of alignment text |
top | Align the top of the element with the top of the highest element in the row |
text-top | Align the top of the element with the top of the parent element font |
middle | Place this element in the middle of the parent element. |
bottom | Align the top of the element with the minimum element in the row. |
text-bottom | Align the bottom end of the element with the bottom end of the parent element font. |
length | |
% | Use the percentage value of the “LINE-Height” property to arrange this element. Make negative value.
The |
inherit | regulations should inherit the value of the Vertical-Align property from the parent element. |
white-space
value | Description |
---|---|
normal | default. Blank will be ignored by the browser. |
pre | blank will be retained by the browser. Its behavior is similar to the <pre> label in HTML. |
nowrap | The text will not be changed, and the text will continue on the same line until the <br> label is encountered. |
pre-wrap | Keep the blank sequence, but it is changed normally. |
pre-line | merged blank sequence, but retain the exchange symbol. |
inherit | The regulations should inherit the value of the White-Space attribute from the parent element. |
word-spacing
normal | default. Define the standard space between words. |
length | Define the fixed space between words. |
inherit | The regulations should inherit the value of the Word-Spacing attribute from the parent element. |