开发者

Trying to get this Django template code to print a newline *before* each h4 heading

I've re-done this code. If I'm understanding this template code correctly, it looks like I had some CSS in an unnecessary place (within the h3 tags, which isn't necessary). Regardless, I still need to code in the same behavior tha开发者_运维技巧t I wrote about in my earlier post. Now that I only have one loop (well, technically two) I think this might be a little easier

Create another loop to do this or is there an easier way?

Here's the code, re-done: http://paste.pocoo.org/show/300897/

Thanks, J.

  • Note: here is the CSS code for product-category class: ul.product-category li {float: left; display: inline-block;}


Your CSS is specifically removing the newline for the H4, which normally does automatically go on a line by itself. Remove that CSS definition completely and it will go on a new line all by itself.


Looks like I solved the the problem I was having. What I did was add div in the template code like this: <div class="clear_both"></div> right before the h4 heading that calls a clear:both CSS property, which sort of acts as a newline. Now I can add as many items as I'd like and they will continue to wrap around until another h4 heading is created.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜