search
HomeWeb Front-endCSS TutorialDetailed explanation of some commonly used properties of CSS

Commonly used CSS properties

☛ Regarding CSS properties, I suggest you check the manual for more details and convenience. I will classify several common properties here and simply select a few. Commonly used attribute values ​​are only for beginners like me who are just learning front-end.

1. Font style

is the abbreviation of font, written as font:font-style|| font-variant ||font-weight||font- size||/ line-height||font-family, be sure to write

in order. Font italic (font-style): normal normal || commonly used italic italic || no italic variable The special font oblique

♣small caps t (font-varian): normal || small caps font small-caps

♣font-weight: Normal normal || Commonly used bold bold || Extra bold bolder || Lighter || Express directly with numbers (value 100-900)

♣Font size (font-size): Here we only introduce what can be Use several root units to express (px, em, rem)

♣The line-height of the font: you can use the length px|| percentage (based on the height size of the font)|| use the numerical value ( Product factor) specifies the line height

♣Font family (font-family): Specifies the text to use a certain font or font sequence. The value is enclosed in single quotes. The default is Song Dynasty.

demo: body{font-family:helvetica,verdana,sans-serif;}

/*Notes*/: Arrange in order of priority. Separate with commas. As shown in the font definition above, assuming you do not have the Helvetica font on your computer, but you have Verdana, your text will be displayed in Verdana.

❤@font-face embedded font (extracurricular extension)

@font-face can load the font file on the server side, so that the browser can display the font file that is not in the user’s computer Installed fonts.

Syntax:

@font-face {

font-family: Custom font name;

src: url(font file on the server Relative or absolute path) format (font type);

}

Example:

@font-face {/*This writing method is compatible with all browsers*/

font-family : bgg;

src: url('fonts/fontawesome-webfont.eot'), /* IE9+ */

url('fonts/fontawesome- webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */

url('fonts/fontawesome-webfont.woff') format('woff'), / * chrome, firefox */

url('fonts/fontawesome-webfont.ttf') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/

url('fonts/fontawesome-webfont.svg') format('svg'); /* iOS 4.1+ */

}

p{ font-family: bgg }

★Other less commonly used styles of fonts:

♣caption: Use text fonts for system controls with titles (such as buttons, menus, etc.) (CSS2)

♣icon: Use the font of the icon label (CSS2)

♣menu: Use the font of the menu (CSS2)

♣message-box: Use the text font of the message dialog box (CSS2)

♣small-caption: Use the font of the small control (CSS2)

♣status-bar: Use the font of the window status bar (CSS2)

2. Text style

♦Text color color

●Color name The 16 basic colors are aqua, black, blue, fuchsia, gray, green, lime, maroon, navy,olive,purple,red,silver,tealwhite,and yellow.

●Hexadecimal (hex) color control (6 digits), its format is #336699. Supports shortcut counting methods for certain hex values. For example, #336699 could be called #369.

●RGB value The value of RGB ranges from 0 to 255, R represents red, G represents green, and B represents blue. demo: { color: rgb(51,204,0) }

♦Text-indent, the value is the value in em, 1em is equal to the width of one word.

♦Text Horizontal alignment text-align: left (left alignment) || center (center alignment) || right (right alignment) || justify (justify both ends)

♦ Text vertical alignment vertical-align: sub (vertical subscript for aligned text) || super (superscript for vertically aligned text) || There are other manuals

♦letter-spacing, the value is normal and the value in px.

♦Text wrap word-wrap: normal (allow content to open or overflow) || break-word (content will wrap within boundaries. Line breaks are allowed within words if necessary)

♦Underline control text-decoration: none (no underline, default), underline (underline), blink, overline (overline), line-through (strikeout)

♦The case of the text text-transform: the first letter capitalize || Convert to uppercase || Convert to lowercase

3. List style list-style

##▶list-style- image:url(/dot.gif); Picture-style symbol, select the image as the guide symbol for the list item

▶list-style-position: List symbol position

♥outside (default value, The list is close to the symbol)

♥inside (the list is indented and separated from the symbol)

▶list-style-type: symbol type (here are several commonly used ones, if you need Japanese plain You can check the manual for fake films)

♥None (none) ♥Arabic numerals (decimal) ♥Solid circle (disc) ♥Hollow circle (circle) ♥Solid square (square)

♥Lowercase English letters (lower-alpha) ♥Uppercase English letters (upper-alpha) ♥Lowercase Roman numerals (lower-roman) ♥Uppercase Roman numerals (upper-roman)

4. Background style background

The abbreviation of background style is {background-color||background-image||background-repeat||background-attachment||background-position;}

background : Background color, background image, background tiling method, background positioning should be in order. Example background:#F00 url(header_bg.gif) no-repeat fixed left top;

♠Background color

♠ Perspective background background:transparent;

♠Background image backgroung-image:url(picture file path);

♠Background tiling method background-repeat:repeat(all tiled, default)| | no-repeat (not tiling) || repeat-x (horizontal tiling) || repeat-y (vertical tiling)

round (the background image automatically scales until it fits and fills the entire container) || space (the background image is tiled with the same spacing and fills the entire container or a certain direction)

♠Background image scrolling background-attachment: scroll Default value. The background image moves as the rest of the page scrolls.

fixed Background image does not move when the rest of the page scrolls. ||inherit specifies that the setting of the background-attachment property should be inherited from the parent element.

♠Background positioning background-position: Left and right alignment (left||center||) Top and bottom alignment (top||bottom);

You can also write the alignment as a numerical value (or percentage %): Left value (%) Top value (%)

♠Background size background-size

background-size: auto; Automatically, the default is the image size

background-size: px or percentage. If only one value is set, the second value will be set to "auto".

background-size: cover; Scale the background image proportionally to completely cover the container. The background image may exceed the container.

background-size: contain; Expands the image to its maximum size so that its width and height fully fit within the content area. But not exceeding the container

background-size: 100px 100%; Change the width and height ratio

♠The starting position of the background background-origin

Writing {background-origin:padding- box background starts from behind the border (default)||border-box background image starts from border||content-box background starts from content}

5.Border style border

Abbreviation of border line: {border:border-width border-style border-color;}

demo: The four borders are the same: {border:1px solid #00F};

If you want a separate side, choose which direction you want: {border-[left||right||top||bottom]:border-width border-style border-color;}

♜Border line style border-style: none (no border line, default) || hidden (hidden border line) || dotted (dotted line) || dashed (line dotted line, commonly used)

solid(solid line, commonly used)|| double(double solid line)|| groove(light solid line)|| ridge(dark and light solid line)|| Line)|| outset (solid line with light upper left and deep right lower)

♜The width of the border line border-width, the value is a numerical value in px.

♜The color of the border line border-color, the value is the English word of the color or the hexadecimal color.

♜inherit: Specifies that the setting of the border attribute should be inherited from the parent element.

The above is the detailed content of Detailed explanation of some commonly used properties of CSS. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
利用CSS怎么创建渐变色边框?5种方法分享利用CSS怎么创建渐变色边框?5种方法分享Oct 13, 2021 am 10:19 AM

利用CSS怎么创建渐变色边框?下面本篇文章给大家分享CSS实现渐变色边框的5种方法,希望对大家有所帮助!

css ul标签怎么去掉圆点css ul标签怎么去掉圆点Apr 25, 2022 pm 05:55 PM

在css中,可用list-style-type属性来去掉ul的圆点标记,语法为“ul{list-style-type:none}”;list-style-type属性可设置列表项标记的类型,当值为“none”可不定义标记,也可去除已有标记。

css与xml的区别是什么css与xml的区别是什么Apr 24, 2022 am 11:21 AM

区别是:css是层叠样式表单,是将样式信息与网页内容分离的一种标记语言,主要用来设计网页的样式,还可以对网页各元素进行格式化;xml是可扩展标记语言,是一种数据存储语言,用于使用简单的标记描述数据,将文档分成许多部件并对这些部件加以标识。

css3怎么实现鼠标隐藏效果css3怎么实现鼠标隐藏效果Apr 27, 2022 pm 05:20 PM

在css中,可以利用cursor属性实现鼠标隐藏效果,该属性用于定义鼠标指针放在一个元素边界范围内时所用的光标形状,当属性值设置为none时,就可以实现鼠标隐藏效果,语法为“元素{cursor:none}”。

css怎么设置i不是斜体css怎么设置i不是斜体Apr 20, 2022 am 10:36 AM

在css中,可以利用“font-style”属性设置i元素不是斜体样式,该属性用于指定文本的字体样式,当属性值设置为“normal”时,会显示元素的标准字体样式,语法为“i元素{font-style:normal}”。

rtl在css是什么意思rtl在css是什么意思Apr 24, 2022 am 11:07 AM

在css中,rtl是“right-to-left”的缩写,是从右往左的意思,指的是内联内容从右往左依次排布,是direction属性的一个属性值;该属性规定了文本的方向和书写方向,语法为“元素{direction:rtl}”。

css怎么实现英文小写转为大写css怎么实现英文小写转为大写Apr 25, 2022 pm 06:35 PM

转换方法:1、给英文元素添加“text-transform: uppercase;”样式,可将所有的英文字母都变成大写;2、给英文元素添加“text-transform:capitalize;”样式,可将英文文本中每个单词的首字母变为大写。

怎么设置rotate在css3的旋转中心点怎么设置rotate在css3的旋转中心点Apr 24, 2022 am 10:50 AM

在css3中,可以用“transform-origin”属性设置rotate的旋转中心点,该属性可更改转换元素的位置,第一个参数设置x轴的旋转位置,第二个参数设置y轴旋转位置,语法为“transform-origin:x轴位置 y轴位置”。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

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.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF

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),