/    Sign up×
Community /Pin to ProfileBookmark

id and class – in 1 div tag

is it okay to have both and id and a class within a single div tag ?

like this :

<div id=”layer2″ class=”image_div”></div>

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@felgallFeb 20.2007 — Yes. You can place one id and as many classes as you like in the one tag. The id will take precedence because it is unique to that tag. The classes will take precedence from the right in the order they are specified.

<div id="me1st" class="me4th me3rd me2nd"></div>
Copy linkTweet thisAlerts:
@Mr_Initial_ManFeb 20.2007 — Thanks for the info about class precedence. I didn't know it had an effect.
Copy linkTweet thisAlerts:
@felgallFeb 20.2007 — It is called [b]cascading[/b] stylesheets because the style settings cascade down until overwridden by something more specific or closer to the object to be styled.
Copy linkTweet thisAlerts:
@changintimesauthorFeb 20.2007 — great info, thanks alot fellgal,
×

Success!

Help @changintimes spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...