This chapter can make the text in your web page more beautiful
About some properties of text
font-family: Text font
font-size: Text size
color: Text color
- ##font- weight: text thickness
- text-decoration: more styles of text ##font-family(font family)

##body {
font-family: Verdana, Geneva, Arial, sans-serif;
}
Web font is here!
#Find a font file: the suffix name is woff, svg, eot, otf, ttf
To place this font on the web, you can use Google's font hosting service, which is free
-
Add the @font-face attribute in CSS
@font-face { font-family:"Emblema One"; src:url("www.某网站.com"); }/*那个网址就是字体URL */
At this time, it is equivalent to creating a font named Emblema One on the user machine -
Use it like a local font. Note that the place where you use the font must be @font After -family
- #The disadvantage of this is that loading the font will take a while, so the first time a customer visits your website and he does not have this font, he will Take a moment
There are three font units: px (pixel), %, em (which is a multiple, em=% divided by 100 )h1 {
font-size:220%;
}
First of all, you can define the text size of through keywords. Through keywords, you can get the default size on the client side, which is the commonly used size on the other side.
There are five keyword sizes, namely: bold (bold), bolder (thicker), inherit (inherit the thickness of the previous level), lighter (thinner), normal ( Ordinary)

There are four types: inherit (inherit dad), italic (italic), normal (normal), oblique (inclined)
颜色
body { background-color:red; background-color:rgb(80%, 40%, 0%); background-color:rgb(204, 102, 0); background-color:#66ccff; }

对于文本和背景,要使用对比度比较大的颜色,这样可读性才好
文本装饰(text-decoration)
BULLET POINTS
CSS provides many properties to control the appearance of fonts, including font-family, font-weight, font-size, font-style, etc.
font-family is a group of fonts with common characteristics
Font families used for the Web include serif, sans-serif, monospace, cursive , fantasy. serif and sans-serif are most commonly used
The fonts your visitors see on your web pages depend on what fonts are installed on their own computers, unless you use web fonts
It is a good idea to specify candidate fonts in the font-family CSS property in case the user does not have your preferred font installed
The last font to be For a generic font, such as serif or sans-serif, so that if it cannot find another font, the browser can substitute the appropriate font
If you want to use a certain font, While users may not have this font installed by default, you can use @font-face rules
-
The font size is usually specified by keywords, pixels px, percentage, em
If you use pixels to specify the font size, you are telling the browser how many pixels the letter height is
- ##em and % are relative font sizes, so use em When specifying a font size with %, it means that the font size is determined relative to the font size of its parent element
- Using relative font sizes can make your page more maintainable
- Use the font size keyword in the body rule to set the base font size so that if the user wants the text to be larger or smaller, all browsers can scale the font size proportionally
- You can use the font-weight CSS property to make text bold
- The font-style property is used to create italic or italic text. Italic or italic text is slanted
- Web colors are obtained by mixing different amounts of red, green, and blue
- If Mix red 100%, green 100%, blue 100% to get white, all 0% is black
- There are 16 basic colors in CSS, and more than 150 extended colors
- You can use red, green, and blue percentages to specify the color you want, or you can use numerical values (0~255), or hexadecimal codes
- To find the hexadecimal code for the color you want, use the color picker tool in your image editing application.
- The hexadecimal code representing a color has 6 digits. Each bit is indexed from 0 to F. The first two represent the number of red, the middle two are green, and the last two are blue.
- You can use the text-decoration attribute Create an underscore for this. Underlined documents are often mistaken for link text by users, so use this attribute with caution
The above is the detailed content of CSS3--How to add font and color styles to text. For more information, please follow other related articles on the PHP Chinese website!

CSS Grid is a powerful tool for creating complex, responsive web layouts. It simplifies design, improves accessibility, and offers more control than older methods.

Article discusses CSS Flexbox, a layout method for efficient alignment and distribution of space in responsive designs. It explains Flexbox usage, compares it with CSS Grid, and details browser support.

The article discusses techniques for creating responsive websites using CSS, including viewport meta tags, flexible grids, fluid media, media queries, and relative units. It also covers using CSS Grid and Flexbox together and recommends CSS framework

The article discusses the CSS box-sizing property, which controls how element dimensions are calculated. It explains values like content-box, border-box, and padding-box, and their impact on layout design and form alignment.

Article discusses creating animations using CSS, key properties, and combining with JavaScript. Main issue is browser compatibility.

Article discusses using CSS for 3D transformations, key properties, browser compatibility, and performance considerations for web projects.(Character count: 159)

The article discusses using CSS gradients (linear, radial, repeating) to enhance website visuals, adding depth, focus, and modern aesthetics.

Article discusses pseudo-elements in CSS, their use in enhancing HTML styling, and differences from pseudo-classes. Provides practical examples.


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

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

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

SublimeText3 Linux new version
SublimeText3 Linux latest version

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
