17
這裏是位於網頁的兩個跨度(在現實生活中有很多跨度)。我想設置它們之間的距離。我想爲此使用margin-bottom屬性,但我看不到使用它的任何影響。跨度仍處於前一個位置。那是錯的。 這是我的代碼:使用邊距設置跨度間的距離
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<style type="text/css">
.position, .name{
overflow: hidden;
}
.position{
margin-bottom: 40px;
}
</style>
</head>
<body>
<span class="position">Designer</span><br/>
<span class="name">John Smith</span>
</body>
</html>
我只同意你的一部分,當你說跨度不尊重保證金。它確實尊重保證金,但僅限左右。不是頂部和底部。 – Devner 2013-10-07 12:27:11
是的,這是正確的,CSS2.1 [指定內聯元素以尊重水平邊界](http://www.w3.org/TR/CSS21/visuren.html#inline-formatting)。問題在於垂直對齊,所以保證金不起作用。 – Pascal 2013-10-07 15:12:53
我現在很忙,但span上的padding-top對我來說並不起作用。我最終使用了一個div。 Owell。 – 2013-10-24 18:43:26