我正在尝试创建一个问答平台,但我在对齐所有段落时遇到了困难。如果我设置相对定位,文本开始与它左侧的内容重叠。如果我将它设置为绝对,高度不会调整,它开始与下一段重叠。我该如何解决这个问题?
这是我的代码:
<div class="question">
{% if the_question %}
<ul>
{% for question in the_question %}
<li>
<div class="votecounter"><div class="numbercount">15</div> Votes</div>
<div class="votearrowdiv">
<a href="#"><div class="upvotearrow"></div></a>
<a href="#"><div class="downvotearrow"></div></a>
</div>
<a href="/home/{{ movie.id }}/{{ question.id }}/">{{ question.question_text }}</a>
</li>
{% endfor %}
</ul>
{% else %}
No questions have been asked.
{% endif %}
</div>
</div>
.questionvotecontainer{
position:absolute;
border:0px solid purple;
text-align:left;
left:5;
float:left;
display:inline-block;
width:100%;
margin-top:14px;
margin-bottom:4px;
min-width:840;
}
.votecounter{
width:8%;
height:50px;
border:0px solid yellow;
text-align:center;
position:relative;
display:inline-block;
float:left;
font-size:12px;
}
.votearrowdiv{
position:relative;
float:left;
width:4%;
min-height:20px;
border:0px solid gray;
display:inline-block;
min-width:50px;
}
.question{
text-align:left;
width:83%;
height:auto;
display:inline-block;
border:0px solid green;
font-size:18px;
font-weight:bold;
font-family:'Source Sans Pro', sans-serif; font-weight:300;
margin-left:-10px;
padding-bottom:20px;
float:left;
overflow:scroll
min-width:10px;
}
.questionHover{
background-color:#111111;
}
.question ul li{
list-style-type:none;
padding-bottom:10px;
padding-top:2px;
border:1px solid yellow;
width:120%;
min-height:30px;
margin-left:-20px;
overflow:visible;
}
.upvotearrow{
border-bottom:14px solid white;
border-left:14px solid transparent;
border-right:14px solid transparent;
display:inline-block;
margin-top:5px;
position:absolute;
top:0px;
z-index:50;
}
.downvotearrow{
width:0px;
height:0px;
border-top:14px solid #969696;
border-left:14px solid transparent;
border-right:14px solid transparent;
display:inline-block;
position:absolute;
margin-top:26px;
z-index:50;
}
.numbercount{
font-size:24px;
font-weight:bold;
}
.actualQuestion{
margin-left:40px;
position:relative;
}
提前致谢!