+ 4

CSS styling with nested elements

I can do everything with html, JS and PHP, but i can never get CSS to do what I want. i put spans inside of spans, and i want to give the outer span its own background and size, so the others appear inside of the elder spans. but whenever i try to give the elder spans a certain size or background, all it does is inherit all of the properties to its children. but this of course is not what I want. i took out the code thats giving me trouble and the link is found below https://code.sololearn.com/W0T3BBDJ6f24/#html does anyone know how to tame this wild and stubborn beast called CSS and get it to do what you want?

26th Feb 2018, 6:51 PM
wout werkman
wout werkman - avatar
5 Answers
+ 2
i suggest you to use div as a container instead of span ,then it will be easy for you
26th Feb 2018, 7:12 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 3
I've tried this, doesn't change the fact that it's all inherited to its children
26th Feb 2018, 7:16 PM
wout werkman
wout werkman - avatar
+ 2
wait i will send you exact what you want with span
26th Feb 2018, 7:18 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 2
Sorry, It actually works now, I feel really embarrassed, must've been one of those small and dumb mistakes. thanks allot though, your help is appreciated
26th Feb 2018, 7:19 PM
wout werkman
wout werkman - avatar
+ 1
ok well then good night
26th Feb 2018, 7:29 PM
Sudarshan Rai
Sudarshan Rai - avatar