www.webdeveloper.com
Results 1 to 4 of 4

Thread: Overiding a sticky <p> rule....

Hybrid View

  1. #1
    Join Date
    May 2013
    Posts
    7

    Overiding a sticky <p> rule....

    Hi all.

    I have another code question for the pros:

    I've indented my body <p> elements....

    p {
    color: #90428b;
    text-indent: 1.5rem;
    text-align: justify;
    }


    ...but want to remove that indent from a time element at the top of the page:
    (<p><time datetime="2013-05-08" id="pubdate">May 8, 2013</time></p>).

    I've tried the following css rules but neither of them overides the plain <p> indent value - no matter how specific I get - even putting the time rule AFTER the p rule.

    And there is only one time element on the whole page, so I don't get what I'm doing wrong.

    Here's what I've tried so far:

    -----------------------------------------------------------

    p time {
    text-indent: 0;
    }

    p time[datetime="2013-05-08"] {
    text-indent: 0;
    }

    p[datetime="2013-05-08"] {
    text-indent: 0;
    }

    *[datetime="2013-05-08"] {
    text-indent: 0;
    }

    time[datetime="2013-05-08"] {
    text-indent: 0;
    }

    #pubdate {
    text-indent: 0;
    {

    #pubdate[datetime="2013-05-08"] {
    text-indent: 0;
    }

    #pubdate * [datetime="2013-05-08"] {
    text-indent: 0;
    }

    time#pubdate * [datetime="2013-05-08"] {
    text-indent: 0;
    }


    -----------------------------------------------------------

    I'm only using an external stylesheet, so there is no inline css to conflict.

    Any thoughts?

    B.

  2. #2
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,456
    Hi there bellybuckle,

    you could use...
    Code:
    
    #pubdate {
        margin-left:-1.5rem;
     }
    ...alternatively you could give any "p element" that did not require indentation
    a class name, say class="no-indent" and then use this CSS...
    Code:
    
    .no-indent {
        text-indent:0;
     }
    coothead

  3. #3
    Join Date
    May 2013
    Posts
    7
    Hey coothead - this is EXACTLY what I was looking for! Thanks so much.

    B.

  4. #4
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,456

    No problem, you're very welcome.


    coothead

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles