user4592357 Posted April 25, 2018 Share Posted April 25, 2018 i have this html code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Commands</title> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <header> <h1>Commands Documentation</h1> </header> <section> <div class="all-commands"> <div class="command" id="open"> <h2>command1</h2> <dl class="description"> <dt>Syntax:</dt> <dd>the syntax of the command <i>param1</i> param2 </dd> <br> <dt>Description:</dt> <dd></dd> <dt>Arguments:</dt> <dd></dd> <dt>Returns:</dt> <dd></dd> <dt>Example:</dt> <dd></dd> </dl> </div> and this is styles.css: dt { color: red; font-weight: bold } the css isn't applied to <dt> elements, any idea why? Link to comment Share on other sites More sharing options...
dsonesuk Posted April 25, 2018 Share Posted April 25, 2018 Are you sure you don't have styling similar to dl dt { color: black; font-weight: normal;} /*OR*/ .description dt { color: black; font-weight: normal;} Both of these will have higher precedence, wherever placed. Link to comment Share on other sites More sharing options...
user4592357 Posted April 25, 2018 Author Share Posted April 25, 2018 (edited) this is what i have in css file: li:not(:last-child) { margin-bottom: 55px; } dt { color: red; font-weight: bold } when i remove the <li> rule, <dt> rule works. Edited April 25, 2018 by user4592357 Link to comment Share on other sites More sharing options...
dsonesuk Posted April 25, 2018 Share Posted April 25, 2018 None of those should cause any problems at all? the <br> within dl element is not allowed, only within the dt, dd elements. 1) what editor are you using? if notepad, make sure you save as UTF-8 encoded, and make sure your files are saved as test.html and not test.html.txt or style.css.txt. If your O/S hide extensions, all you will see is test.html, but really its test.html.txt 2) Make sure you use a localhost server, and not just from opening the file from O/S file system folder into a browser. 3) Make sure you clear history or cache after each change, try Ctrl F5. 4) Make sure you end each property with semi-colon ';' Link to comment Share on other sites More sharing options...
user4592357 Posted April 25, 2018 Author Share Posted April 25, 2018 i'm using vscode, files are definitely *.html. and none of that helped. Link to comment Share on other sites More sharing options...
dsonesuk Posted April 25, 2018 Share Posted April 25, 2018 Well view this https://www.w3schools.com/code/tryit.asp?filename=FQPF1RJKJUCI and see if you get the same result. if not then you are doing something not mentioned that causing the css not to be implemented correctly. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now