EXTERNAL CSS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

EXTERNAL CSS

Using a Window desktop and also a normal Notepad, I created two files, one of the .html extension and the other .css extension, in the same directory, but the point is, using the LINK element, to refer to the CSS, file doesn’t seem to work, but it does very well on the Code playground, it doesn’t work some where else, could I get some form of explanations.

12th Feb 2018, 11:33 AM
James Abiola Bisiriu
James Abiola Bisiriu - avatar
5 Answers
+ 2
Your css declaration target nothing ^^ The css selector '#intro .first em' search for an <em> element, child of any element with class 'first' and itself child of an element with id 'intro', such as this html code: <div id="intro"> <span class="first"> <em>this is a sample text content</em> </span> </div> Even in code playground context your actual codes will not style anything ;P
13th Feb 2018, 4:41 AM
visph
visph - avatar
0
Please add the code, there may be something wrong in it
12th Feb 2018, 11:53 AM
spcan
spcan - avatar
0
And here is the css code #intro .first em { color: pink; background-color:gray; }
12th Feb 2018, 2:38 PM
James Abiola Bisiriu
James Abiola Bisiriu - avatar
- 2
<head> <link rel="stylesheet" href="example.css"> </head> <body> <p>This is my first paragraph.</p> <p>This is my second paragraph. </p> <p>This is my third paragraph. </p> </body> This is the html code
12th Feb 2018, 2:37 PM
James Abiola Bisiriu
James Abiola Bisiriu - avatar
- 3
Zaz z★!★<,,?,¿
12th Feb 2018, 2:35 PM
Fauzan Al Agung
Fauzan Al Agung - avatar