我有两个链接,它们共享相同的样式(class 和 div)。但问题是,我不知道从哪里提取 html。所以我想为每个链接赋予不同的样式。所以我想知道是否可以仅使用标题来定位类或 div?
这是生成的 html:
<div class="event_legend_container">
<div style="border-color:" class="event_legend_item activechildcat">
<div style="border-color:" class="event_legend_name">
<a title="HR Calender" href="/using-joomla/human-resources/2012-10-17-10-31-30/month.calendar/2013/05/20/85">
HR Calender
</a>
</div>
</div>
<div style="border-color:#d3d3d3" class="event_legend_item ">
<div style="border-color:#d3d3d3" class="event_legend_name">
<a title="All Categories ..." href="/using-joomla/human-resources/2012-10-17-10-31-30/month.calendar/2013/05/20/-">
All Categories ...
</a>
</div>
</div>
最佳答案
您可以使用 attribute selector :
a[title*="HR Calender"]{
color:red;
}
a[title*="All Categories"]{
color:green;
}
关于html - 我可以使用 css 通过标题唯一地标识或拉出一个类或 div 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16649717/