View Single Post
Old 06-18-2021, 10:57 AM   #2
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,292
Karma: 20171067
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
That's almost exactly what I use. Although, I tighten up the css a little, but that is just technique, not at all required.

Code:
table { 
        max-width: 95%;
        border-collapse: collapse;
        margin: 1em auto;
    }
tbody  td {
        border: 1px solid black;
        padding: 5px;
        text-align:center
    }
tbody  td:first-child {
        text-align: right
    }
I usually format headers and footers differently than the body, so I use the "tbody td", "thead th", and "tfoot td" individually.

I have seen css using "id" tags to define something specific...especially if it is used with js, but I haven't figured out if there is a point to it just to say that it is a tag... (especially since the IDs need to be unique). eg. <table id="table">

...same concept as people using classes (<p class="para">, <blockquote class="block">, etc.). Just define the base tag, then use a class or ID for a specific deviation from the default.

If there IS a reason, I would be interested in knowing.

You will also hear that tables should only be used when you absolutely MUST... and anything larger than 2-3 columns should be re-thought as it really messes up the display on smaller screen sizes; large tables usually do better as an image.
Turtle91 is offline   Reply With Quote