将相对内联块与非相对内联块垂直对齐

时间:2015-03-11 17:50:14

标签: html css

我有一个问题是将相对内联块与同一行中不相对的几个内联块对齐。图为清晰起见: enter image description here

我尝试了一些事情(padding-top,margin-top)让这个人有点向下移动,但没有成功。

Relavant HTML:

     <div class="course-item" ng-repeat="course in courses">
         <div class="course-title" ng-click="launchCourse(course.id)">{{course.title}}</div>
         <div class="course-grade" ng-click="launchGradebook(course.id)"><div class="course-grade-pop">{{course.grade}}</div></div>
         <div class="course-atten">{{course.attendance}}</div> <br />
     </div>

相关CSS:

.course-item
{
    margin-top: 15px;
    font-size: 14pt;
    line-height: 40px;
}
.course-title
{
    display: inline-block;
    cursor: pointer;
    text-align: left;
    text-overflow: ellipsis;
    width: 60%;
    background-color: #EEE;
    border-radius: 4px;
    padding-left: 6px;
}
.course-grade
{
    position:relative;
    display: inline-block;
    cursor: pointer;
    text-align: center;
    font-size: 15pt;
    width: 18%;
    height: 40px;
    padding-top: 10px;
    background-color: #EEE;
    border-radius: 4px;
    margin-left: 2%;
}
.course-atten
{
    display: inline-block;
    text-align: center;
    font-size: 15pt;
    width: 18%;
    background-color: #EEE;
    border-radius: 4px;
    margin-left: 2%;
}
.course-grade-pop
{
    position: absolute;
    top: 0px;
    left: 0px;
    height: 100%;
    width: 100%;
    border-radius: 4px;
}

如何让街区与其他街区坐在同一条线上?

1 个答案:

答案 0 :(得分:1)

您只需将vertical-align:bottom添加到.course-grade

即可解决此问题