Which one: HTML or CSS?

  • Thread starter Thread starter Shadow da amazing
  • Start date Start date
Both. The tag DIV is HTML. The variable id identifies the tag so that the browser knows what to apply the CSS to, which is in the next variable "style". You have put the CSS in the tag itself. It is more efficient to put the CSS in it's own file and refer to the DIV tag there.

So inside your <HEAD></HEAD tags on your HTML page, put a link tag that points to your CSS file:
<head>
<link href="/css/greenqueen.css" rel="stylesheet" type="text/css" />
</head>

Then in your CSS file, define the style of that div tag like so:

#box {
margin:30px;
}

The # identifies the style as a style for the div named box. You can only have one div named box though. If you have more than one div that uses the same css, then it would be written this way:

.box {
margin:30px;
}

and then in the HTML...

<div class="box"></box>
 
Back
Top