我是一個初學者,我需要幫助。 我想在兩個邊框之間放一個Word
。我的代碼
。#hw {
font-family: Nazanin;
font-size: 200%;
font-weight: normal;
direction: rtl;
text-align: center;
color: #6dbaee;
}
.h1{
border-top: 1px solid #00bdf2;
border-bottom: 1px solid #00bdf2;
padding: 10px 0;
line-height: 150%;
position: relative;
}
< p id="hw">beauty</p>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" class="snippet-box-edit snippet-box-result" frameborder="0"></iframe>
我應該怎樣做才能把我的字放在兩個邊框之間(就像我的CSS中的邊框)?
uj5u.com熱心網友回復:
在你的例子中,你使用了.h1,但是在你的html中沒有名為h1的類。
在CSS中,這些東西被稱為選擇器。
。對于你的HTML,我們可以直接使用p選擇器將CSS系結到它。
注意:這將被設定在你檔案中的每一個p元素上,所以重要的是要考慮到你將什么CSS系結到什么元素上。
#hw {
font-family: Nazanin;
font-size: 200%;
font-weight: normal;
direction: rtl;
text-align: center;
color: #6dbaee;
}
p {
border-top: 1px solid #00bdf2;
border-bottom: 1px solid #00bdf2;
padding: 10px 0;
line-height: 150%;
position: relative;
}
< p id="hw">beauty</p>
<iframe name="sif2" sandbox="allow-forms allow-modals allow-scripts" class="snippet-box-edit snippet-box-result" frameborder="0"></iframe>
uj5u.com熱心網友回復:
你可以把一切做得更簡單。將單詞放入h1標簽,并給他一個id。對于標簽h1,你應該做的不是.h1,而是h1選擇器。
#hw {
font-family: Nazanin;
font-size: 200%;
font-weight: normal;
direction: rtl;
text-align: center;
color: #6dbaee;
}
h1 {
border-top: 1px solid #00bdf2;
border-bottom: 1px solid #00bdf2;
padding: 10px 0;
line-height: 150%;
position: relative;
}
< h1 id="hw">beauty</h1>
<iframe name="sif3" sandbox="allow-forms allow-modals allow-scripts" class="snippet-box-edit snippet-box-result" frameborder="0"></iframe>
uj5u.com熱心網友回復:
你已經有了你需要的一切。只要在段落元素中加入h1類,像這樣:
< p id="hw"/span> class="h1"/span>> beauty</p>/span>
Perfecto!
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/333734.html
標籤:
