gpt4 book ai didi

css - 为什么段落右侧有额外空间?

转载 作者:行者123 更新时间:2023-11-28 14:11:37 25 4
gpt4 key购买 nike

我不确定为什么我的

从右侧显示一个空格。这是我的简单代码

<body>
<div data-role="page" id="splash">

<div data-role="content">
<p class="loading">loading...</p>
</div><!-- /content -->

</div><!-- /page -->

</body>

CSS

#splash {
background: #9d0104 url(../images/logo.png) no-repeat center 30%;
background-size: 182px;
}
#splash .loading {
text-align: center;
color: #fff;
width: 100%;
position: absolute;
top: 75%;
background: #ff0000 url(../images/loading.png) no-repeat center top;
padding-top: 20px;
}

这是截图 enter image description here

最佳答案

您必须设置左右边距相等:

#splash .loading { margin:0 20px; }

上面设置 20px 左边距和右边距。

或者由于您使用的是 absolute 位置,您可以使用 right 属性将其向左移动一点以满足您的需要,例如:

#splash .loading { right:10px; }

关于css - 为什么段落右侧有额外空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9408331/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com