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 color

Font 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;

The top margin is 10px

The right margin is 5px

Out Out Out Out Out Out Out Being Out Out Out Out Out ’ s ’ ’ Out Out – ‐ ‐Downside and Bottom Margins to Be 15px

‐ ‐ The Left Margin to be 20px This attribute can have 1 to 4 values.

padding:10px 5px 15px 20px;

The top padding is 10px

The right padding is 5px

The bottom padding is 15px

Left The padding is 20px

Note: If none of the 4 parameters are written, the default is 0px

border border

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;

Continuing Learning
||
中华名族伟大复兴
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!