2011-09-04 160 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