I am currently trying to learn HTML5, following smashing html5 book. they provide this code- <!DOCTYPE HTML> <html> <head> <meta http-equiv=â€Content-Type†content=â€text/html; charset=UTF-8â€> <style type=â€text/cssâ€> body { background-color:#fbf7e4; font-family:Verdana, Geneva, sans-serif; margin-left:20px; color:#8e001c; } #h1 { background-color:#8E001C; color:#e7e8d1; font-family:â€Arial Blackâ€, Gadget, sans-serif; text-align:center; } h2 { background-color:#424242; color:#d3ceaa; font-family:â€Trebuchet MSâ€, Arial, Helvetica, sans-serif; margin-left:5px; } </style> <title>CSS3-Embedded Stylesheet</title> </head> <body> <h1>This Is the Big Head</h1> <h2> Here Is the Second Head</h2> The body text is styled for a bit of a eft margin and picks up the color of the body along with its font. Notice that the background of the heads extends all the way across the page. Also notice that a space (& nbsp gives the h2 text a ittle indent so that it stays “within†the background. That’s not a problem with the h1 head because it’s centered. </body> </html> when i put it in a text editor, it does not have any styling. Anyone help me out? Alan
I believe it's a problem with the †symbol you're using - try changing them all to the ' symbol instead using find and replace. Hope that helps.
Find and replace - did not even know that was a facility within the text editor - one question and already learnt a few things! Kudos people P
W3Schools is great, but honestly they are really really looked down upon in the web development industry because of how poorly written their tutorials are. Most of them aren't exactly accurate. Check out this site to see more on this topic: w3fools [dot] com
#h1 is probably supposed to be an id selector. but there is now id in the h1 tag. also " or ' makes no difference. either one is fine.
I said the same before to remove # before h1 because it is not allowed to use names for id like selectors that's why this code did not work.
I thought w3school is as far one the best sites. But as you said it doesn't have full featured articles. So where can I find most precise ones?
i dont know iam also newly learing this html5 concepts , the easy way is to learn w3schools.com site thank u!
csslint.net lets you feed it code (paste in white box) and it will tell you whats wrong with it. also, css3generator.com is great. it shows you different types of things you can do. you can adjust it and everything. then css3generator shows you the code to what you just did. check it out, its real easy to use
OK I will be explain you every step i maked with OK Leat's make it --------------------------------------------------------- Lets remind that : -Comment on HTML written like this starts with <!-- your comment here and end with --> -Comment on CSS written like this starts with /* your comment here and end with */ <!-- ::::::Copy the code from <!DOCTYPE HTML> and paste it in any editor save it as (*.html) --> <!DOCTYPE HTML> <html> <head> <title> your title goes here</title> <!-- and every tag you must end with a splash ( / ) before the tag element --> <style type="text/css"> /* this will style your elements written in the body tag */ /* Lets style header and paragraph */ h1 { position:absolute; top:200px; left:35%; /* the position of the text */ color:green; /* color of the text you want to use */ font-family:calibri; /* the font you want to use */ font-size:20px; /the size of the font you want to use */ } p { position:absolute; top:240px; left:35%; /* the position of the text */ color:red; /* color of the text you want to use */ font-family:calibri; /* the font you want to use */ font-size:15px; /the size of the font you want to use */ } /* OR YOU CAN STYLE BOTH ELEMENT LIKE THIS :: */ /* h1,p { position:absolute; top:200px; left:35%; color:green; font-family:calibri; font-size:20px; } just remove these comment line */ </style> <!-- end of the style tag --> <body> <!-- HERE ARE ALL TH ELEMENTS YOU WANT TO USE lets use some of them --> <h1>This is the first header written in HTML language </h1> <!-- end of header tag --> <p>This is the first paragraph written in HTML language </p> <!-- end of paragraph tag --> </body> <!-- end of the body tag --> </html> <!-- end of the html tag -->