How to Format Images and Web Pages with CSS
These CSS tips are written mainly for CSS beginners with step-by-step examples. Some of them are also set up for Responsive design so they will display correctly on all devices.
A Cascading Style Sheet (CSS) is a great way to clean up your code and reduce a lot of code bloat because you don't have to repeat font sizes and colors on every little bit of text.
When you repeat images several times, like in a list format using buttons, you can load those as a background image and thus eliminate having to include width and height or alt tag on every image.
Google recently started using download speed as a ranking factor so it's now even more important than ever to move all formatting to the CSS file.
This CSS tip shows how to align images with the text on the page. Sometimes you want the text aligned either at the top or the bottom of the image or in the middle. This tip also gives instructions on how to align the image with the baseline of the text.
Here is an image aligned with the bottom of text:
This tip will show you how to set up two tables that are side by-side on a desktop page but revert to a vertical layout on small mobile devices without using a lot of media queries in your CSS file.
This tip will show how to set up a semi-transparent background over another image so parts of the image will show through the background.
It will also show you how to set up your CSS so it will float over your image.
This CSS tip shows how to set up a small image at the top of a webpage and use a plain color background using the same color as the bottom of the image for the rest of the page so you don't have to use a large image for the whole page or repeat the image down the page. This tip also shows how to get the right color hex number for the background and set it up in the css file.
This tip uses CSS to set up gradient backgrounds without images, using several colors that gradually change from one shade to another.
This allows the web page to load faster than using an image for the background.
You can add a drop shadow under an image, or text box, with CSS (no shadow images needed). This tip also provides an explanation of drop shadow compatibility in different browsers, how to write the drop shadow code and center the image on the page.
Information on how to add a frame with a border around an image so it looks like a photograph with either a white or transparent background with an option to use a caption underneath using CSS. This tip also shows how to make picture frames in different widths.
This tips works on any size block item in CSS, like paragraphs, divs, tables, table cells or web pages.
How to add a border around the edge of a web page, container, box, table or any other item using CSS. This tip also shows how to add varying colors to the border so it looks like it's within a frame.
When you have multiple tables on the same page with different formatting on each one you need a separate CSS rule for each table. This tip shows you how to set up different classes for each table, how to align date in cells either left or right, and apply different colors to the cells.
How to calculate the width of columns and their margins and center floats on a page with CSS so they don't wrap to the next line.
This tip shows you how to use character entities and color them to produce red hearts and other symbols on a web page:
~ ~ Other CSS Resources ~ ~
This site provides several articles written for beginners on how to write CSS and also CSS3: CSS3 - Guide, Examples and Resources
Here is a great CSS memory game.
Here is a neat video tutorial on How to Format your CSS file
Copyright © 2011 - updated 11-04-20
Lori's Web Design
All Rights Reserved