How to remove the side spaces of background color on text | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to remove the side spaces of background color on text

When using a background color for text or a div, how can i make it cover the whole horizontal line, without the right and left margin having white space

7th Sep 2019, 12:35 PM
Andrew Okiemute
Andrew Okiemute - avatar
5 Answers
+ 3
I would do it as its been suggested. You could put margin:0; into your body and width:100vw; into your .list
7th Sep 2019, 7:41 PM
CodeX
CodeX - avatar
+ 7
You may have to remove the margins from the body: body { margin: 0; } Or maybe you should try getting rid of some extra paddings on your element by using . Class-name { Padding: 0; }
7th Sep 2019, 2:00 PM
Oma
Oma - avatar
+ 4
It's not possible to answer perfectly without watching your code. But try using width :100vw; margin:0 It depends on many other elements on page if something is oversized you'll keep getting white margins + paddidngs and borders also affect apperance so use them properly. you better show code
7th Sep 2019, 1:03 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
Thanks a lot guys, this was completely helpful
7th Sep 2019, 8:06 PM
Andrew Okiemute
Andrew Okiemute - avatar
0
https://code.sololearn.com/WtM1nEXNzRrp/?ref=app This is the stuff i'm working on, im five days into html and css, i tried making the margin 0 as you guys recommended, and the left space disappeared, but the right is still there. Please help guys. Secondly, when i try adding a text after my edited lists, be it in form of paragraph, h1 etc it automatically turns into a link. Please im i getting it all wrong? Thanks for the feed backs. You guys rock
7th Sep 2019, 4:44 PM
Andrew Okiemute
Andrew Okiemute - avatar