Results 1 to 5 of 5

Thread: Pseudo class syntax

  1. #1
    Join Date
    Apr 2012
    Location
    Central New Jersey
    Posts
    212
    Thanks
    77
    Thanked 3 Times in 3 Posts

    Default Pseudo class syntax

    I'm seeking center justification for the first and second columns of each row. The syntax I'm using is incorrect. Can someone please lend a hand?

    Code:
    table.praises-be td {
    	border-style: solid;
    	border-width: 1px;
    	border-color: #848482;
    	margin: auto;
    	nth-child: {text-align: center;};
    	nth-child(2): {text-align: center;};
    }
    A.
    Last edited by marain; 08-15-2018 at 02:01 PM. Reason: To mark "resolved"

  2. #2
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    509
    Thanks
    9
    Thanked 59 Times in 57 Posts

    Default

    Code:
    table.praises-be td {
    	border-style: solid;
    	border-width: 1px;
    	border-color: #848482;
    	margin: auto;
    }
    
    table.praises-be td:nth-child(2) {text-align: center;}
    I am not sure why you are calling 'nth-child:' so I ignored it.
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

  3. The Following User Says Thank You to Deadweight For This Useful Post:

    marain (08-13-2018)

  4. #3
    Join Date
    Apr 2012
    Location
    Central New Jersey
    Posts
    212
    Thanks
    77
    Thanked 3 Times in 3 Posts

    Default

    DW,

    Your solution works (as you knew it would)!

    I called the nth-child because I wanted the contents of column one centered as well. So I added a line to what you provided, as follows:
    Code:
    table.praises-be td:nth-child(2) {text-align: center;}
    table.praises-be td:nth-child(1) {text-align: center;}
    I assume both lines can be combined, although when I tried to do it, CSS hiccuped.

    The book I've been trying to use is less than helpful. For example, its description did not enable me to discern whether nth-child without a subscript defaults to nth-child(1). Regardless, I thank you.

    A.

  5. #4
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    509
    Thanks
    9
    Thanked 59 Times in 57 Posts

    Default

    You should be able to combine them to one line.
    Code:
    table.praises-be td:nth-child(2), table.praises-be td:nth-child(1) {text-align: center;}
    I havent really heard of that happening before but I am not that pro at CSS (about the nth-child defaulting to nth 1.
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

  6. #5
    Join Date
    Apr 2012
    Location
    Central New Jersey
    Posts
    212
    Thanks
    77
    Thanked 3 Times in 3 Posts

    Default

    DW,

    Many thanks. I'll play with it. And, in the meanwhile, I'll mark the issue "resolved."

    A.

Similar Threads

  1. nesting pseudo classes?
    By jql999@yahoo.com in forum CSS
    Replies: 2
    Last Post: 03-24-2010, 02:09 AM
  2. Resolved pseudo-class help
    By Snookerman in forum CSS
    Replies: 4
    Last Post: 10-19-2008, 10:06 AM
  3. Targetted pseudo-classes
    By DigitalBrit in forum CSS
    Replies: 2
    Last Post: 06-28-2007, 10:20 AM
  4. Pseudo class (anchor) mouseover style
    By wishiwasageek in forum CSS
    Replies: 5
    Last Post: 05-26-2005, 04:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •