-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have a "news.description" label' in a template where I want the label value to wrap around across multiple lines.
<template name="newsbox" var="news" status="s">
<hlayout>
<image src="@load((s.index % 2) eq 0 ?'/image/news1.png':'/image/news2.png')" width="64px" height="64px" />
<vlayout>
<label value="@load(news.headline)" sclass="label-bold"/>
<label value="@load(news.description)" sclass="label-wrapping" multiline="true"/>
<a label="Read more...." href="@load(news.webLink)" />
</vlayout>
</hlayout>
<space orient="vertical"/>
</template>
I'm using some custom styles like...
<style>
.panel-caption-bold .z-panel-header {
font-weight: bold;
}
.label-bold {
font-weight: bold;
}
.label-wrapping .z-label {
white-space: normal;
word-break: break-all;
}
</style>
... the 'news.description' level is displaying across multiple lines but the words are not splitting so I am losing text at the end of each line.
Any suggestions?
By default a label already wraps around lines if necessary as you can see in this example, your custom styles should not be necessary, unless you have very long single words without any whitespace.
http://zkfiddle.org/sample/1ubukk8/1-breaking-label
multiline="true"
is only necessary if the label content contains manual line breaks which need to be preserved via <br>
elements.
Other styles in your page might have an effect as well, which I cannot tell from your given example.
Can you provide a static example showing your problem?
Asked: 2019-04-09 04:29:32 +0800
Seen: 9 times
Last updated: Apr 10 '19