Web Design

help me

Classes

.rule

So, our knowledge of web design is growing. As our knowledge grows, our web pages grow too! It's like teething - things are growing!

We know that the structore of a webpage can be described as follows:

  • Every webpage has two html tags, one which opens the html section and one which closes it.
  • Inside the html section there is a head section.
  • After the head section there is a body section.
  • We include elements in the body section. Tags allow us to define what kind of elements they are eg h1, p, img.
  • We can style elements inline using the style attribute. We put CSS into the style attribute.
  • Another way to style tags is to create a style section inside the head section. We put CSS into the style section.
  • We need to be careful with the punctuation of web design! There are lots of <       >       :      ;      {       and      }

What if we want different tags to follow the same rule?

For example, we want h1 tags and img tags to have a left margin of 40px.

Or we want some of our images to have a red border, but not all of them?

We can design our own CSS rules and apply them to any tag we like!

<html>

<head>

<style>

.myRule{

color:red;

font-size:24px;

font-family:Courier new;

}

</style>

</head>


<body>

</body>

</html>

We have created a CSS rule in the style section of the webpage. We know it is a rule and not a tag style because it starts with a .
We can now apply the rule to any element in the body section of our webpage. We just need to use the class attribute:

<html>

<head>

<style>

.myRule{

color:red;

font-size:24px;

font-family:Courier new;

}

</style>

</head>


<body>

<h1 class = "myRule">Welcome to my page!</h1>

</body>

</html>

When you apply the rule, use the class attribute, then the browser knows it is a CSS rule. So, you don't need to use the . when applying the rule.
Challenge 60
Download this webpage and save it in a new folder called "Orkney project".

☉create an images folder in your Orkney project folder.

☉save these three images in your images folder.

☉open orkney.html in a text editor and create the following styles for the tags and other rules (classes) that elements in the webpage can use. Also, follow any instructions you see inside orkney.html

All h1 tags

All h2 tags

All p tags

All img tags

body tag

☉apply the bigBlue class to any span tags you find in the html file.

☉apply the red class to any i tags you find in the html file.

☉apply the bigBlue class to every occurrence of the word "Mainland"

☉research how to use the <a> tag so that the user can click the word About in the menu to visit this webpage: https://www.orkney.com/

Self Study

Can you figure out how to turn the unordered list with 3 list items into a horizonal navigation bar - you just need to style it!

Click me for an idea.