我不确定为什么我的
从右侧显示一个空格。这是我的简单代码
<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;
}
这是截图
最佳答案
您必须设置左右边距相等:
#splash .loading { margin:0 20px; }
上面设置 20px
左边距和右边距。
或者由于您使用的是 absolute
位置,您可以使用 right
属性将其向左移动一点以满足您的需要,例如:
#splash .loading { right:10px; }
关于css - 为什么段落右侧有额外空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9408331/