我想修改類搜索中的第一個和最后一個孩子。這是我的嘗試,但它并不奏效。
這是我的HTML。
<div id="search">
<form method="get" action="http://images. google.com/images">
<div>Search</div>
<div>< input type="text" name="q" class="searchInput"> </div>>
<div>/span>
< input type="submit" value="Search Image" class="SearchButton">
</div>
<div> 試一試 </div>
</form>/span>
</div>/span>
這兩個人都沒有作業
.search div:first-child,
.search div:last-child {
font-size: large;
color: red;
.search form>div:first-child。
.search form>div:last-child{
font-size: large;
color: red;
請問問題出在哪里,謝謝。
uj5u.com熱心網友回復:
你正在使用.search 而不是使用#search,因為你使用的是一個id。
你正在使用.search。
CodePudding
。 #search div: first-child,
#search div:last-child {
字體大小。30px;
color: red;
}
<div id="search">
<form method="get" action="http://images. google.com/images">
<div>Search</div>
<div>< input type="text" name="q" class="searchInput"> </div>>
<div>/span>
< input type="submit" value="Search Image" class="SearchButton">
</div>
<div> 試一試 </div>
</form>/span>
</div>/span>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" class="snippet-box-edit snippet-box-result" frameborder="0"></iframe>
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/333975.html
標籤:
上一篇:當以編程方式聚焦元素時,應用:focus-visible
下一篇:如何使用類來動態地將子母欄居中?
