For me, one of the best parts of running this blog is that I am always learning something new. Doing research for new posts and finding new resources and sites helps me expand my knowledge and pass it on to the readers. With all the CSS I have written and learned, I never really knew about global resets. I have seen them before in other peoples code, but didn't pay much attention to them.
I recently came across a great article over at perishablepress.com that explains what they are used for and gives a long list of different types of resets. I have unknowingly used resets before when setting padding and margin to 0 for different elements and then adjusting it to my liking.
It's important to design sites with cross-browser compatibility in mind. With the different ways that browsers handle CSS and the fact that each browser has it's own default setup for things like margins and padding, adding these global resets can really help the design process. I plan on implementing some of these resets in future design projects.
The * is called a wildcard symbol. Here it is used as a wildcard selector which means that these properties are applied to every element. So, all the padding and margins are reset to 0.
You can add other properties to the wildcard selector. Some people will add border: 0; and outline: 0;. The above, with padding: 0; and margin: 0;, is one of the most popular CSS resets used.
The post at perishablepress is worth a read, and they have a lot more reset options.
Let's take a look at styling anchor tags, or links, using CSS. We will be going over the CSS pseudo-classes that are used with links - link, visited, hover, and active. First, let's take a look at the link pseudo-class in CSS.
:link - this pseudo-class is used to style a normal unvisited link. When you are styling links you should put this pseudo-class first.
a:link
{
color: #339966;
}
Notice that we use the HTML tag, or selector, a because that is how a link is represented in HTML. The :link represents the pseudo-class. Then you set your properties between the curly braces. This CSS will change all the unvisited links to a green color.
:visited - this pseudo-class is used to style a visited link. When you are styling links you should put this pseudo-class second.
a:visited
{
color: #00ffff;
}
You will see that most sites will set the visited link color to the same color as the normal a:link color.
:hover - this pseudo-class is used to style the mouse over effect of a link. When you are styling links you MUST put this after a:link and a:visited.
a:hover
{
color: #FF0000;
}
:active - this pseudo-class is used to style an activated link element. When you are styling links you MUST put this after a:hover.
a:active
{
color: #FF00FF;
}
This effect is seen while clicking the link. You will find the a lot of sites will style a:hover and a:active the same.
Putting it together in the HTML.
<html>
<head>
<title>Link and pseudo-classes</title>
<!– Embedded Styles –>
<style type="text/css">
a:link
{
color: #339966;
}
a:visited
{
color: #00FFFF;
}
a:hover
{
color: #FF0000;
}
a:active
{
color: #FF00FF;
}
</style>
</head>
<body>
<p>
<a href="#">A Link</a> Lorem ipsum dolor sit amet,
consectetuer adipiscing elit, sed <a href="#">diam nonummy
nibh</a> euismod tincidunt ut laoreet dolore magna aliquam
erat volutpat.
</p>
A Link Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
You can see how the styles effect the links. You can also combine these anchor CSS pseudo-classes with regular CSS classes. This can help you style links differently throughout the page.
The above CSS shows you how to add a class name to the pseudo-classes and how to style multiple elements at the same time. className can be whatever you want to name your class. You can put the :link and :visited pseudo-classes together by adding a comma between declarations. The HTML would look like this:
<p>
<a class="className" href="#">A Link</a> Lorem ipsum
dolor sit amet, consectetuer adipiscing elit,
sed <a class="className" href="#">diam nonummy nibh</a>
euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</p>
All you need to do is add class="className" to the anchor tag.
A Link Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Styling links using CSS is easy - just remember to put the pseudo-classes in the correct order - :link, :visited, :hover, :active.
Let's take a closer look at the css border properties. We start off by creating a border: that has a 3px 'stroke' that is solid and the color black. The next property we use is border-color:. The format here is TOP, RIGHT, BOTTOM, LEFT - or clockwise around the square starting from the top. Even though we set a color in the border: property, we put border-color below it which gives it precedence - or it 'overwrites' the border's color.
If you haven't seen these rap videos by Poetic Prophet, aka SEO Rapper, you've gotta watch, or at least listen, to them. This guy is actually rapping about web design and search engine optimization, and they are full of good information. All the lyrics are posted on YouTube, just click (More info) on the right just below the users info - in case you can't keep up with what he is saying.
Adding textures to your work in Photoshop can really add a sense of detail. Depending on the textures and how you use them, they can help make a piece look more realistic, or grungy, or even cartoonish. They can really define a Photoshop piece. So, let's learn how to bring a texture image into Photoshop and use it to help our artwork look better. (more…)