css - 选择图片的 alt 属性

标签 css css-selectors

我有

   <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>
我只想选择图像的属性“alt”值“示例 1、示例 2、示例 3”。我怎样才能得到它们。

最佳答案

要选择一些属性使用选择器 img[alt="example1"], img[alt="example2"], img[alt="example3"]

关于css - 选择图片的 alt 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25520199/

相关文章:

CSS 子导航菜单文本颜色更改

jquery - 水平div不在一条线上

css - 将一个 div 垂直对齐到另一个 div 旁边

javascript - 如何通过CasperJS从具有特定类的元素中获取href?

html - 如何在所有内容下方的 <table> 中添加按钮?

html - 奇怪的白色间隙和水平滚动问题

javascript - 查询选择器属性值以空字符串开头失败

javascript - jQuery - 选择属性名称(而不是值)以...开头的所有元素?

python - 仅当有两个类并且共享相同的第一个时才选择元素

html - 使类型为 'text' 的表单输入具有灰色背景