Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    19
    Member #
    31220
    Is this exactly the same? If not, what are the differences?

    1) p.right {text-align:right; }

    and

    2) .right {text-align: right; }

    Is the top example (1) just describing that .right is for a <p> tag, whereas example (2) just misses this detail. Will they both work?

    Thanks

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    1) will only work for a paragraph tag.
    2) will work for all block elements containing that class (divs, headers, inline-level elements defined as block level through CSS, etc.)

    That's the difference. My general rule is to specify the tag I want it for to avoid confusion, although I do make exceptions if I make common use of classes (e.g. .right).
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Junior Member
    Join Date
    Mar 2012
    Posts
    19
    Member #
    31220
    Quote Originally Posted by TheGAME1264, post: 239762
    1) will only work for a paragraph tag.
    2) will work for all block elements containing that class (divs, headers, inline-level elements defined as block level through CSS, etc.)

    That's the difference. My general rule is to specify the tag I want it for to avoid confusion, although I do make exceptions if I make common use of classes (e.g. .right).
    Thanks, crystal clear now

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    No problem!
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:00 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com