所以,免責聲明,我約2天學習HTML和CSS。我認爲將我的簡歷轉化爲網站將是一個很酷的項目。但是,在設計體驗頁面時遇到了一些問題。理論上,我想將鼠標懸停在某個div上,然後顯示div中包含的一些文本。懸停部分工作,如果我只是使用:懸停而不是#att1:懸停,但如果我這樣做,我不能有多個對象。希望這是有道理的。CSS懸停+ div不工作
我試圖爲每個創建一個div,只是製作一個div,但由於元素被放置在時間軸內,我無法獲得正確的頁面格式。
在一個側面說明,一旦這是固定的,有什麼辦法懸停只適用於圖像,而不是任何相關的邊距/填充?
下面是我得到了什麼:
#job1
{
\t display: none;
}
#job2
{
\t display: none;
}
#att1:hover + #job1
{
\t display: block;
}
#att2:hover + #job2
{
\t display: block;
}
<div class = "timeline">
\t \t
\t <div id = "line"></div>
\t \t \t
\t <a id = "att1" href = "#"><img id = "scintern" src = "https://www.santandercareers.com/content/themes/scusa-careers/assets/images/bemore.png" alt = "Santander Logo"></a>
\t <a id = "att2" href = "#"><img id = "scdss" src = "https://www.santandercareers.com/content/themes/scusa-careers/assets/images/bemore.png" alt = "Santander Logo"></a>
\t \t \t
</div>
\t \t
<div class = "textbox" id = "job1">
\t \t \t
\t <p class = "header">Santander Consumer USA, Inc.</p>
\t <p class = "body">"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
\t \t
</div>
\t \t
<div class = "textbox" id = "job2">
\t \t
\t <p class = "header">Santander Consumer USA, Inc. 2</p>
\t <p class = "body">"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
\t \t
</div>
PS。我保證我現在研究了大約4個小時。不過,也許我沒有在正確的位置尋找,因爲這對我來說太新了。
http://stackoverflow.com/questions/1139763/what-does-the-plus-sign-css-selector-mean –
元素,你想改變的元素必須是子元素,你正在盤旋 –