How to Write CSS for a Web Page in Notebook

With an external style sheet ( CSS), you can modify the entire look of your website by simply adding new code to a single file. In this article, we’ll walk you through the steps to create a CSS report. You’ll learn how to create the design sheet—setting site profits, styles, and more—and get a better idea of how to link the style sheet to your HTML.

Create the CSS Style Sheet

Create a text document for CSS in the same way you would generate an HTML word document. How do you go about creating a CSS style sheet in Notepad?

  1. Choose File &gt, New in Notepad to get an empty glass
  2. Save the document as CSS by clicking File &lt, Save As…
  3. Navigate to the hard drive’s my_website files.
  4. Change the” Save As Type:” to” All Files
  5. Brand your file” styles. css” ( leave off the quotes ) and click Save

Hyperlink your HTML to the CSS Style Sheet.

Once you have a fashion plate for your site, you’ll need to connect it with the Web site itself. To do this, apply the website tag. Insert the following website sticker somewhere on your pet’s tags. htm record:

Fix the Page Profitability

One thing you’ll know when writing for various sites is that they all appear to have different profits and guidelines for how things are displayed. Avoiding elements like margins from defaulting to the browser’s selection is the best way to ensure that your website looks the same in most browsers.

We favor beginning sites in the upper left corner, with no more padding or margin around the text. We set the profits to 0 so that we start with the same blank stone even if we’re going to sheet the items. To do this, add the following to your patterns. browser file:

 html,body {
margin: 0px;
padding: 0px;
border: 0px;
left: 0px;
top: 0px;
}

Changing the Page Font

On a web site, the style frequently comes up first. The internet browser itself can decide whether a web site may look dirty or not, so if you don’t determine the style, you really don’t understand what your page will look like.

Normally, you would change the font on sections, or sometimes on the whole document itself. For this site, we’ll establish the style at the header and paragraph level. Add the following to your designs. browser file:

 p, li {
font: 1em Arial, Helvetica, sans-serif;
}
h1 {
font: 2em Arial, Helvetica, sans-serif;
}
h2 {
font: 1.5em Arial, Helvetica, sans-serif;
}
h3 {
font: 1.25em Arial, Helvetica, sans-serif;
}

We used 1em as the starting length for paragraphs and listing items as the starting dimensions, and we then used that as the starting size for the headlines. We don’t anticipate using a headline that is more than h4, but if you do, you’ll want to type it as well.

Making Your Links More Interesting

For unvisited and visited links, the default colors are blue and purple, both. While this is regular, it might not match the color scheme of your pages, so come modify it. In your patterns. style file, add the following:

 a:link {
font-family: Arial, Helvetica, sans-serif;
color: #FF9900;
text-decoration: underline;
}
a:visited {
color: #FFCC66;
}
a:hover {
background: #FFFFCC;
font-weight: bold;
}

We set up three website designs, the a: url as the definition, a: visited for when it’s been visited—we changed the colour, and a: glide. With a: linger, the website is highlighted as being clicked while the background color changes.

Styling the Navigation Area

Since we put the navigation ( id =”nav” ) section first in the HTML, let’s style it first. To prevent the main word from rubbing up against it, we must specify how large it should be and give a wider ratio on the right. We moreover, put a border around it.

Add the following CSS to your designs. browser file:

 #nav {
width: 225px;
margin-right: 15px;
border: medium solid #000000;
}
#nav li {
list-style: none;
}
.footer {
font-size: .75em;
clear: both;
width: 100%;
text-align: center;
}

The .footer designs the copyright section to become smaller and centered within the area, and the list-style home sets up the list inside the navigation area so that it has no bullets or numbers.

Positioning the Main Part

You can be certain that your main section will be exactly where you want it on your website by positioning it with absolute positioning. We made it 800px large to accommodate larger screens, but if you have a smaller screen, you might want to make that narrower.

Place the following in your patterns. browser record:

 #main {
width: 800px;
top: 0px;
position: absolute;
left: 250px;
}

Styling Your Sections

I wanted to give each article a little extra “kick” because I’ve already set the phrase style to the right and above to make it stand out healthier. I did this by placing a border at the top that would emphasize the article more than just the image.

Place the following in your patterns. browser record:

 .topline {
border-top: thick solid #FFCC00;
}

Instead of simply defining each paragraph in that manner, we made the decision to do it as a class called” topline.” This way, if we decide we want to have a paragraph without a major yellow line, we can just leave off the course =”topline” in the article tag and it didn’t have the best border.

Styling the Images

We prefer to have a class within the CSS stylesheet that automatically turns off the border because images typically have a border around them, which isn’t always visible unless the image is a link. For this stylesheet, we created the “noborder” class, and most of the images in the document are part of this class.

These images have a unique location on the page, which makes them special. Without using tables to align them, we wanted them to be a part of the paragraph they were in. The float CSS property is the simplest way to accomplish this.

Place the following in your patterns. browser record:

 #main img {
float: left;
margin-right: 5px;
margin-bottom: 15px;
}
.noborder {
border: 0px none;
}

As you can see, the images have margin properties set up to prevent them from rubbing against the text that is floating next to them in the paragraphs.

Now Take a Look at Your Completed Page.

Once you’ve saved your CSS, you can reload the pets. htm page in your Web browser. Your page should have the same layout as the one in this image, with aligned images and correct navigation on the left side.

For all of your internal pages on this site, follow these instructions. For each page in your navigation, you should have one page.

Leave a Comment