Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , , , , ,

Sponsored Links



What are Pseudo-classes and Pseudo-elements in CSS?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 30-01-2010
DANIEL 602's Avatar
Member
 
Join Date: Jul 2006
Posts: 212
What are Pseudo-classes and Pseudo-elements in CSS?

I have done C, C++ and Java programming language. Now I have started with CSS. I have done some basic programs in CSS. Now I have stuck with the term Pseudo-classes and Pseudo-elements in CSS. I am not getting anything about the Pseudo terms. So can anyone explain me what are Pseudo-classes and Pseudo-elements in CSS.?? Please provide me more information about the related things with the Pseudo-classes and Pseudo-elements. Hoping for the quick response..!!!
__________________
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signatureto help him gain world domination
Reply With Quote
  #2  
Old 30-01-2010
Allan.d's Avatar
Member
 
Join Date: Mar 2008
Posts: 672
Re: What are Pseudo-classes and Pseudo-elements in CSS?

Pseudo-elements and the Pseudo-classes are used in CSS for the appearance of the forms. The pseudo-elements are used to add special effects in CSS to some selectors. The following is the syntax for the pseudo-elements :
Code:
selector:pseudo-element {property:value;}
You can also use the CSS classes with the pseudo-elements :
Code:
selector.class:pseudo-element {property:value;}
Reply With Quote
  #3  
Old 30-01-2010
Warner's Avatar
Member
 
Join Date: Mar 2008
Posts: 349
Re: What are Pseudo-classes and Pseudo-elements in CSS?

There are some elements in the Pseudo-elements with which you can add some effects to the text. The :first-line Pseudo-element is used for the same. If you want to give the special style to the first line of a text, you can give it by using the "first-line" pseudo-element. If you look at the following example, you can understand better :
Code:
p:first-line
{
color:#ff0000;
font-variant:small-caps;
}
In the above example the browser formats the first line of text in a p element according to the style in the "first-line" pseudo-element.
Reply With Quote
  #4  
Old 30-01-2010
Member
 
Join Date: Nov 2008
Posts: 1,193
Re: What are Pseudo-classes and Pseudo-elements in CSS?

If you want to use multiple Pseudo-elements, you can use it in CSS. Because in CSS, you can combine several pseudo-elements. I have provided you with an example, in which first letter of a paragraph will be blue, in a small-caps. The rest of the first line will be red, and in an xx-large font size. The rest of the paragraph will be the default font size and color. Here is an example for that :
Code:
p:first-letter
{
color:#0000ff;
font-size:small-caps;
}
p:first-line
{
color:#ff0000;
font-variant:xx-large;
}
Reply With Quote
  #5  
Old 30-01-2010
opaper's Avatar
Member
 
Join Date: May 2008
Posts: 2,362
Re: What are Pseudo-classes and Pseudo-elements in CSS?

I am explaining you the two Pseudo-element. The ":before" pseudo-element and the :after Pseudo-element. The ":before" pseudo-element can be used to insert some content before the content of an element. While the ":after" pseudo-element can be used to insert some content after the content of an element. The following are the examples of both the pseudo-elements :
Code:
h3:before
{
content:url(thumup.gif);
}
The above example inserts an image before each <h3> element.
And the following example will insert an image after each <h2> element :
Code:
h2:after
{
content:url(ohmy.gif);
}
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #6  
Old 30-01-2010
Solitario's Avatar
Member
 
Join Date: Aug 2006
Posts: 220
Re: What are Pseudo-classes and Pseudo-elements in CSS?

I think that you should got the concept of Pseudo-elements, so I thought that providing some information about the Pseudo-classes will be useful for you..!! The syntax for the pseudo-classes in CSS is :
Code:
selector:pseudo-class {property:value;}
With the pseudo-classes, you can also use the CSS classes :
Code:
selector.class:pseudo-class {property:value;}
Hope that you might have got the term Pseudo-classes used in CSS.!!
__________________
I do to dead flowers what people at morgues do to dead people. Suck all the moisture out, dip them in plastic, paint them up pretty and put them in a nice frame.
Reply With Quote
  #7  
Old 30-01-2010
MELTRONICS's Avatar
Member
 
Join Date: Aug 2006
Posts: 226
Re: What are Pseudo-classes and Pseudo-elements in CSS?

You can also combine the CSS Classes with the pseudo-classes, similarly as the pseudo-elements that combines with the CSS Classes. The following example explains the same :
Code:
a.blue:visited {color:#0000ff;}

<a class="blue" href="css_trial.asp">CSS Syntax</a>
After using this coding, if you visit the above link, it will display it in Blue color.
__________________
3.2 (northwood)
2gig ram
ATI AIW X800xt 256mb
Gigabyte GA-8knxp 875p Chipset
Optiwrite 8X DVD Burner
Win XP PRO Sp2 (Works Perfectly)
2 SATA Raptor 74gig Raid 0
2 7200 IDE 320gig HD
Reply With Quote
  #8  
Old 30-01-2010
Deabelos's Avatar
Member
 
Join Date: Jul 2006
Posts: 233
Re: What are Pseudo-classes and Pseudo-elements in CSS?

You can also match the specified element by using the pseudo-class. The The :first-child pseudo-class matches a specified element that is the first child of another element. But before using the :first-child to work in Internet Explorer, you will have to declare a <!DOCTYPE>, otherwise it will not work. In the example that I have given, the selector matches any <p> element that is the first child of any element :
HTML Code:
<html>
<head>
<style type="text/css">
p:first-child
{
color:red;
}
</style>
</head>

<body>
<p>I am very intelligent.</p>
<p>I am very intelligent.</p>
</body>
</html>
__________________
IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "What are Pseudo-classes and Pseudo-elements in CSS?"
Thread Thread Starter Forum Replies Last Post
Is anyone know what is pseudo code? Truster Software Development 5 03-02-2010 01:44 PM
Teredo Tunneling Pseudo-Interface and VPN Client davie Hardware Peripherals 4 25-01-2009 08:46 AM
Teredo Tunneling Pseudo-Interface JohnB Vista Hardware Devices 1 21-12-2007 03:04 PM
teredo tunneling pseudo interface Giovanni Vista Hardware Devices 1 03-12-2007 08:11 AM
Teredo Tunneling Pseudo-Interface? drahnier Windows Vista Network 0 01-03-2007 03:02 PM


All times are GMT +5.5. The time now is 12:00 PM.