How to Format Images and Web Pages with CSS
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 to move all formatting to the CSS file.
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.
This page 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 CSS Tip will show how to set up a semi-transparent background over another image so parts of the image will show through the background and also how to set up your CSS so this 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 CSS3 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 onlu only CSS3 (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.
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 CSS tip shows how to align images with the text on the page, either above, below or on the same line horizontally.
Here is an image aligned with the middle of a line of text:
This tip shows you how to use character entities and color them to produce red hearts and other symbols on a web page:
Copyright © 2011 - updated 1-12-19
Lori's Web Design
All Rights Reserved