CSS:Tutorial three
1、CSS Links
links can be styled differently depending on what state they are in.
The four links states are:
a:link- a normal, unvisited linka:visited- a link the user has visiteda:hover- a link when the user mouses over ita:active- a link the moment it is clicked
Text Decoration
The text-decoration property is mostly used to remove underlines from links:
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
color:red;
text-decoration: underline;
}
a:active {
text-decoration: underline;
}
Advanced - Link Buttons
This example demonstrates a more advanced example where we combine several CSS properties to display links as boxes/buttons:
a:link, a:visited {
background-color: #f44336;
color: white;
padding: 14px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
}
a:hover, a:active {
background-color: red;
}

2、CSS Lists
HTML Lists and CSS List Properties
In HTML, there are two main types of lists:
- unordered lists (<ul>) - the list items are marked with bullets
- ordered lists (<ol>) - the list items are marked with numbers or letters
The CSS list properties allow you to:
- Set different list item markers for ordered lists
- Set different list item markers for unordered lists
- Set an image as the list item marker
- Add background colors to lists and list items
Different List Item Markers
The list-style-type property specifies the type of list item marker.
The following example shows some of the available list item markers:
ul.a {
list-style-type: circle;
}
ul.b {
list-style-type: square;
}
ol.c {
list-style-type: upper-roman;
}
ol.d {
list-style-type: lower-alpha;
}

An Image as The List Item Marker
The list-style-image property specifies an image as the list item marker:
ul {
list-style-image: url('sqpurple.gif');
}
Position The List Item Markers
The list-style-position property specifies the position of the list-item markers (bullet points).
"list-style-position: outside;" means that the bullet points will be outside the list item. The start of each line of a list item will be aligned vertically. This is default:
- Coffee - A brewed drink prepared from roasted coffee beans...
- Tea
- Coca-cola
"list-style-position: inside;" means that the bullet points will be inside the list item. As it is part of the list item, it will be part of the text and push the text at the start:
- Coffee - A brewed drink prepared from roasted coffee beans...
- Tea
- Coca-cola
ul.a {
list-style-position: outside;
}
ul.b {
list-style-position: inside;
}
Remove Default Settings
The list-style-type:none property can also be used to remove the markers/bullets. Note that the list also has default margin and padding. To remove this, add margin:0 and padding:0 to <ul> or <ol>:
ul {
list-style-type: none;
margin:;
padding:;
}
List - Shorthand property
When using the shorthand property, the order of the property values are:
list-style-type(if a list-style-image is specified, the value of this property will be displayed if the image for some reason cannot be displayed)list-style-position(specifies whether the list-item markers should appear inside or outside the content flow)list-style-image(specifies an image as the list item marker)
If one of the property values above are missing, the default value for the missing property will be inserted, if any.
ul {
list-style: square inside url("sqpurple.gif");
}
CSS:Tutorial three的更多相关文章
- CSS:Tutorial four
1.CSS Tables To specify table borders in CSS, use the border property. The example below specifies a ...
- CSS:Tutorial two
1.CSS Text text color, text align... Text Decoration The text-decoration property is used to set or ...
- CSS:Tutorial one
1.Three Ways to Insert CSS External style sheet Internal style sheet Inline style External Style She ...
- Hover.css:一组超实用的 CSS3 悬停效果和动画
Hover.css 是一套基于 CSS3 的鼠标悬停效果和动画,这些可以非常轻松的被应用到按钮.LOGO 以及图片等元素.所有这些效果都是只需要单一的标签,必要的时候使用 before 和 after ...
- CSS:opacity 的取值范围是 0~1
CSS:opacity 的取值范围是 0~1,难怪设置为 1~100 看不到效果.
- CSS:CSS定位和浮动
CSS2.1规定了3种定位方案 1.Normal flow:普通流(相对定位 position relative.静态定位 position static) 普通流(normal flow,国内有人翻 ...
- CSS: word-wrap和word-break
最近修改页面排版的一些问题,发现关于内容分词换行有两个主要的CSS: word-wrap 和 word-break 特别是word-wrap还有个取值break-word,更使得这两个属性容易混淆. ...
- CSS:不可思议的border属性
原文:Magic of CSS border property 译文:不可思议的CSS border属性 译者:dwqs 在CSS中,其border属性有很多的规则.对于一些事物,例如三角形或者其它的 ...
- Normalize.css:优化重置CSS默认属性
Normalize.css:优化重置CSS默认属性 官方网站:http://necolas.github.io/normalize.css/ 项目仓库:https://github.com/necol ...
随机推荐
- RTSP客户端接收存储数据(live555库中的openRTSP实例)
一.openRTSP编译运行 a)windows下编译运行 还是以mediaServer作为服务端,openRTSP作为客户端 b)Linux下编译运行 转自http://kuafu80.blog.1 ...
- 使用 10046 查看执行计划并读懂 trace 文件
查看 sql 执行计划的方法有许多种, 10046 事件就是其中的一种. 与其他查看 sql 执行计划不同, 当我们遇到比较复杂的 sql 语句, 我们可以通过 10046 跟踪 sql 得到执行计划 ...
- Eclipse 多行注释选择
1.Eclipse 中的多行注释 选择与清除 (?s)\/\*\*.*?\*\/ (?s)可以匹配多行 \/\*\*表示以/**开头 匹配类似 /** * * * * asdfasdf */
- CSS Id 和 Class选择器
CSS Id 和 Class选择器 如果你要在HTML元素中设置CSS样式,你需要在元素中设置"id" 和 "class"选择器. 一.id 选择器 id 选择 ...
- HTML5堆木头游戏
在线演示 本地下载
- React Native 常用学习链接地址
Android Studio下载http://www.android-studio.org/ 第二章:Android Studio概述(一)http://ask.android-studio.org/ ...
- Intellij IDEA生成serialVersionUID
默认情况下Intellij IDEA不会提示继承了Serializable接口的类生成serialVersionUID的警告.如果需要生成serialVersionUID,就要在Preferences ...
- php学习(二)——html + css
PHP学习 二.Html +css html 介绍 ——基本信息: 英文全称:HyperText Markup Language 中文名:超文本标记语言 2.易忘知识点 (1) html符号实体(又称 ...
- Spring Cloud 与 Spring boot - 转载
微服务是这样一个结构吗? 前端或二方 - > ng集群 -> zuul集群 -> eureka-server集群 -> service provider集群 (二方指其他业务部 ...
- XMLHTTP.readyState
XMLHTTP.readyState的五种就绪状态: 0:请求未初始化(还没有调用 open()). 1:请求已经建立,但是还没有发送(还没有调用 send()). 2:请求已发送,正在处理中(通常现 ...