CSSCSS保證金不響應的margin-top,但適用於其它邊距屬性
.title{
margin-top: 200px; // does not work!
margin-left: 20px;
font-weight: bold;
color: $green;
font-size: 2.5em;
}
.title:hover{
background-color: transparent;
}
.title:visited{
color: $green;
}
軌/ html.erb
<body>
.....
<%if current_page?(login_path) or request.path == "/signup"%>
<%= link_to "TITLE", "#", class: "title"%>
<%= yield %>
<% else %>
.....
</body>
我的標題使用CSS的工作,但現在沒有。對我的標題總是堅持屏幕的頂部,不管怎麼樣。我試過margin-top和padding-top,但它拒絕下移。 然而,保證金餘額確實有效,所以我不太確定爲什麼保證金的某一方面有效,而另一方面沒有。
我在這裏做錯了什麼?如果你認爲問題沒有在上面的代碼中列出,而是在我的CSS中的其他地方列出,請讓我知道,以便我可以查看我的css的其他部分,問題可能在哪裏!下面
萬一是它定義了基本的佈局部分
/* BASIC CONFIGURATION */
body {
color: #797979;
background: $background;
font-family: 'Lato', sans-serif;
padding: 0px !important;
margin: 0px !important;
font-size:13px;
}
table{
border-collapse: separate;
border-spacing: 10px 5px;
}
td{
margin-right: 10px;
}
#main-content{
font-family: 'Lato', sans-serif;
}
ul li {
list-style: none;
}
a, a:hover, a:focus {
text-decoration: none;
outline: none;
}
a:hover{
background-color: inherit;
}
::selection {
background: #68dff0;
color: #fff;
}
::-moz-selection {
background: #68dff0;
color: #fff;
}
#container {
width: 100%;
height: 100%;
}
我從margin和padding中刪除了!important,並添加了margin-top:200px;到標題看是否有效,但不幸的是它仍然無法正常工作。如果我有!重要的,不應該保證金不工作嗎? – user3277633 2014-12-05 15:51:18
最後,我通過將它包裝在一個div中並將其轉換爲div來修復它。但我相信其他人會讚賞你的建議! – user3277633 2014-12-05 16:13:29