假設我們有一個<label>
其中有<span>
兄弟姐妹。現在我想選擇跨度並在其上應用一些樣式。說:設計一個嵌套的HTML標籤
<label class="checkbox-inline" for="currentDate">
<input type="checkbox" checked="checked" id="currentDate" />
<span><spring:message code='Admin.News.NewsDate.CurrentDate' /></span>
</label>
<span tooltip="<spring:message code='Admin.News.NewsDate.Tooltip' />" class="help-button">?</span>
我想這有help-button
,因爲它的同胞類跨度chechbox-inline
等級標識,獲取padding-left: 0px;
你想選擇跨度只有當它是一個兄弟的div?或者是什麼? – inorganik
我覺得你的問題與此類似:http://stackoverflow.com/questions/1817792/is-there-a-previous-sibling-css-selector – otaviko
請閱讀更新 –