admin管理员组文章数量:1430020
This is a WordPress site and I'm using bootstrap.
Site is /
Basically I'm just trying to get rid of the initial top margin. So instead of this:
It should look like this:
I've tried adding styles to the html element in my stylesheet, but nothing has worked. I.e.
html {
margin-top: 0px!important;
}
So then I'm wondering if the issue is WordPress related?
There is not any top margin when I place relevant code in a Codepen.
Any ideas?
This is a WordPress site and I'm using bootstrap.
Site is https://doodle.gatewaywebdesign/
Basically I'm just trying to get rid of the initial top margin. So instead of this:
It should look like this:
I've tried adding styles to the html element in my stylesheet, but nothing has worked. I.e.
html {
margin-top: 0px!important;
}
So then I'm wondering if the issue is WordPress related?
There is not any top margin when I place relevant code in a Codepen.
Any ideas?
Share Improve this question asked May 3, 2019 at 0:42 HappyHands31HappyHands31 13510 bronze badges2 Answers
Reset to default 2That looks like the margin added by the WP admin bar when you are logged into the site. WP adds an inline style tag which sets the margin on the html element with an !important flag. Since it typically comes after any of your own styles it overrides them even if you also use !important. Since it only displays when you are logged in it shouldn't matter much, but if you really want to remove the admin bar you can change that in the settings Users->Your Profile then uncheck "Show Toolbar when viewing site". Or add the following to your functions file.
add_filter(‘show_admin_bar’, ‘__return_false’);
Your best bet is to use the Inspector tool in your browser (F12, usually). Position the cursor at the top of the page, right-click, Inspect Element. Then click on the code lines until you find the right spot for that CSS element.
Then over on the right side, find the CSS element for margin or padding, and figure out the CSS class that affects that area. Use that class name to add to the theme's Additional CSS (in Theme, Customize) to add the CSS for top margin.
If you have never used the Inspector before, there are many googles (or bings or ducks) that will show you videos. The Inspector is a great way to find the proper CSS class to modify.
(And CSS questions aren't really part of what happens around here.....)
本文标签: CSSInitial HTML Margin Issue On WordPress Site
版权声明:本文标题:CSS - Initial HTML Margin Issue On WordPress Site 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745529635a2661999.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论