我不确定这里的问题是什么,但是在这个元素内部左侧有一些死区,它不响应我做的任何事情。我想将文本居中在元素中(并且是居中,只有左边有一些似乎没有被考虑的空白空间)。这是一张图片:
您可以看到左侧的填充比右侧的填充大得多。我尝试手动设置padding-left
,但这不起作用。
这是页面中的元素(我正在使用rails):
<div class="holder round clear eval_body">
...
<div class="box center">
Before continuing to the next student,
<br />please take a moment to review the scores for <%= @student.name %>.
<br />
<span class='strong'>
Once you have submitted them, they cannot be changed!
</span>
</div>
...
</div>
和box
元素
.box {
position: relative;
bottom: 3px;
left: 10em;
width: 50%;
height: 8%;
background: #B05C37;
border: 3px solid #902D00;
color: #fff;
}
答案 0 :(得分:0)
将您的css课程更改为.box center
而不是.box
答案 1 :(得分:0)
感谢您的建议(特别是techvineet)。得到它的工作:
.box {
position: absolute;
bottom: 3.5%;
right: 7%;
margin: 5px;
padding: 20px;
width: 50%;
background: #B05C37;
border: 3px solid #902D00;
color: #fff;
}
答案 2 :(得分:0)
添加
text-align: center;
到CSS中的.box。