【发布时间】:2015-07-02 15:21:29
【问题描述】:
我有以下几点:
HTML
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>Result</title>
</head>
<body>
<div>
<a href= https://google.com>Google</a>
<a href= https://google.com>Google</a>
<a href= https://google.com>Google</a>
</div>
</body>
</html>
CSS
a:hover{
text-decoration: none
}
a:first-child{
color: #CDBE70
}
a:nth-child(3){
color: #FFC125
}
我刚开始学习 HTML,但遇到了问题。我上面的内容显示了 3 个指向 google 的链接,但它们都在同一行。我希望每个链接都在一个新行上。我尝试使用 <p> 并将 CSS 代码中的所有 a 更改为 p,但它没有做任何事情。
【问题讨论】:
-
使用浮动:左; clear:left 到 CSS 中的锚标记
-
从外观上看,您可能想改用
ul和lis。