HTML. Setting width and height of the table. | Sololearn: Learn to code for FREE!
+ 2

HTML. Setting width and height of the table.

Colleagues, how can I set width and height of each cell of the table? I‚Äôve tried different ways: 1. <table width=‚Äú20‚ÄĚ> <tr> <td>text</td> <td>text</td> <td>text</td> </tr> </table> and 2. <table> <tr width=‚Äú20‚ÄĚ> <td>text</td> <td>text</td> <td>text</td> </tr> </table> 3. <table> <tr> <td width=‚Äú20‚ÄĚ>text</td> <td>text</td> <td>text</td> </tr> </table> But this argument (width=‚ÄĚ...‚ÄĚ) doesn‚Äôt work. Other arguments (bgcolor, href) work correctly. I haven‚Äôt find any information in forum. Please help!

4th Mar 2021, 10:26 PM
–†–ĺ–ľ–į–Ĺ –†—É–Ī—Ü–ĺ–≤
13 Réponses
+ 4
–†–ĺ–ľ–į–Ĺ –†—É–Ī—Ü–ĺ–≤ using width="20" Works fine , 20 is 20px . try something like % or 200
4th Mar 2021, 11:11 PM
Abhay
Abhay - avatar
+ 3
did you try this one? <table style="width:100%"></table>
4th Mar 2021, 11:06 PM
Mohammad Alomari
Mohammad Alomari - avatar
+ 3
Without any unit "20" is considered as 20px , and 20 px is a lot less to see any effect , so try using a big value or % of parent width .
4th Mar 2021, 11:23 PM
Abhay
Abhay - avatar
+ 3
–†–ĺ–ľ–į–Ĺ –†—É–Ī—Ü–ĺ–≤ In your table tag you misspelled width as widft Try this and you will see a change (only change this line then look at result) <table style="width:100%" align="center" border="2">
5th Mar 2021, 6:17 AM
Paul K Sadler
Paul K Sadler - avatar
+ 2
characters ‚Äú ‚ÄĚ don't work , use these double quotes , " "
4th Mar 2021, 10:31 PM
Abhay
Abhay - avatar
+ 2
<table style="widfh:20%" align="center" border="2"> <tr style="width:20px"> <td bgcolor="green">–ü–Ķ—Ä–≤—č–Ļ</td> <td bgcolor="yellow">–í—ā–ĺ—Ä–ĺ–Ļ</td> <td bgcolor="turquoise">–Ę—Ä–Ķ—ā–ł–Ļ</td> </tr> <tr> <td> <a href="https://www.sololearn.com/Course/HTML/?ref=app">HTML</a></td> <td> <a href="https://www.sololearn.com/Course/CSS/?ref=app">CSS</a></td> <td> <a href="https://www.sololearn.com/Course/JavaScript/?ref=app">JavaScript</a></td> </tr> </table> It doesn,t work still. All the other arguments work but neither (width) nor (style) work. Colleags, have you any other ideas - what‚Äôs wrong with them?
5th Mar 2021, 1:35 AM
–†–ĺ–ľ–į–Ĺ –†—É–Ī—Ü–ĺ–≤
+ 2
Thank you, guis! Your help is invaluable! I corrected mistake and used ‚Äúbig value‚ÄĚ. Now everything works just as it should!
5th Mar 2021, 2:45 PM
–†–ĺ–ľ–į–Ĺ –†—É–Ī—Ü–ĺ–≤
+ 2
"Guys‚ÄĚ - of course. I should to make my English better too. ))
5th Mar 2021, 2:47 PM
–†–ĺ–ľ–į–Ĺ –†—É–Ī—Ü–ĺ–≤
+ 1
Thanks! I know it. Theese characters “ “ I’ve used just for writing message. In my code correct ones. The qwestion remains. Need your help!
4th Mar 2021, 10:57 PM
–†–ĺ–ľ–į–Ĺ –†—É–Ī—Ü–ĺ–≤
+ 1
Mohammad Alomary, I haven’t tried to use this argument. Thanks for information!
4th Mar 2021, 11:18 PM
–†–ĺ–ľ–į–Ĺ –†—É–Ī—Ü–ĺ–≤
+ 1
You'r welcome but did it work??
4th Mar 2021, 11:19 PM
Mohammad Alomari
Mohammad Alomari - avatar
+ 1
Abhay, I‚Äôve tried %, but not ‚Äúpx‚ÄĚ. I‚Äôll use advice. Thank you!
4th Mar 2021, 11:21 PM
–†–ĺ–ľ–į–Ĺ –†—É–Ī—Ü–ĺ–≤
+ 1
Use % after the value
6th Mar 2021, 4:21 PM
Amal C.k
Amal C.k - avatar