使用CSS将文本左右对齐在同一行

时间:2014-07-06 05:07:19

标签: html css text-align

我正在处理我的页面并遇到问题。尝试将(年份或待定)对齐到列的右侧。例如,见图像。

顶部是现在的样子。底部图像是我想要的样子。

enter image description here

网站位于http://www.eatlovepray.me/portfolio/about-me/

3 个答案:

答案 0 :(得分:7)

尝试使用span然后将样式设置为等于'float:right'

<span style="float:right">pending </span>

答案 1 :(得分:3)

<强> Demo

CSS

ul {
    list-style: none;
}
#about ul li span {
    float: right;
}

HTML

<div id="about">
     <h3><strong>Education</strong></h3>

    <ul>
        <li><strong>Golden West College – Huntington Beach, CA <span>2012-2014</span></strong>

        </li>
        <li>– Associate in Arts Degree – Digital Arts Major <span>(pending)</span>
        </li><br/>
        <li>Certificate of Achievement</li>
        <li>– Graphic Design and Production Option <span>(pending)</span>
        </li><br/>
        <li>Certificate of Specialization</li>
        <li>– Graphic Design Foundation <span>6/2014</span>
        </li>
        <li>– Graphic Design Advanced Production <span>(pending)</span>
        </li>
    </ul>
</div>

答案 2 :(得分:-1)

你去吧

<ul>
    &nbsp;&nbsp;<strong>Golden West College – Huntington Beach, CA <span style="float:right">2012-2014</span></strong><br>
&nbsp; &nbsp; – Associate in Arts Degree – Digital Arts Major <span style="float:right">(pending)</span><br>
<br>&nbsp; Certificate of Achievement<br>
&nbsp; &nbsp; – Graphic Design and Production Option <span style="float:right">(pending)</span><br>
<br>&nbsp; Certificate of Specialization<br>
&nbsp; &nbsp; – Graphic Design Foundation <span style="float:right">6/2014</span><br>
&nbsp; &nbsp; – Graphic Design Advanced Production <span style="float:right">(pending)</span><br>
</ul>

这是一个JSFiddle Click here

相关问题