Html “如何居中”;分区中心“;而不是",;“起点”;div的
Html “如何居中”;分区中心“;而不是",;“起点”;div的,html,css,responsive-design,Html,Css,Responsive Design,(来源:) 当我将浏览器的宽度减少到大约700像素以下时,我在我的响应式设计网站中遇到了这个问题 我添加了左边距:自动; 右边距:自动,但输出保持不变。如果我把左:50%,它可能会显示一些奇怪的位置,因为我的标题是position:fixed(尽管我没有提到它的顶部/左侧/右侧/底部) 徽标“ILOVERROLLS”从页面中心开始…因此图像中心不居中。 (来源:) 非常感谢您的帮助。您需要将#topdiv1(第663行)的display属性更改为display:block。我在我的Chrome
(来源:) 当我将浏览器的宽度减少到大约700像素以下时,我在我的响应式设计网站中遇到了这个问题 我添加了
左边距:自动;
右边距:自动代码>,但输出保持不变。如果我把左:50%,它可能会显示一些奇怪的位置,因为我的标题是position:fixed
(尽管我没有提到它的顶部/左侧/右侧/底部)
徽标“ILOVERROLLS”从页面中心开始…因此图像中心不居中。
(来源:)
非常感谢您的帮助。您需要将#topdiv1
(第663行)的display
属性更改为display:block
。我在我的Chrome web inspector中闲逛,让它以这种方式工作。将float
设置为float:none
也无妨。您需要将\topdiv1
(第663行)的display
属性更改为display:block
。我在我的Chrome web inspector中闲逛,让它以这种方式工作。将float
设置为float:none
也无妨。只需删除此样式即可
#header {
text-align: center;
}
在仅介质屏幕宽度767中放置了第428行内联线,只需删除此样式即可
#header {
text-align: center;
}
在仅介质屏幕宽度767中放置第428行内联线,请尝试以下操作:
<style>
.container {
margin-left: auto;
margin-right: auto;
/* To see the affect of the above; not part of centering implementation. */
background-color: #aaa;
width: 200px;
}
</style>
<div class="container">
Hello, world!
</div>
.集装箱{
左边距:自动;
右边距:自动;
/*查看上述影响;不是定心实施的一部分*/
背景色:#aaa;
宽度:200px;
}
你好,世界!
尝试以下方法:
<style>
.container {
margin-left: auto;
margin-right: auto;
/* To see the affect of the above; not part of centering implementation. */
background-color: #aaa;
width: 200px;
}
</style>
<div class="container">
Hello, world!
</div>
.集装箱{
左边距:自动;
右边距:自动;
/*查看上述影响;不是定心实施的一部分*/
背景色:#aaa;
宽度:200px;
}
你好,世界!
获取div.#topdiv3
并删除float:left
并添加margin left:auto;右边距:自动
。然后将div.#topdiv3
移出div.#outter包装
取div.#topdiv3
并删除浮动:左
并添加左边距:自动;右边距:自动
。然后将div.#topdiv3
移出div.#outter包装
我刚看到你的代码我发现我不太了解css它只是在浏览器的inspect元素中点击并尝试而已我刚看到你的代码我发现我不太了解css它只是在浏览器的inspect元素中点击并尝试而已