2

I have tried this but got only blank spane without underline

    <h:outputText style="font-weight:bold;text-decoration:underline" rendered="#
{declarationBB.deaclarationOpr.declarationDetailsobj.productName == null}" value="                           " /> 
happy
  • 2,550
  • 17
  • 64
  • 109
  • It works for me. Are you sure the component is rendering? You should replace `rendered="# {declarationBB.deaclarationOpr.declarationDetailsobj.productName == null}"` by `rendered="# {empty declarationBB.deaclarationOpr.declarationDetailsobj.productName}"` – Aritz Jan 11 '13 at 09:38
  • Which browser are you trying with? – Aritz Jan 11 '13 at 09:40
  • @XtremeBiker Browser is Internet Explorer and I tried even your code but I get just blank space but no blank line. – happy Jan 11 '13 at 10:27
  • I mean, you're sure that is an styling problem, I suposse you have the same result if you remove the `rendered` attribute? – Aritz Jan 11 '13 at 10:54
  • As this site references, there can be problems with some old IE versions http://reference.sitepoint.com/css/text-decoration – Aritz Jan 11 '13 at 10:56
  • use underscores instead of spaces. – prageeth Jan 11 '13 at 10:58

1 Answers1

1

Nonsignificant whitespace in HTML will be collapsed. You effectively end up with no visual representation unless you insert non-whitespace characters in the beginning and the end like so:

value="[                           ]"

If all you want is a line of a fixed size, rather use a bunch of underscores:

__________________________

Or, if you really want to use HTML/CSS for this, use a block element of a fixed width and border bottom:

<div style="width: 200px; border-bottom: 1px solid black;"></div>

A <hr> is however semantically more correct if all you actually want is a "horizontal rule":

<hr style="margin: 0; width: 200px; height: 1px; background: black; border: none;" />

Noted should be that you should avoid using style as much as possible and use class/styleClass instead.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555