Search code examples
htmltabular

To put text on table border as a header


I have one difficulty. I have to put text on table border as a header. For example:

--------------This Is header-----------------------

Is it possible, if anybody can provide solution on this?


Solution

  • There are multiple ways.

    You could create a table header, and set the text position: relative and move it up a bit. Though, this is not classy.

    I would use a fieldset instead, which is 100% valid. You need to give the fieldset a border instead of the table though.

    <fieldset>
        <legend>Your text</legend>
    
        <!-- table goes here -->
    </fieldset>