/    Sign up×
Community /Pin to ProfileBookmark

having trouble with combined classes

two questions:

  • 1. Im having trouble getting these two definitions to work right together. I want the right_top_content to be overridden by .leftalign
  • [QUOTE]

    div#right_top_content {
    font-size: 12px;
    width: auto;
    margin: auto;
    padding: 0px 5px 5px 5px;
    text-align: center;
    }

    div#leftalign {
    text-align: left;
    }

    [/QUOTE]

    You can see on the site here: [url]http://www.nevertap.com/rules.php[/url] where the column does do the text align, but does not inherit the padding. why? The tag is referenced as such <div id=”right_top_content leftalign”>

  • 2. This tag reference is not valid xhtml .. something about a token. How do i get around this? apparently you cant separate an id element with a space, so then how do you combine classes/ids?
  • to post a comment
    CSS

    7 Comments(s)

    Copy linkTweet thisAlerts:
    @NogDogJul 12.2006 — An element can only have one ID. You can assign multiple classes, but IDs must be singular and unique. Because of the unique part, there is no reason to ever need to assign two IDs to a single element.
    Copy linkTweet thisAlerts:
    @matt1776authorJul 12.2006 — but then if i made the leftalign definition a class i could not specify a class and an id for that div. ive tried it

    <div id="right_top_content" class="leftalign">

    doesnt work.

    how would i accomplish a left align with padding for just that page/markup?
    Copy linkTweet thisAlerts:
    @NogDogJul 12.2006 — Either combine the two ID definitions into one, or if there's some reason you don't want to do that, then you can specify the one-time exception for this page via an in-line style:
    <i>
    </i>&lt;div id="right_top_content" style="text-align: left"&gt;
    Copy linkTweet thisAlerts:
    @matt1776authorJul 12.2006 — inline style specification!!! yes! ? is that ok to do? i mean, ... proper form?

    also, see the calendar on the side there. thanks again ? it looks great!
    Copy linkTweet thisAlerts:
    @felgallJul 12.2006 — The specification for an id is always the most specific and so takes priority over everything else. If the id says it is centred then you can't change the alignment by using a class. Why specify that it should be aligned centred in the id if that isn't what you want?
    Copy linkTweet thisAlerts:
    @matt1776authorJul 12.2006 — because i wanted different alignments for different pages. it might be the only one where i need it differently so maybe specifying inline is not so bad in this case.
    Copy linkTweet thisAlerts:
    @ray326Jul 12.2006 — If the need can be specified consistently then you might use the body ID trick to establish distinct page presentations.
    ×

    Success!

    Help @matt1776 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.20,
    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,
    )...