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 link
  • a:visited - a link the user has visited
  • a:hover - a link when the user mouses over it
  • a: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的更多相关文章

  1. CSS:Tutorial four

    1.CSS Tables To specify table borders in CSS, use the border property. The example below specifies a ...

  2. CSS:Tutorial two

    1.CSS Text text color, text align... Text Decoration The text-decoration property is used to set or ...

  3. CSS:Tutorial one

    1.Three Ways to Insert CSS External style sheet Internal style sheet Inline style External Style She ...

  4. Hover.css:一组超实用的 CSS3 悬停效果和动画

    Hover.css 是一套基于 CSS3 的鼠标悬停效果和动画,这些可以非常轻松的被应用到按钮.LOGO 以及图片等元素.所有这些效果都是只需要单一的标签,必要的时候使用 before 和 after ...

  5. CSS:opacity 的取值范围是 0~1

    CSS:opacity 的取值范围是 0~1,难怪设置为 1~100 看不到效果.

  6. CSS:CSS定位和浮动

    CSS2.1规定了3种定位方案 1.Normal flow:普通流(相对定位 position relative.静态定位 position static) 普通流(normal flow,国内有人翻 ...

  7. CSS: word-wrap和word-break

    最近修改页面排版的一些问题,发现关于内容分词换行有两个主要的CSS: word-wrap 和 word-break 特别是word-wrap还有个取值break-word,更使得这两个属性容易混淆. ...

  8. CSS:不可思议的border属性

    原文:Magic of CSS border property 译文:不可思议的CSS border属性 译者:dwqs 在CSS中,其border属性有很多的规则.对于一些事物,例如三角形或者其它的 ...

  9. Normalize.css:优化重置CSS默认属性

    Normalize.css:优化重置CSS默认属性 官方网站:http://necolas.github.io/normalize.css/ 项目仓库:https://github.com/necol ...

随机推荐

  1. android studio中取消关联git

    Android studio取消关联Git 步骤如下 settings->version control 这里是已经取消关联的 如果关联 按住减号即可

  2. Lambda加自定义比较器实现两个列表的合并

    一次项目有这样的需求,本地存储了json数据,可以转化为对应的List列表,现在需要更新,从服务器那里获取最新的数据更改.总的来说就是本地有个List表,如果数据需要更新,则会向服务器发送请求来获取需 ...

  3. 利用cgroup控制进程使用的资源(cpu、内存等)

    实验环境:centos 6.10 1.安装libcgroup yum install -y libcgroup 2.进入资源控制器默认挂载目录/cgroup [root@hadoop1 cgroup] ...

  4. sql临时表的优点

    1: 临时表来组织数据,更高效的查询速度. 2:临时表的操作不会写入日志文件:好处:提高了 临时表操作的速度:坏处: 数据一旦丢失,无法恢复. 3: 临时表只允许当前会话框进行访问,因此不会担心死锁 ...

  5. Oracle 数据库比较日期大小

    在今天或者今天之前作比较:select * from JN_BUS_KJLWSBJBXX where dqsj < to_date('2007-09-07 00:00:00','yyyy-mm- ...

  6. Metasploit 内网渗透篇

    0x01 reverse the shell File 通常做法是使用msfpayload生成一个backdoor.exe然后上传到目标机器执行.本地监听即可获得meterpreter shell. ...

  7. Spring_通过 FactoryBean 配置 Bean

    beans-factorybean.xml <?xml version="1.0" encoding="UTF-8"?><beans xmln ...

  8. Mybatis导入原生配置文件

    在Spring-Mybatis中导入Mybatis原生配置文件 在sqlSessionFactory Bean中设置设置configLocation属性 <property name=" ...

  9. LeetCode——Reverse String

    LeetCode--Reverse String Question Write a function that takes a string as input and returns the stri ...

  10. Elasticsearch 配置优化

    cluster.routing.allocation.same_shard.host:true 这会防止同一个shard的主副本存在同一个物理机上(因为如果存在一个机器上,副本的高可用性就没有了). ...