0

how to setup a label to wrap around?

asked 2019-04-09 04:29:32 +0800

davout gravatar image davout
1435 3 18

updated 2019-04-09 17:13:14 +0800

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?

delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-04-10 18:27:09 +0800

cor3000 gravatar image cor3000
6280 2 7

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?

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2019-04-09 04:29:32 +0800

Seen: 9 times

Last updated: Apr 10 '19

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More