Reputation: 25270
I have a navigation bar with 40px height and I can't place my other content (just a textarea) below this bar. I tried to set margin-top:40px;
to the textarea but it doesn' t work.
Then I used padding-top:40px
which is ok for the content inside the textarea but as you will see has a problem with the scrollbar (it gets behind the bar).
Just take a look at this jsFiddle
Upvotes: 0
Views: 3966
Reputation: 841
Add padding-bottom: 40px
to the nav, and remove it from the text-area.
Upvotes: 4
Reputation: 115383
As an alternative to @Andrw Ice's answer
You just have to give the textarea
s margin something to push against.
This is common...as the advantage is that it doesn't cause any of the elements to moveif the navbar is hidden.
body {
border:1px solid transparent;
}
nav + textarea{
margin-top: 40px;
}
Upvotes: 1