Need some help with HTML5 and CSS - CSS: #body { background-color:#DF0101; } HTML5:
the problem is clear
let me show you how to write that script, then i will explain your error
first of all i recommend that you use css3, because it fits to different browsers, as for your problem here is one way of how you code it
so how would i fix this error?
yes i am typing it
ok, thanks,
ok here is the answer the error u made is
<!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> body { background: #000000; } </title> <title>Page title</title> </head> <body id="background"> </body> </html>
you did not tell your browser that you want to use style sheet or css
it is better if you use a different file for css then link it to the html file
now copy the code then save ur notepad file as html, then display it in ur browser
are u there?
this was the problem of ur code
<style type="text/css">
ah. but i didnt post the top half of my code, here moment. ill show you what i have.
sorry for the wait,
<!DOCTYPE html> <html> <head> <link rel=stylesheet href="template.css"> <title>America-Craft</title> </head> <body> <div id="backgroundcolor"> <div id="bodycolor"> <div id="navigation_container"> <div class="l-triangle-top"></div> <div class="l-triangle-bottom"></div> <div class="rectangle"> <ul id="navigation"> <li><a href="#">Home</a></li> <li><a href="#">Forums</a></li> <li><a href="#">Gallary</a></li> <li><a href="#">Donate</a></li> </ul> </div> <div class="r-triangle-top"></div> <div class="r-triangle-bottom"></div> </div> </div> </div> </body> </html>
are u sure u linked to the css, is it in the right ../dir/whatever.css
yes, my css file is called template.css
yes but are they in the same folder
would you like to see my css code? If it will help? :/ and yes they are in the same folder. side by side.
did u test it on different browsers then?
I tested it on chrome and firefox. it should be working, im not sure why it wont.
Could we change the colour of the background through html? would that work better?
ok i will test it for u, send me the css file
what error are u getting or is it not doing anything
Its just not showing up, the background remains white.
#backgroundcolor { background-color:#DF0101; } #bodycolor { left: 1%; top: 2px; position:absolute; width:97%; height:1000; background-image: linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -o-linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -moz-linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -webkit-linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -ms-linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -webkit-gradient( linear, right top, left top, color-stop(0.19, rgb(199,10,10)), color-stop(0.59, rgb(255,255,255)), color-stop(0.77, rgb(89,0,255)) ); } #navigation li { list-style: none; display: block; float: left; margin: 1em; } #navigation li a { text-shadow: 0 3px 2px rgba(0,0,0,1.0); display: block; text-decoration: none; color: #f0f0f0; font-size: 2.0em; margin: 0 .5em; } #navigation li a:hover { margin-top: 2px; } #navigation_container { margin: 0 auto; width: 1000px; } .rectangle { background: #e5592e; height: 62px; position: relative; -moz-box-shadow: 0px 0px 4px rgba(0,0,0,0.55); box-shadow: 0px 0px 4px rgba(0,0,0,0.55); -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; z-index: 500; /* the stack order: foreground */ margin: 3em 0; } .l-triangle-top { border-color: #d9542b transparent transparent; border-style:solid; border-width:50px; height:0px; width:0px; position: relative; float: left; top: 1px; left: -50px; } .l-triangle-bottom { border-color: transparent transparent #d9542b; border-style:solid; border-width:50px; height:0px; width:0px; position: relative; float: left; top: -40px; left: -150px; } .r-triangle-top { border-color: #d9542b transparent transparent; border-style:solid; border-width:50px; height:0px; width:0px; position: relative; float: right; right: -45px; top: -107px; } .r-triangle-bottom { border-color: transparent transparent #d9542b; border-style:solid; border-width:50px; height:0px; width:0px; position: relative; float: right; top: -149px; right: -145px; }
yes i can see the error now
u missed the - in background color
background-color
u called it 2 different names between css and html5
that's why it is undefined to the browser
we all fall in that error, it easy to make such mistakes
I dont see what your pointing at, where am i missing a dash?
if your refering to the div name, it shouldnt matter, div is a class or group thing, just stateing the name. they match on both sides :/
wait i will fix it for u
Ill be back shortly, :)
figure it out yet?
ok yes
nothing wrong with ur code
just need to add those two lines to ur body-color css file
display:block; overflow:hidden;
it worked for me
those browsers guy have to come to a solution
it didnt work for me :/
my css is now :
#background-color { background-color:#DF0101; display:block; overflow:hidden; } #bodycolor { left: 1%; top: 2px; position:absolute; width:97%; height:1000; background-image: linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -o-linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -moz-linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -webkit-linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -ms-linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -webkit-gradient( linear, right top, left top, color-stop(0.19, rgb(199,10,10)), color-stop(0.59, rgb(255,255,255)), color-stop(0.77, rgb(89,0,255)) ); } #navigation li { list-style: none; display: block; float: left; margin: 1em; } #navigation li a { text-shadow: 0 3px 2px rgba(0,0,0,1.0); display: block; text-decoration: none; color: #f0f0f0; font-size: 2.0em; margin: 0 .5em; } #navigation li a:hover { margin-top: 2px; } #navigation_container { margin: 0 auto; width: 1000px; } .rectangle { background: #e5592e; height: 62px; position: relative; -moz-box-shadow: 0px 0px 4px rgba(0,0,0,0.55); box-shadow: 0px 0px 4px rgba(0,0,0,0.55); -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; z-index: 500; /* the stack order: foreground */ margin: 3em 0; } .l-triangle-top { border-color: #d9542b transparent transparent; border-style:solid; border-width:50px; height:0px; width:0px; position: relative; float: left; top: 1px; left: -50px; } .l-triangle-bottom { border-color: transparent transparent #d9542b; border-style:solid; border-width:50px; height:0px; width:0px; position: relative; float: left; top: -40px; left: -150px; } .r-triangle-top { border-color: #d9542b transparent transparent; border-style:solid; border-width:50px; height:0px; width:0px; position: relative; float: right; right: -45px; top: -107px; } .r-triangle-bottom { border-color: transparent transparent #d9542b; border-style:solid; border-width:50px; height:0px; width:0px; position: relative; float: right; top: -149px; right: -145px; }
and it still doesnt work for me :/
wait, why in my body-color div?
# not div, sorry
ok so i added it to my body-color, still doesnt work :/
#background-color { background-color:#DF0101; } #bodycolor { left: 1%; top: 2px; position:absolute; width:97%; height:1000; display:block; overflow:hidden; background-image: linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -o-linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -moz-linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -webkit-linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -ms-linear-gradient(right , rgb(199,10,10) 19%, rgb(255,255,255) 59%, rgb(89,0,255) 77%); background-image: -webkit-gradient( linear, right top, left top, color-stop(0.19, rgb(199,10,10)), color-stop(0.59, rgb(255,255,255)), color-stop(0.77, rgb(89,0,255)) ); } #navigation li { list-style: none; display: block; float: left; margin: 1em; } #navigation li a { text-shadow: 0 3px 2px rgba(0,0,0,1.0); display: block; text-decoration: none; color: #f0f0f0; font-size: 2.0em; margin: 0 .5em; } #navigation li a:hover { margin-top: 2px; } #navigation_container { margin: 0 auto; width: 1000px; } .rectangle { background: #e5592e; height: 62px; position: relative; -moz-box-shadow: 0px 0px 4px rgba(0,0,0,0.55); box-shadow: 0px 0px 4px rgba(0,0,0,0.55); -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; z-index: 500; /* the stack order: foreground */ margin: 3em 0; } .l-triangle-top { border-color: #d9542b transparent transparent; border-style:solid; border-width:50px; height:0px; width:0px; position: relative; float: left; top: 1px; left: -50px; } .l-triangle-bottom { border-color: transparent transparent #d9542b; border-style:solid; border-width:50px; height:0px; width:0px; position: relative; float: left; top: -40px; left: -150px; } .r-triangle-top { border-color: #d9542b transparent transparent; border-style:solid; border-width:50px; height:0px; width:0px; position: relative; float: right; right: -45px; top: -107px; } .r-triangle-bottom { border-color: transparent transparent #d9542b; border-style:solid; border-width:50px; height:0px; width:0px; position: relative; float: right; top: -149px; right: -145px; }
ok i will make it work on your system
I am running Ubuntu 12.10. I should be working, i dont understand.
yes i will leave the answer for u then u can see it
u can see it in the morning or whenever
ok sweet thanks
thanks for your effort, even if you dont get it after. thanks. you deserve the medal.
no i don't like to fail i will have to make this work
this should 100% work
body { background-color:#df0101; text-align:center; color:#fff; } #container { width:1000px; height:100%; margin:0 auto; text-align:left; padding:0 2px; }
<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="css.css"> <title>America-Craft</title> </head> <body> <div id="container"> <p>Lorem Ipsum...</p> </div> </body> </html>
when i see u, i will tell u why?
ok, so, im back, can you explain what you changed? and why?
It worked :D ! Finally ! So, does it automatically pick up the body in css without making a div?
Join our real-time social learning platform and learn together with your friends!