Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS p:first-of-type pulls down left sidebar w/o any

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #163370
    GroovyMotion
    Participant

    I have a layout with a fixed top div, left sidebar and main content and I am trying to position the first paragraph in the main section to a 50px margin-top but my left navbar gets pulled down by 50px as well and there is no

    <p> in it, what could interfere in my code? Here is my pen: http://codepen.io/GroovyMotion/pen/aeHqt

    #163405
    Paulie_D
    Member

    Based on your current example, I’m assuming that you are referring to the first section (which has no designated class).

    If so…

    section:first-of-type p:first-child {
      padding-top:50px;
    }
    

    would probably do it…although I would just give that section a class and then use that instead.

    .myclass p.first-child {
      padding-top:50px;
    }
    

    Then again

    #container {
      padding-top:50px;
    }
    

    works too.

    #163406
    GroovyMotion
    Participant

    oh no I am refering to the left-nav, I don’t want it to be pushed down like the main-content section. I tried to rename the main content with the sections but it still doesn’t work.
    So far the only way I can force the left nav to stay higher is to add a margin-top: -10px; to the nav.left-nav class. Here is my updated pen: http://codepen.io/GroovyMotion/pen/aeHqt

    #163409
    Paulie_D
    Member

    Are you using a reset.css / normalize?

    I applied Normalize and got this: http://codepen.io/Paulie-D/pen/LzaAc

    Frankly I’m not sure what precisely you are trying to do.

    Are you trying to line up the menu or p with something else?

    #163410
    GroovyMotion
    Participant

    no reset/normalize yet as this is just some test to learn different layouts.

    Ideally I’d like the left menu’s top position not to be overridden by the main-content section where there are the text paragraphs.

    oops have a look at my updated pen, it’s slightly different, I added the footer and centered everything http://codepen.io/GroovyMotion/pen/aeHqt

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.