+ 3

Question on linear gradient CSS

1)Why is my linear gradient extending to the whole screen vertically? I have mentioned the body height as 100px, but it's extending to the whole screen. 2) Why is that little scroll present? (Am using Android phone) I've defined the width to be 100% but it's extending a little farther than 100%, I don't know why, and how to prevent it? 3) If I change the "90deg" to "left", it's not working, why? I learnt all these from the lesson https://www.sololearn.com/learning/2242/ Thank you very much for any help :) https://code.sololearn.com/W77vb3weG69I/?ref=app

18th Dec 2021, 2:41 AM
Rishi
Rishi - avatar
8 Answers
+ 3
1. It isn't. In fact, the html element inherits some body attributes - yes, the opposite we'd expect. Try setting a fixed background color to the html element, like "black", and it becomes clear. 2. width and height apply to the content part of any element. But there's still padding, border and margin, which take additional space, causing overflow. Try setting all of them to 0px.
18th Dec 2021, 3:52 AM
Emerson Prado
Emerson Prado - avatar
18th Dec 2021, 3:21 AM
Kelvin Paul
Kelvin Paul - avatar
+ 2
3. The syntax is "to left", not just "left".
18th Dec 2021, 4:01 AM
Emerson Prado
Emerson Prado - avatar
+ 2
Set margin: 0; inside the body class. This will work. And prefer using it everytime. I myself use it too.
20th Dec 2021, 7:08 AM
I.K.I.A.T.L
+ 1
1) make a div and give it relevant height and width... 2) to hide the scrollbar you can do two things: make the body margin to 0px and padding 0px (i would prefer this everytime in css). Or giving webkit scrollar to 0px. *(the second way is the best) **(Search in google for hiding the scrollbar...if you will be unable to find I will attach the link later) 3) learn the linear gradients from google.or from the CSS course (search it too, will attach the links if you be unable)
18th Dec 2021, 4:05 AM
NEZ
NEZ - avatar
18th Dec 2021, 7:00 AM
Zubae
Zubae - avatar
+ 1
Try using background-repeat: no-repeat property This simply hides the repeating linear-gradient
19th Dec 2021, 8:47 AM
Beautiful Decor
0
Thank you Do you know how to use the overflow property
20th Dec 2021, 4:22 PM
Beautiful Decor