This article introduces to you what is css? The introduction of the three CSS styles and text attributes has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
What is CSS?
Cascading Style Sheets, referred to as CSS, cascading style sheets.
Used to modify HTML files and perform operations such as typesetting or size control on web page elements.
In other words, the HTML file fills the content of the web page, while CSS controls the performance of the content
For example: the size of the element, the position of the element in the web page, the background of the element and other attributes.
Where is the CSS code written?
1 Inline style (inline): css code can be written in html tags, use style="css style";
<p style="color: red;">这是一个段落</p>
2 Internal style:
Write the css code in the style tag
In theory, the style tag can be written anywhere in the document to take effect, but we will all write the style in the head tag
<html> <head> ... <style type="text/css"> css样式 </style> </head> </html>
3 External style:
External style is to write the css code separately in In a css file (css suffix file)
Then use the link tag to introduce the external style file
There is no need for style tags in external style files, just write css code directly
<html> <head> ... <link rel="stylesheet" type="text/css" href="css文件路径" /> </head> </html>
Three styles can be used in multiple ways at the same time
Text attribute: font attribute
1 Font size: font-size
Set the font size, use values with units, such as px, em, pt, etc.
font-size: 12px;
2 Font color: color
color: red;
3 Font style: font-family
Set the font, such as Song Dynasty, Yahei and the like
Can have multiple values
But only one font style is displayed
If the first font is available, use the first one, otherwise use the second one
If the second font is not available, use the third one, and so on
Fonts are separated by English commas. If the value is Chinese or multiple words, it must be enclosed in English double quotes
font-family: "宋体",Times,"New Century Schoolbook";
4 Font-weight: font-weight
Optional values | Description |
---|---|
Default value , no bold | |
bold, the effect is better than Bold is more obvious | |
100~900 is a value without units. Generally, 100~500 is the normal effect, and 600~900 is bold. The larger the value, The bolder the font |
Description | |
---|---|
capitalize | |
uppercase | |
lowercase | |
right | |
center | |
justify | |
sub | |
super | |
top | |
text-top | |
middle | |
bottom | |
text-bottom | |
inherit | |
8Text-decoration
##Optional value
underline | |
overline | |
line-through | |
text-decoration: underline; 9 首行缩进: text-indent 该属性接受一个带单位的值 text-indent: 2em; text-indent的属性值一般会使用em作为单位,因为一般缩进都以多少个字符为标准 10字间距: letter-spacing 该属性接受一个带单位的值 letter-spacing: 1em; 11 词间距: word-spacing 该属性接受一个带单位的值 相关文章推荐: |
The above is the detailed content of What is css? Introduction to three css styles and text attributes. For more information, please follow other related articles on the PHP Chinese website!

If you've ever had to display an interactive animation during a live talk or a class, then you may know that it's not always easy to interact with your slides

With Astro, we can generate most of our site during our build, but have a small bit of server-side code that can handle search functionality using something like Fuse.js. In this demo, we’ll use Fuse to search through a set of personal “bookmarks” th

I wanted to implement a notification message in one of my projects, similar to what you’d see in Google Docs while a document is saving. In other words, a

Some months ago I was on Hacker News (as one does) and I ran across a (now deleted) article about not using if statements. If you’re new to this idea (like I

Since the early days of science fiction, we have fantasized about machines that talk to us. Today it is commonplace. Even so, the technology for making

I remember when Gutenberg was released into core, because I was at WordCamp US that day. A number of months have gone by now, so I imagine more and more of us

The idea behind most of web applications is to fetch data from the database and present it to the user in the best possible way. When we deal with data there

Let's do a little step-by-step of a situation where you can't quite do what seems to make sense, but you can still get it done with CSS trickery. In this


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Mac version
God-level code editing software (SublimeText3)

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor