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
向导航padding-bottom: 40px
添加padding-bottom: 40px
,并将其从文本区域中删除。
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;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.