2017-03-02 75 views
1

我只是想把我的文本放在頁面頂部的灰色框中。結果是文本看起來像突出顯示。CSS框不工作,不斷突出顯示文本

box1 { 
 
    background-color: lightgrey; 
 
    width: auto; 
 
    padding: 15px; 
 
    margin: 25px; 
 
}
<box1><strong>Note:</strong> Some of these resources are free, and some aren’t. Those that are paid resources are affiliate products or services, meaning if you buy them, I get a commission at no extra cost to you.&nbsp;Please know that I have personal experience 
 
    with all of the following resources, which is why I recommend them.</box1>

不知道我錯過了什麼。

+2

沒有'在HTML box1'標籤。 – Shaggy

+0

請添加相關的代碼,標記,腳本等,而不是鏈接到可能或可能不會在將來展示問題的一側。有關更多詳細信息,請參見[**如何創建最小,完整和可驗證示例**](http://stackoverflow.com/help/mcve)。你的鏈接網站改變這個問題是多餘的,並且對將來有類似問題的任何用戶都沒有用。 – Nope

+0

使用Div標籤代替標籤 –

回答

3

我檢查了你的代碼在web檢查器。只需將box1更改爲類而不是標記。然後換行文本

.box1 { 
 
    background-color: lightgrey; 
 
    width: auto; 
 
    padding: 15px; 
 
    margin: 25px; 
 
}
<p class="box1"><strong>Note:</strong> Some of these resources are free, and some aren’t. Those that are paid resources are affiliate products or services, meaning if you buy them, I get a commission at no extra cost to you.&nbsp;Please know that I have personal experience 
 
    with all of the following resources, which is why I recommend them.</p>