0

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>
3
  • marquee Now that's a name I've not heard in a long time. Commented Apr 11, 2014 at 22:42
  • <marquee> is a very old tag that was never standardized and won't work in many modern browsers. Just an FYI Commented Apr 11, 2014 at 22:44
  • Why <html type = "text/css">? It's HTML not CSS, so no need to "declare" it. Get rid of the type = "text/css". Also make sure you're declaring the doctype. Commented Apr 11, 2014 at 22:47

3 Answers 3

2

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>
Sign up to request clarification or add additional context in comments.

1 Comment

Also avoid using CSS within an element or HTML document. Always try to use an external one like so <link rel="stylesheet" href="style.css">
0

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>

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.