2012/1/2 Knut Aksel Røysland <[email protected]>

>
> I am using Chameleon and "tal:repeat" to generate a series of <li>
> elements having CSS style "display: inline-block;" to generate a
> thumbnail gallery. I have been using <table> for this purpose before,
> but got inspired by "images.google.com" using <li> elements with
> "inline-block" styling. That way, my application does not have to keep
> track of table rows, but merely sets the <li> element width to e.g.
> 25% to get four thumbnails per row.
>
> This has led me into an issue with Chameleon always generating at
> least one newline character between each <li> element repetition.
> Under "inline-block"-styling, this newline is significant white-space,
> leading to unintentional horizontal space between two neighbouring
> <li> elements.
>
> I have not been able to avoid this white-space, and it might seem
> impossible with the current implementation because in "src/chameleon/
> zpt/program.py" on line 168, the expression leads to the variable
> "whitespace" always containing at least a newline.
>
> I am looking for ways of working around this issue, as well as to
> suggest this to be taken into consideration for an upstream Chameleon
> enhancement. I would be happy if any white-space (including newlines)
> generated between two repeated elements, was always equal to any white-
> space (including newlines) preceding the same element in the template
> code, but I am not into whether this is going to break compliance with
> ZPT.


A possible CSS workaround, that should work in "most browsers", is to set
'font-size' and 'line-height' to 0 on the containing <ul> element.

ul {
  font-size: 0;
  line-height: 0;
}

li {
  display: inline-block;
  font-size: 12px;
}

This way, it does not matter if white space finds its way to your markup,
and it helps keep the templates readable.

-- 
Ronan Amicel

*««* Twitter overload?
*»»* Check out http://focus.io/

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to