+ 5

Having trouble with the Div tag

Whenever I try using the Div tag and try to color something, nothing appears in the output

21st Dec 2020, 7:05 PM
Ducky
Ducky - avatar
23 Respostas
+ 5
<!-- Here's the full code --> <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <div style="background-color: blue;"> <h1>Hello!</h1> </div> </body> </html>
21st Dec 2020, 7:18 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
+ 3
try this: <div style="background-color: blue;"></div>
21st Dec 2020, 7:09 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
+ 2
I ment like where I enter the code inside of my html tags, is it my first div line or somewhere in between?
21st Dec 2020, 7:18 PM
Ducky
Ducky - avatar
+ 2
on between the body tags, put something like h1 or p tags in <div style="background-color: blue;"></div>, then it works, volia!
21st Dec 2020, 7:23 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
+ 2
thing is this is a practically word for word recreation of what sololearn gives you to learn the div code, so idk why its not working
22nd Dec 2020, 4:09 PM
Ducky
Ducky - avatar
+ 2
You have a typing error "backround" should be "background"
22nd Dec 2020, 5:39 PM
Chris Coder
Chris Coder - avatar
+ 1
where do I enter that code? Im quite new so bare with me
21st Dec 2020, 7:13 PM
Ducky
Ducky - avatar
+ 1
Cheesy Boi between body tags
21st Dec 2020, 7:16 PM
Abhay
Abhay - avatar
+ 1
for some reason its still not working, its fine I dont wanna waste your time. I still need to practice remembering the div strings
21st Dec 2020, 7:21 PM
Ducky
Ducky - avatar
+ 1
I tried it on Code Playground, and it works!
21st Dec 2020, 7:24 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
+ 1
Oh ok I will try it out! Thanks
21st Dec 2020, 7:26 PM
Ducky
Ducky - avatar
+ 1
here is my string im trying to work <!DOCTYPE html> <html <body> <h1>Headline</h1> <div style="backround-color:green; color:white; padding:20px;"> <p> Cheese doesent really taste good</p> <p> Heh ironic</p> </div> </body> </html>
22nd Dec 2020, 4:08 PM
Ducky
Ducky - avatar
+ 1
i blame dylexia, i promise I totally dont get Fs in english
22nd Dec 2020, 5:40 PM
Ducky
Ducky - avatar
+ 1
Cheesy Boi no you simply made a common mistake. - Happy Coding!
22nd Dec 2020, 5:45 PM
Chris Coder
Chris Coder - avatar
+ 1
I think it is supposed to be like this: <!DOCTYPE html> <html <body> <h1>Headline</h1> <div style="background-color:green;color:white;padding:20px;"> <p> Cheese doesent really taste good</p> <p> Heh ironic</p> </div> </body> </html> DON'T space the letters that are in the "style" attribute.
23rd Dec 2020, 4:25 AM
:DD
:DD - avatar
0
On code playground there is a separate tab to enter your css if you want.
21st Dec 2020, 9:26 PM
Sonic
Sonic - avatar
0
Share your code example.
22nd Dec 2020, 10:19 AM
Chris Coder
Chris Coder - avatar
0
oh im dumb
22nd Dec 2020, 5:40 PM
Ducky
Ducky - avatar
0
hey I figured it out but thanks anyways
23rd Dec 2020, 4:26 AM
Ducky
Ducky - avatar
0
Hi
23rd Dec 2020, 11:57 AM
Amit Kumar
Amit Kumar - avatar