好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

怎么让下面html代码中的p标签右对齐

怎么让下面html代码中的p标签右对齐

<html xmlns="http://HdhCmsTestw3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
#t1{ background-color:#f8f8f8;
border-bottom:1px solid #e6e6e6;
height:24px;

}
#t1 p{ width:900px;
margin:0px auto;
padding-top:5px;
float:right;
font-size:12px;
}
#t1 p a{text-decoration:none;color:#738197;}
</style>
</head>

<body>

<div id="t1"><p style="color:#0CC">
<a href="http://pc.qq测试数据/">苹果</a> · 
<a href="http://HdhCmsTestqq测试数据/">鸭梨</a> · 
<a href="http://im.qq测试数据/">鸡蛋</a> ·
<a href="http://im.qq测试数据/mobileqq/">白菜
</a>
</p>
</div>
</body>
</html> 

居中的宽度是900px

#t1 p{  
        width:900px;
        margin:0px auto;
        padding-top:5px;
        font-size:12px;
    overflow:hidden;
    text-align:right;
 } 

去掉p标签的右浮动,改为文本对齐方式为右对齐就可以了。

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style type="text/css">
#t1{ background-color:#f8f8f8;
     border-bottom:1px solid #e6e6e6;
     height:24px;
  
}
#t1 p{   width:900px;
         margin:0px auto;
        padding-top:5px;
          float:right;
          font-size:12px;
 }
#t1 p a{text-decoration:none;color:#738197;}
</style>
<div id="t1">
<p style="color: rgb(0, 204, 204); text-align: right;">
<a href="http://pc.qq测试数据/">苹果</a> ·
<a href="http://HdhCmsTestqq测试数据/">鸭梨</a> ·
<a href="http://im.qq测试数据/">鸡蛋</a> ·
<a href="http://im.qq测试数据/mobileqq/">白菜
</a>
</p>
</div> 




以上就是怎么让下面html代码中的p标签右对齐的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于怎么让下面html代码中的p标签右对齐的详细内容...

  阅读:40次