zoukankan      html  css  js  c++  java
  • LI 标签中让文章标题左对齐,日期右对齐的方法

    希望实现标题在左对齐,日期在右对齐,当直接给日期的span加上float:right时,IE8和FF都OK,但IE6/7则会换行,下面给出一个简单有效的解决办法。

    1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
    2. <html xmlns="http://www.w3.org/1999/xhtml">   
    3. <head>  
    4.    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
    5.    <title></title>  
    6. <style>  
    7. <!--  
    8.   
    9. #mylist { 400px; list-style-type:none; margin:0; padding:0; }  
    10. #mylist li span {  
    11.         float:right;   
    12. }  
    13. -->   
    14. </style>   
    15. </head>   
    16. <body>   
    17. <ul id="mylist">  
    18.   
    19.         <li><span>2011-12-2</span>Web开发者网络(Admin10000.com)</li>  
    20.         <li><span>2011-12-2</span>Web开发者网络(Admin10000.com)</li>  
    21.         <li><span>2011-12-2</span>Web开发者网络(Admin10000.com)</li>           
    22. </ul>  
    23.   
    24. </body>   
    25. </html>   



    注意: 要把 span 写到Li标签中的最前面,这样在IE6/IE7/FF3.5之前版本中才能保证 span中日期右对齐。

  • 相关阅读:
    django+xadmin在线教育平台慕学网(一)
    django.db.migrations.exceptions.InconsistentMigrationHistory django报错
    mac系统 MySQL 8.0.11版本,安装成功,使用Navicat连接失败
    MySQL-表操作
    MySQL的数据类型
    存储引擎
    库操作
    MySQL学习目录
    初识MySQL数据库
    静态方法和类方法
  • 原文地址:https://www.cnblogs.com/gaodaoheng/p/3482928.html
Copyright © 2011-2022 走看看