HTML+CSS Easy to get started with basic knowledge of CSS
Let’s start to explain the basic knowledge of css:
Before talking about the basic knowledge, we need to know how to write comments in css
/*Comment content*/
Font: font
##What operations do we have on fonts: Font color colorFont size size Font style font-family Italic font-style font-weight underline text-decoration line-height
We will explain through examples:
中华名族伟大复兴
texttext
Text alignment text-align中华名族伟大复兴
Background
Background color background-color Background image background-image
中华名族伟大复兴
## Size
Width width Height height
margin and padding
margin shorthand properties set all margins in one statement Attributes. This attribute can have 1 to 4 values.
##margin:10px 5px 15px 20px;
Set the thickness and color of the borderborder:1px solid red; The border line is a solid line of 1 pixel, and the line is red
After running like this, the words are in How to move the text in the upper left corner of the div to the middle? It’s actually very simple. Just add two sentences of style to the css of the div text-align: center; line-height: 150px; 测试