How to select elements with specified attributes and values ​​using CSS

WBOY
Release: 2023-09-19 19:29:02
forward
1064 people have browsed it

如何使用 CSS 选择具有指定属性和值的元素

Use the [attribute = ”value”] selector to select elements with the specified attribute and value.

You can try running the following code to implement the CSS [attribute = "value"] selector. Here we treat the properties as rel,

Example:

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
      a[rel = nofollow] {
         border: 3px solid blue;
      }
      </style>
   </head>

   <body>
      <a href = "https://qries.com/What-is-Uber-s-business-model-and-how-does-it-compare-with-Ola-s-model-in-India" rel = "nofollow">Uber&#39;s Business Model</a><br><br>
      <a href = "https://www.qries.com/How-does-share-market-work-in-India" rel = "noreferrer">Share Market</a>
   </body>
</html>
Copy after login

The above is the detailed content of How to select elements with specified attributes and values ​​using CSS. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template