+ 4

Why isn't the width changed with in my css

Created a webpage with labels and to improve the look of the page I want the labels to be of fixed width. I place d this in the CSS file but it didn't work. The CSS I used was this label { width: 200px;} Please help https://code.sololearn.com/WlSgVu8z84IN/?ref=app

6th Sep 2023, 9:46 AM
Gray Adamson
Gray Adamson - avatar
8 Answers
+ 4
Thank you, Jan Markus . I initially found your response a bit confusing after I posted mine. However, upon revisiting Gray Adamson's code with fresh eyes, I realized their intention was to generate tables rather than create a single table. Now I understand the context better. In hindsight, I believe my initial statement could have been helpful for the next steps in building the table. Unfortunately, I deleted my post without realizing its potential usefulness. Anyway, I agree with your suggestion that using Flexbox or Grid layout would be a good choice for styling their page.
7th Sep 2023, 6:11 PM
Chris Coder
Chris Coder - avatar
6th Sep 2023, 4:45 PM
Jan Markus
+ 3
Gray Adamson Sorry about that, to avoid diverting attention from your post, if you still require assistance with your project, please don't hesitate to reach out, and I'll be more than happy to offer a more comprehensive answer than my previous one!
7th Sep 2023, 6:12 PM
Chris Coder
Chris Coder - avatar
+ 2
Jan Markus You are correct I've read that too. I wouldn't use a table to lay out an entire webpage.  HTML tables should be used for tabular data — this is what they are designed for.
6th Sep 2023, 9:04 PM
Chris Coder
Chris Coder - avatar
+ 1
Chris Coder Yes, and the table tag should be seen as a semantic element like header, footer, article or aside.
6th Sep 2023, 9:32 PM
Jan Markus
0
Try adding the CSS code display:inline-block; on the label Since the label element is an inline element by default, it will not take up more width even if you specify it's wdith.
6th Sep 2023, 2:32 PM
Lost Silverfish
Lost Silverfish - avatar
0
It looks fine I guess
6th Sep 2023, 5:02 PM
Lost Silverfish
Lost Silverfish - avatar
0
Chris Coder I read somewhere that today a page layout shouldn't be done with html tables. In the past, and I speak about the late 1990s, it was widely common to use tables for layout because CSS was still in its infancy back then. Today Flexbox or Grid Layout are the most important tools of choice.
6th Sep 2023, 8:53 PM
Jan Markus