html - 水平调整大小时样式困惑

标签 html wordpress css

当我将页面水平调整到 800 像素以下时,它会弄乱样式。

有人可以看看发生了什么事吗? 为什么会这样?

这是 wordpress Geotheme。

谢谢。

“我只是用不同的方式修复了它。我发现 @media(max-width:800px) 应用了一组不同的样式,这些样式导致了问题,无论如何谢谢。”

最佳答案

您在内部 div 中有一个 margin:auto on。这意味着 div 将始终尝试填充空间。

在标题上添加 overflow:auto。 在正确的位置移除 margin:auto

设计本身……太复杂了。你真的应该简化它并将边距和你放置内容的区域分开。

<div id="page_head" style="width:800px; margin:auto; margin-top:20px; border:1px solid black; height:100px; position:relative; padding-left:200px; box-sizing:border-box;">
     <div style="position:absolute; left:0px; top:0px; background-color:red; width:100px; height:100px;">Image</div>
</div>
<div id="page_content" style="width:800px; margin:auto; margin-top:20px; border:1px solid black; height:100px; position:relative;">

</div>
<div id="page_footer" style="width:800px; margin:auto; margin-top:20px; border:1px solid black; height:100px; position:relative;">

</div>

对此,如果加上外层的div还可以进一步控制。 参见 JsFiddle example .

关于html - 水平调整大小时样式困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16781316/

相关文章:

asp.net MVC的Html.RadioButton生成id和name相同

php - WordPress 从主机迁移到本地服务器

html - Bootstrap 网格系统总是在前面

html - 在CSS中设置选择和输入元素的宽度

html - 将类从 navbar-light 更改为 navbar-dark 隐藏导航栏

php - Bootstrap 4 明信片在我的网站上似乎有所不同

php - 使用 php 使用 css 更改 html 布局

javascript - 水平添加一张又一张背景图片

javascript - 下拉菜单几乎可以工作,但并不完美

php - 避免在 Woocommerce 中结账混合延期交货和正常商品