开发者

Is it possible to set css properties by id prefix?

开发者 https://www.devze.com 2023-02-26 20:13 出处:网络
Example Set for all divs with ids starting obj_ a black background color. I开发者_StackOverflow社区s this possible just using CSS ?

Example

Set for all divs with ids starting obj_ a black background color.

I开发者_StackOverflow社区s this possible just using CSS ?

EDIT

Ups I wrote class name in the title byt I ment Id name..


Using the CSS3 attribute-starts-with selector:

div[id^="obj_"] {
    background: #000
}

This will work in all modern browsers.

0

精彩评论

暂无评论...
验证码 换一张
取 消