2011-09-04 139 views
2

我有一个问题,ie 7和嵌套列表 - 这看起来怪异变形。 这是截图嵌套列表ie7

HTML(Django的模板)

{% for category in category_list %} 
     <ul class='cat_post_container'> 
     <li class='cat_name' > 
      <a href="{{ category.get_absolute_url }}">{{ category }}</a> 
     </li> 
     <ul>        
      {% for post in category.postpages_set.all %} 

       <a class='post_name' href="{{ post.get_absolute_url }}"> 
        <li class='post_name'> 
         {{ post.title }} 
        </li> 
       </a>      

      {% endfor %} 
      {% for repost in category.redirectpost_set.all %} 
       <a class='post_name' href="{{ repost.redirect_url }}"> 
        <li class='post_name'> 
         {{ repost.title }} 
        </li> 
       </a> 
      {% endfor %} 
     </ul> 
     </ul>              
    {% endfor %} 

CSS

.cat_post_container { 
    border-bottom: groove 2px rgba(52, 90, 113, .3); 
} 

.cat_name { 
    line-height: 40px; 
    height: 40px; 
    margin-top: 15px; 
} 

.post_name { 
    text-decoration: none; 
    width: 100%; 
    height: 30px; 
    line-height: 30px; 
    border-top: groove 2px rgba(52, 90, 113, .3); 
    color: #FFED93; 
} 

.post_name a { 
    text-decoration: none; 
    color: #FFED93; 
    position: relative; 
} 

如何处理此问题?如何使其表现正常?

回答

2

移动内部ulli因为现在你还没有有效的HTML

大概是这样的(有没有机会检查一下):

{% for category in category_list %} 
    <ul class='cat_post_container'> 
     <li class='cat_name' > 
      <a href="{{ category.get_absolute_url }}">{{ category }}</a> 
      <ul>        
      {% for post in category.postpages_set.all %} 
       <li class='post_name'> 
        <a class='post_name' href="{{ post.get_absolute_url }}"> 
         {{ post.title }} 
        </a> 
       </li> 
      {% endfor %} 
      {% for repost in category.redirectpost_set.all %} 
       <li class='post_name'> 
        <a class='post_name' href="{{ repost.redirect_url }}"> 
         {{ repost.title }} 
        </a> 
       </li> 
      {% endfor %} 
      </ul> 
     </li> 
    </ul>              
{% endfor %} 
+0

谢谢你,乡下人!你让我走向正确的道路。我为类别名称添加了一个li标签,为嵌套的ul添加了另一个li标签,这很好用。 – I159