0

Linking HTML and CSS files

BWhell 10 years ago in iPad updated by Alexander Blach (Developer) 10 years ago 3

Hi,


I can't seem to get my HTML and CSS files to work together. They work fine in dreamweaver. I can't find much support on the subject. Please help.


<!DOCTYPE html>

<html>

<head>

<rel="stylesheet" type="text/css" link href="style.css">

​<meta charset="utf 8">

   <html lang="en">

​<title>Doctors Abroad SA</title>

</head>


.......


@charset "utf-8";

/* CSS Document */

 

/* Default Style */

 

header {

​height: 150px;

​background-color:#333;

​margin-bottom: none;

}


+1

Your link tag is wrong. 


Try to replace this line:


<rel="stylesheet" type="text/css" link href="style.css">


with this:


<link rel="stylesheet"  type="text/css" href="style.css">



Also try to run your HTML file through a HTML validator like this: http://validator.w3.org/#validate_by_input. There seem to be some other syntax issues with it.


For example, it should be:


<meta charset="utf-8">


Also, you have a second html tag inside the head section...

Thanks for the help. I made the changes but still can't see any changes applied through CSS.


<!DOCTYPE html>

<html>

<head>

<link rel="stylesheet" type="text/css" href="style.css">

​<meta charset="utf-8">

​<title>Doctors Abroad SA</title>

</head>

 

​<body>



........



@charset "utf-8";

/* CSS Document */

 

/* Default Style */

 

header {

​height: 150px;

​background-color:#333;

​margin-bottom: none;

}


I appreciate the help.


"header" in your CSS file is not a valid CSS selector since there is no "header" tag in HTML.

 

If "header" is used in a class attribute in your HTML file, you need to write ".header" instead of "header". If you instead have an HTML element with the id "header", you need to use "#header" as the CSS selector.


Try something like "body" to style the body tag.


It's hard to say what's correct in your case without seeing the rest of your html file.


This is really just basic HTML/CSS, so I'd recommend to have a look at some CSS and HTML tutorials on the web.