I have
<div id="aa">
<img src="." height="17" alt="example1" title="">
<table>
<tbody><tr>
<th></th>
<td></td>
</tbody>
</table>
<img src="." height="17" alt="example2" title="">
<table>
<tbody><tr>
<th></th>
<td></td>
</tbody>
</table>
<img src="." height="17" alt="example3" title="">
<table>
<tbody><tr>
<th></th>
<td></td>
</tbody>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
I only want to select the attributes "alt" values "example1, example2, example3" of images. How can I get them.
I presume you mean that you want to select all the images (in CSS) that contain example*
in the alt attribute, so you can style them. (and that you don't mean that you actually want tot select the text set in the alt attribute)
You can use the attribute selector:
img[alt~="example"] {
border: 1px solid red;
}
Run Code Online (Sandbox Code Playgroud)
To select some attribute use selector img[alt="example1"], img[alt="example2"], img[alt="example3"]
归档时间: |
|
查看次数: |
8442 次 |
最近记录: |