---
title: "CSS '>' selector; what is it?"  
description: "CSS '>' selector; what is it?"  
author: "Anonymous User"  
published: 2013-04-16  
updated: 2013-04-16  
canonical: https://www.mindstick.com/forum/763/css-selector-what-is-it  
category: "css-css3"  
tags: ["css-css3"]  
reading_time: 2 minutes  

---

# CSS '>' selector; what is it?

Hi Everyone!\
I have seen many time in [css](https://www.mindstick.com/forum/514/background-gradient-ie7-css-problem) [file](https://www.mindstick.com/articles/59/encrypting-and-decrypting-files-using-c-sharp) greater than sign ">", but not understand why used it.Please provide any suitable demo.\
Please help me!\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

Hi Ankita!\
Greater than sign used for apply css on element\
**Syntax:**\
element > element**\****Example** div > pApply on all <p> elements where the parent is a <div> element\
**Syntax**\
class > element\
**Example**\
.a > div\
Apply on all <div> elements where the parent is a <div> with a class \
**For example**\

```
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">    <title></title>    <style type="text/css">        .bg > div {            background-color: #888888;        }        div > p {            color: #600000;        }    </style></head><body>    <form id="form1" runat="server">        <div id="red" class='bg' style="height: 150px; border: 2px solid #ff0000;">            <div id="green" style="height: 60px; border: 2px solid #00ff00;">                <p>Greater Than sign (>) CSS Selector demo</p>            </div>            <br />            <div id="blue" style="height: 60px; border: 2px solid #0000ff;">                <p>Greater Than sign (>) CSS Selector demo</p>            </div>        </div>    </form></body></html>
```

\
From the above example, you can see "bg" class apply on "green","blue" div not on "red", and which <p> element inside on div that are selected.\


---

Original Source: https://www.mindstick.com/forum/763/css-selector-what-is-it

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
