Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why TDs display within a TR displays in the same line?

Tags:

css

html-table

TD is a block element,

but displays like inline,say,several TDs within a TR display in the same line,

why?

like image 760
omg Avatar asked Dec 29 '25 00:12

omg


2 Answers

TD's are actually not technically "block" elements. Have a look at the CSS display property. Cells are technically of type "table-cell" and they are a special case.

There is also another type of display called "inline-block" which can be useful.

like image 186
Matt Bridges Avatar answered Dec 30 '25 15:12

Matt Bridges


Because they are for tabular data.

like image 30
Sampson Avatar answered Dec 30 '25 15:12

Sampson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!