Home > Web Front-end > HTML Tutorial > Apply CSS styles to the ID element in HTML when its beginning remains the same but its ending is different

Apply CSS styles to the ID element in HTML when its beginning remains the same but its ending is different

王林
Release: 2023-09-12 23:41:04
forward
1070 people have browsed it

Apply CSS styles to the ID element in HTML when its beginning remains the same but its ending is different

Posts can be selected using a div with "id=post". This will select all div elements with an id that contains the value in quotes.

We can use -

div[id*='post-'] { ... } or div[id^='post-'] { ... }.
Copy after login

div[id*='post-'] { ... } will select all div elements whose ids are quotes.

Alternatively we can use,

div[id^='post-'] { ... }
Copy after login

This will select all div elements whose id starts with quotes.

The above is the detailed content of Apply CSS styles to the ID element in HTML when its beginning remains the same but its ending is different. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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