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

王林
王林forward
2023-09-12 23:41:041066browse

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-'] { ... }.

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

Alternatively we can use,

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

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete