dj0965
dj0965

Reputation: 135

Css and html issue with classes

I am trying to make a website for school about gothic cathedrals, and can not get the css class to work. I am trying to make a menu on the side of the page that will stay in the same position, and just typed 'hi' to test it. Nothing I have looked up is working and it would be greatly appreciated if someone could tell me what I'm doing wrong.

<html type = "text/css">
<head>
<script>
div.mydiv {
color: red;
position: fixed;
left: 0;
top: 200px; /* 200px from top */
}
</script>
<title>
Cathedral Project
</title>
</head>
<body>
<h1>
<marquee behavior = "alternate" style = "background-color:#828180" scrolldelay = "1">
<a href="https://be43ada9-a-cc17453e-s-sites.googlegroups.com/a/sau41.org/stephen-capraro/home/funny_3.jpg?attachauth=ANoY7cq6T-NPJuhfXWPCNobXQS33pGhZw8uo_BhUpozRiCu8JFK7_dWd6B-92bckzc8_3Vj9lQMh7jCL0mBVR-tYYg0LgIIx7yPZqbme0G-oKcRVfyd_GPuRrTtCuOT2wRhByl-QVpqrpa12yk5xqG9bluTqdQEyRgeMPCnz3mpcdjV9xKzoWOLUg2vCrGscyxdz84kFwm0hDZlH0I4LhEZZioG4kLd-fQ%3D%3D&attredirects=0" target="_blank"> <img src="gothic.jpg"> </a>
</marquee>
</h1>
<div class="mydiv">hi
</div>

</body>
</html>

Upvotes: 0

Views: 43

Answers (3)

Abdussami Tayyab
Abdussami Tayyab

Reputation: 149

You place your CSS code in the <style type="text/css"></style> tag, not in the <script></script> tag.

And it would be great for you if you indent the code, it will help you not making silly errors like missing the tags.

Upvotes: 0

Kraang Prime
Kraang Prime

Reputation: 10509

Change

<script>
div.mydiv {
color: red;
position: fixed;
left: 0;
top: 200px; /* 200px from top */
}
</script>

To

<style>
div.mydiv {
color: red;
position: fixed;
left: 0;
top: 200px; /* 200px from top */
}
</style>

Upvotes: 0

LoveAndCoding
LoveAndCoding

Reputation: 7947

Currently your css is in a <script> tag. It needs to be in a <style> tag. It should look like this:

<style type="text/css">
    .mydiv { /* styles go here */ }
</style>

Upvotes: 3

Related Questions