I am converting a table with tbody, tr, and td to div with css styling. Before the changes, I have a table with 3 columns which each contains a react js component.
All columns are aligned next to each other but the columns are not fixed width. On initial page loading, a component may have a smaller width while another column control has a larger width. The div column will not look equal width dispite their content.
How do I make the css styling of a display: table-cell a fixed width?
I am not using react js, so I would use plain HTML to display how to make the width working.
I suggest you set the "width" property in style instead of directly using "width" as an attribute. It is not a valid attribute for div element in XHTML5.
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Divs don’t support a width attribute, you must use style. Also if you do not specify an overflow behavior, the the content will push the width. Also percent widths only work, if the parent has a width. If you are setting min, and the the same, just use
width.
use the browsers css debugger to determine your issue.
Member
46 Points
283 Posts
HTML Converting Table tr tb to div and css. How to fix width for div td
Apr 08, 2020 01:58 PM|comicrage|LINK
I am converting a table with tbody, tr, and td to div with css styling. Before the changes, I have a table with 3 columns which each contains a react js component.
All columns are aligned next to each other but the columns are not fixed width. On initial page loading, a component may have a smaller width while another column control has a larger width. The div column will not look equal width dispite their content. How do I make the css styling of a display: table-cell a fixed width?
y help is appreciated
CSS:
JSX:
Contributor
2900 Points
855 Posts
Re: HTML Converting Table tr tb to div and css. How to fix width for div td
Apr 09, 2020 02:59 AM|Sean Fang|LINK
Hi comicrage,
I am not using react js, so I would use plain HTML to display how to make the width working.
I suggest you set the "width" property in style instead of directly using "width" as an attribute. It is not a valid attribute for div element in XHTML5.
Comparison:
Hope this can help you.
Best regards,
Sean
All-Star
58254 Points
15678 Posts
Re: HTML Converting Table tr tb to div and css. How to fix width for div td
Apr 18, 2020 01:15 AM|bruce (sqlwork.com)|LINK
Divs don’t support a width attribute, you must use style. Also if you do not specify an overflow behavior, the the content will push the width. Also percent widths only work, if the parent has a width. If you are setting min, and the the same, just use width.
use the browsers css debugger to determine your issue.