Search code examples
jsfjakarta-eerichfacesjsf-1.2

Blank underlined line in jsf in h:outputText


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="                           " /> 

Solution

  • 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.