


If I was needing this table, and knowing what I know now after all the methods I went through. It could also be done with CSS and a bundle of added HTML elements, but I don’t want to go there. Positioning the red line could be done with a little JS that monitors the height of the cells and transfers that height to the red line. Using eigher of these techniques, the height of the header cells cannot be allowed to change - contents cannot un/wrap.Ĭontent:"COMMANDER DATA REPORTING FOR DUTY, SIR"
Use display: block and margin: 0 auto, or a negative margin of half the element width, or if you can use calc() use left: calc(50 -The result will be satisfactory at different font sizes. Please dont make a wrapper where you dont need to. One could set top: a fixed em distance from the top (as shown here). Max-width:94em /* as desired, possibly unnecessary - depends on page design */ Is there a clever way maybe to position a line under the thead thats not actually part of the table body or equivalent. The table rows are using different bootstrap classes to style it e.g. The initial table look is as follows: See online demo and code. The table contains five rows initially that are displayed. In the following example, an HTML table is created with the Bootstrap framework. If I could but margins on the cells I think it would be easy A CSS visibility and display example with HTML table. ‘left: 50’ is a very important element when using absolute position. I realized you made the graphic centered by ‘left: 50’ and then using my container width I divided by 2 and altered the measurements to get a perfect fit ).
Div display table cell margin how to#
I’m sure there must be a better way but I’m stuck how I should do it. To center a table inside a div, you must either add the attribute align'center' to your table, or add margin auto via CSS as tables already have the width attribute set to auto by default. I was trying to figure out how to place a graphic using absolute position on a centered body container. I have done it in my example by positioning a 20px width div above and below the line. display: table- options are supported in any recent browser, and from IE8 onwards.
When scrolling left/right I need the table to go under the margin Ideally we strive to separate semantic mark-up and presentation, so