:短的引用语
One person said:
Real dream is the other shore of reality.
:引用、引证
The blog, writed by Island, is so useful
:项目
Difine a new project at here.
效果图
概述
一个 HTML 元素,可能会有一个背景,这样才会更加突出元素的内容。正所谓,“鲜花还需绿叶衬”。
可设置的背景样式属性
| background | 简写的背景,简写时按照以下顺序 |
| background-color | 背景颜色 |
| background-image | 背景图片 |
| background-repeat | 背景图片是否及如何平铺 |
| background-attachment | 背景图片是否固定或随着其他部分滚动 |
| background-position | 背景图片的其实位置 |
代码
body { /*背景色为 浅灰色*/ background-color: lightgray; /*背景图片的 资源地址*/ background-image: url("background.png"); /*背景图片在 x 轴上平铺*/ background-repeat: repeat-x; /*背景图片固定*/ background-attachment: fixed; /*背景图片的其实位置为右上角*/ background-position: right top;} 效果
概述
除了 HTML 标签定义的文本可是外,CSS 还定义了大量的文本样式属性。
语法
h1 {color: blue;} 可设置属性
| font | 字体的简写形式 |
| font-family | 字体系列 |
| font-style | 字体样式 |
| font-size | 字体大小 |
| font-weight | 字体粗细 |
| font-variant | 以小型大写字体或者正常字体显示文本 |
语法
.varient {font-variant: small-caps;} 语法
a {text-decoration: overline;} 取值及含义
| none | 标准文本,没有修饰(通常用来去除链接文本的下划线) |
| underline | 下划线 |
| line-through | 中划线 |
| overline | 中划线 |
| blink | 闪烁文本 |
| inherit | 从父元素那里继承属性值 |
语法
#shadow {text-shadow: 2px 2px orange;} 语法
#upper {text-transform: uppercase;} 取值及含义
| none | 默认 |
| capitalize | 每个单词的首字母大写 |
| uppercase | 全部大写 |
| lowercase | 全部小写 |
| inherit | 从父元素那里继承属性值 |
语法
p {text-indent: 35px;} 语法
h1 {text-align: center;} 取值及含义
| left | 靠左对齐 |
| center | 居中 |
| right | 靠右对齐 |
| justify | 两端对齐 |
| inherit | 从父元素那里继承属性值 |
语法(主要设置嵌入到文本中的元素基于文本的对其方式)
img {vertical-align: top;} 取值及含义
| baseline | 默认。元素放置在父元素的基线上 |
| top | 把元素的顶端与行中最高元素的顶端对齐 |
| middle | 把此元素放置在父元素的中部 |
| bottom | 把元素的顶端与行中最低的元素的顶端对齐 |
| text-top | 把元素的顶端与父元素字体的顶端对齐 |
| text-bottom | 把元素的底端与父元素字体的底端对齐 |
| super | 垂直对齐文本的上标 |
| sub | 垂直对齐文本的下标 |
| length | 长度 |
| % | 使用 "line-height" 属性的百分比值来排列此元素。允许使用负值 |
| inherit | 规定应该从父元素继承 vertical-align 属性的值 |
语法
#direction {direction: rtl;} 语法
h1 {letter-spacing: 3px;} 语法
p {word-spacing: 10px;} 语法
div {line-height: 50px;} 语法
#direction {white-space: pre;} 取值及含义
| normal | 默认。空白会被浏览器忽略 |
| pre | 空白会被浏览器保留。其行为方式类似 HTML 中的 标签 |
| nowrap | 文本不会换行,文本会在在同一行上继续,直到遇到 标签为止 |
| pre-wrap | 保留空白符序列,但是正常地进行换行 |
| pre-line | 合并空白符序列,但是保留换行符 |
| inherit | 规定应该从父元素继承 white-space 属性的值 |
HTML 文档
CSS 样式 2 Subject
The firstparagraph.
The second paragraph
If you want to learn more about HTML, CSS, JavaScript, please click 世俗孤岛
css 文件
div {line-height: 50px;}h1 { color: blue; letter-spacing: 3px; text-align: center;}a {text-decoration: overline;}p {text-indent: 35px;}p {word-spacing: 10px;}img {vertical-align: top;}#upper {text-transform: uppercase;}#direction { direction: rtl; white-space: pre;}#shadow {text-shadow: 2px 2px orange;}.varient {font-variant: small-caps;} 效果
写到这里,该 Blog 也该到一段落了。回顾一下在该 Blog 中,主要阐述了 HTML 文档中,文本的格式化公式,包括:HTML 样式和 CSS 样式。再接下来的 Blog 中,会详述其他 HTML 元素的 CSS 样式的设置方式。
Copyright © 2019- iaaf.cn 版权所有
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务