Useful html / css stuff!

This page is dedicated for sample code for anyone who wants to learn CSS

Set width and height of images

First, you want to give your image a name, or what we call an ID in CSS language. To do so, take a look at this sample:

We gave the image the name of "image1", and this will be useful when you are dealing with multiple images.

Next up, we want to style "image1" with CSS. To do so, write this code into your CSS field:

You should replace X and Y with whatever length you want. Remember to use px, em, % or pt.

We use the percentage (%) in example nr. 2 to make the width and height fill the entire parent with the image. If you have 100% width and 100% height in a "body" tag, the image will fill the entire page. Percent is useful for dynamic websites that allign depending on how big the visitors browser is.