What is my error ? | Sololearn: Learn to code for FREE!
+ 1

What is my error ?

<html> <head> <h1 {color:orange;}> a sample heading<\h1> </head> </body> <\html>

27th Mar 2017, 4:28 AM
Ram Anuj Verma
Ram Anuj Verma - avatar
5 Answers
+ 10
If you want to do inline styling (within tags), you have to use style="YOUR_STYLE" format but not {YOUR_STYLE} format.
27th Mar 2017, 4:34 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 9
Few corrections needed <html> <head> <title>In-line CSS</title> </head> <body> <h1 style="color:orange;"> a sample heading</h1> </body> </html> Compare above code with your, you would find following errors. 1. <head> tag is used for representing document properties such as title, meta and external links. You have mistakenly placed <h1> in <head> section that is not allowed. and will not be rendered properly 2. Start <body> tag is missing. 3. For applying in-line css style attribute has to be defined for respective tag, wherein each property:value set has to be separated by a semi-colon. <tag style = "prop:value;">...</tag> 4. In closing tag you have used forward slash (\) instead of backward slash (/). Nevertheless, keep practicing, all the best.
27th Mar 2017, 4:44 AM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar
+ 4
Try this code. <html> <head> </head> <body> <h1 style="color:orange;"> a sample heading<\h1> </body> <\html>
27th Mar 2017, 4:36 AM
Tanmoy Sau
Tanmoy Sau - avatar
+ 3
It's not done the way you are doing. <html> <head> <h1 style="color:orange"> a sample heading<\h1> </head> </body> <\html> Use style attribute for inline style. Use external CSS file or style tag for using selectors. I recommend u going through the CSS tutorials in Sololearn or w3schools to know more.
27th Mar 2017, 4:34 AM
Ashwani Kumar
Ashwani Kumar - avatar
+ 2
27th Mar 2017, 4:36 AM
Ram Anuj Verma
Ram Anuj Verma - avatar