Table of Contents
数字
颜色——命名颜色
aqua
fuchsia
lime
olive
red
white
black
gray
maroon
orange
silver
yellow
blue
green
navy
pruple
teal
颜色——RGB颜色
 
颜色——16进制RGB颜色
颜色——等忦颜色表
 颜色——Web安全色
长度单位
长度单位——相对长度单位
 
Home Web Front-end HTML Tutorial Web前端新人笔记之CSS值和单位_html/css_WEB-ITnose

Web前端新人笔记之CSS值和单位_html/css_WEB-ITnose

Jun 24, 2016 am 11:20 AM

数字

颜色——命名颜色

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

<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>
Copy after login

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

颜色——RGB颜色

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

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

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

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*/
Copy after login

颜色——16进制RGB颜色

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

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

颜色——等忦颜色表

颜色——Web安全色

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

长度单位

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

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

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

 

 

Statement of this Website
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

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)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

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 the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

The article discusses the &lt;iframe&gt; tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 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.

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.

See all articles