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 8 of 8
Like Tree5Likes
  • 3 Post By TheGAME1264
  • 2 Post By Ronald Roe

Thread: CSS question

  1. #1
    Senior Member
    Join Date
    Feb 2006
    Posts
    800
    Member #
    12463
    Liked
    298 times

    CSS question

    I am still weak in CSS. I don't see how this works, in fact, I cannot see any difference if I remove the nth-child statements.
    See results at Tryit Editor v2.6

    Try removing those statements and tell me what is happening. It is confusing me.
    Is this an instance where w3schools falls short - no explanation of what the nth-child is, what it does, or when to use it?
    Last edited by delstu; Dec 26th, 2015 at 01:46 PM.

  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
    If you're trying to highlight the row, as you are in your case, the better choice is nth-of-type. nth-of-type applies to the element. nth-child will work the same in this case, because each row is a child of the parent (table) element and nth-child is for child elements.

    So in your specific case, you'd use it to highlight odd and even-numbered rows that are children of the t01 table.
    Vapr_Arts, delstu and AlphaMare like this.
    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
    Senior Member
    Join Date
    Feb 2006
    Posts
    800
    Member #
    12463
    Liked
    298 times
    Thanks Game. Your explanation helps a lot even though I still couldn't see the highlight until I changed the angle of view on my laptop screen. Seems odd that I can only see it at a certain angel.

  5. #4
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Vapr_Arts and AlphaMare like this.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  6. #5
    Senior Member Vapr_Arts's Avatar
    Join Date
    Oct 2013
    Location
    California
    Posts
    1,930
    Member #
    37412
    Liked
    544 times
    Yea I love css-tricks. I usually go there first and then branch off to other sites depending on what it is I am trying to do.


    Sent from my iPhone using Tapatalk

  7. #6
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Quote Originally Posted by delstu View Post
    Thanks Game. Your explanation helps a lot even though I still couldn't see the highlight until I changed the angle of view on my laptop screen. Seems odd that I can only see it at a certain angel.
    It's not that odd.. There's not a lot of difference in terms of contrast between #eee and #fff.

    Next time, try a color that stands out such as say #FF0000 or my personal favorite, #123456. If you can't spot a difference that way, you've done something wrong...or your other color is too close.
    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)

  8. #7
    Banned
    Join Date
    Dec 2015
    Posts
    75
    Member #
    52817
    Liked
    7 times
    Well the nth-child gets the child element of the parent element.

  9. #8
    Senior Member
    Join Date
    Feb 2006
    Posts
    800
    Member #
    12463
    Liked
    298 times
    Quote Originally Posted by James More View Post
    Well the nth-child gets the child element of the parent element.
    I know what a child element is and it's dependence on the parent. The Game has come closest to answering my actual question - what is the nth-child, what does it do and when to use it. My main source of confusion was the selection of colors that W3schools had included. I know what #fff is but was not familiar with #eee so had no idea about the lack of contrast.

    What I failed to include is that I am just beginning to study design and development - taking 3 online tutorials simultaneously. 10 years ago I studied html enough to get the basics but am repeating tutorials to understand HTML5 and CSS3 (never did learn much about CSS back then).

    I am still so early in my studies that I don't really know whether to concentrate on design or dev. Correct me if I am wrong but I assume you have to know programming to do dev work, so a lot depends on how difficult programming languages turn out to be for me.


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:57 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com