search
HomeWeb Front-endHTML TutorialWeb前端新人笔记之CSS值和单位_html/css_WEB-ITnose

数字

颜色——命名颜色

在Css2.1中规范定义了17个颜色名。包括html4.0中定义的16个颜色及外加一个橙色;

<h1 id="aqua">aqua</h1><h1 id="fuchsia">fuchsia</h1><h1 id="lime">lime</h1><h1 id="olive">olive</h1><h1 id="red">red</h1><h1 id="white">white</h1><h1 id="black">black</h1><h1 id="gray">gray</h1><h1 id="maroon">maroon</h1><h1 id="orange">orange</h1><h1 id="silver">silver</h1><h1 id="yellow">yellow</h1><h1 id="blue">blue</h1><h1 id="green">green</h1><h1 id="navy">navy</h1><h1 id="pruple">pruple</h1><h1 id="teal">teal</h1>

当然网页上不只有这些颜色组成。Web浏览器能识别多达140多个颜色名。包括上面我们提到的。具体就不介绍了;

颜色——RGB颜色

计算机通过组合不同的红色、绿色、蓝色创建新的颜色,这种组合成为RGB颜色;

使用百分数记法指定白色和黑色: rgb(100%,100%,100%); rgb(0%,0%,0%);使用整数三元组记法: rgb(255,255,255); rgb(0,0,0);

如果当用户输入的值为小数且值是在可取范围之内的。都会以"四舍五入"的方式精确到最接近范围的边界。如果一个值大于100%或者小于0%。都会被默认的调整回到100%或者0%;

p spanOne{color:rgb(300%,1230%,110%);}/*100%,100%,100%*/p spanTwo{color:rgb(0%,-780%,-34535%);}/*0%,0%,0%*/p spanThree{color:rgb(13,35,656);}/*13,35,255*/

 

颜色——16进制RGB颜色

工作原理:将三个介于00~FF的16进制数连起来。就能设置一种颜色。记法的一般语法是#AABBCC。且三个数之间没有空格、逗号及其他分隔符。

h1{color:rgb(255,255,255) ;} 等价于 h1{color:#FFFFFF ;}而h1{colol:reb(51,102,58);}    等价于 h1{color:#336680}

颜色——等忦颜色表

 颜色——Web安全色

0%或者0是一个安全值。如果使用RGB百分数,要让所有的3个值都要么是0%或者是一个能被20整除的数eg: rgb(40%,100%,80%);如果使用0~255范围的RGB值那么所有的3个值都要么是0或者是一个能被51整除的数eg: rgb(0,204,153);

长度单位

英寸(in)、厘米(cm) 、毫米(mm)、点(pt)、派卡(pica);

长度单位——相对长度单位

相对长度单位共有3种:em、ex和px
 
ps:<br />本章内容只是自己根据阅读CSS权威指南做出的一点小知识积累。可能不太详细,如若有大神阅读本文章尽量对我的文章做出点评。让我知道还有哪些不足之处加以改正

 

 

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
The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS, and JavaScript: Essential Tools for Web DevelopersHTML, CSS, and JavaScript: Essential Tools for Web DevelopersApr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesThe Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesApr 08, 2025 pm 07:05 PM

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.

Is HTML easy to learn for beginners?Is HTML easy to learn for beginners?Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

What is an example of a starting tag in HTML?What is an example of a starting tag in HTML?Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

How to use CSS's Flexbox layout to achieve centering alignment of dotted line segmentation effect in menu?How to use CSS's Flexbox layout to achieve centering alignment of dotted line segmentation effect in menu?Apr 05, 2025 pm 01:24 PM

How to design the dotted line segmentation effect in the menu? When designing menus, it is usually not difficult to align left and right between the dish name and price, but how about the dotted line or point in the middle...

What HTML elements does the online code editor use to implement code input?What HTML elements does the online code editor use to implement code input?Apr 05, 2025 pm 01:21 PM

HTML Element Analysis in Web Code Editor Many online code editors allow users to enter HTML, CSS, and JavaScript code. Recently, someone proposed...

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尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Safe Exam Browser

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 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use