CSS3--How to add font and color styles to text
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;
}
Copy after login
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 */
Copy after loginAt this time, it is equivalent to creating a font named Emblema One on the user machineUse 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%;
}
Copy after login
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!

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics











Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-
