<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>what is element selector Archives - Artificial Intelligence</title>
	<atom:link href="https://www.aiuniverse.xyz/tag/what-is-element-selector/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.aiuniverse.xyz/tag/what-is-element-selector/</link>
	<description>Exploring the universe of Intelligence</description>
	<lastBuildDate>Sun, 02 Apr 2023 23:56:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>CSS Selector and Its Types</title>
		<link>https://www.aiuniverse.xyz/css-selector-and-its-types/</link>
					<comments>https://www.aiuniverse.xyz/css-selector-and-its-types/#respond</comments>
		
		<dc:creator><![CDATA[Maruti Kr.]]></dc:creator>
		<pubDate>Fri, 31 Mar 2023 12:43:03 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css selector and its type]]></category>
		<category><![CDATA[what do mean by selector]]></category>
		<category><![CDATA[what is class selector]]></category>
		<category><![CDATA[what is css selector]]></category>
		<category><![CDATA[what is element selector]]></category>
		<category><![CDATA[what is id selector]]></category>
		<category><![CDATA[what is pseudo selector]]></category>
		<category><![CDATA[what is selector]]></category>
		<guid isPermaLink="false">https://www.aiuniverse.xyz/?p=16274</guid>

					<description><![CDATA[<p>What is CSS Selector Selector means choosing an html tag for applying the styles. CSS selectors can be based on the 1. CSS Element Selector: The element selector selects HTML elements based on the element name such as &#8220;p&#8221; for paragraphs or &#8220;h1&#8221; for heading 1. Output: 2. CSS Id Selector: By using id selector <a class="read-more-link" href="https://www.aiuniverse.xyz/css-selector-and-its-types/">Read More</a></p>
<p>The post <a href="https://www.aiuniverse.xyz/css-selector-and-its-types/">CSS Selector and Its Types</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">What is CSS Selector</h2>



<p>Selector means choosing an html tag for applying the styles. CSS selectors can be based on the</p>



<ul class="wp-block-list">
<li>CSS Element Selector</li>



<li>CSS Id Selector</li>



<li>CSS Class Selector</li>



<li>CSS Pseudo Selector</li>



<li>CSS Group Selector</li>
</ul>



<h2 class="wp-block-heading">1. CSS Element Selector:</h2>



<p>The element selector selects HTML elements based on the element name such as &#8220;p&#8221; for paragraphs or &#8220;h1&#8221; for heading 1.</p>



<pre class="wp-block-code"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
p{
    text-align: center;
    color: rgb(65, 153, 225)
} 
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;Style will be applied on every paragraph.&lt;/p&gt;
&lt;p&gt;Hi&lt;/p&gt;
&lt;p id="para1"&gt;Hello&lt;/p&gt;
&lt;p&gt;How are You&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;  

</code></pre>



<p><strong>Output:</strong></p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="551" src="https://www.aiuniverse.xyz/wp-content/uploads/2023/03/00-1024x551.png" alt="" class="wp-image-16275" srcset="https://www.aiuniverse.xyz/wp-content/uploads/2023/03/00-1024x551.png 1024w, https://www.aiuniverse.xyz/wp-content/uploads/2023/03/00-300x161.png 300w, https://www.aiuniverse.xyz/wp-content/uploads/2023/03/00-768x413.png 768w, https://www.aiuniverse.xyz/wp-content/uploads/2023/03/00.png 1362w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">2. CSS Id Selector:</h2>



<p>By using id selector we can apply CSS style for same group of html tag. An id is always unique within the page so it is chosen to select a single, unique element.</p>



<p>To select an element with a specific id, write a hash (#) character, followed by the id of the element.</p>



<p> </p>



<pre class="wp-block-code"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
#para1 {
  text-align: center;
  color: skyblue;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;p id="para1"&gt;Hello World!&lt;/p&gt;
&lt;p&gt;In this paragraph, Not applying the style.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>



<p><strong>Output:</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="555" src="https://www.aiuniverse.xyz/wp-content/uploads/2023/03/01-1024x555.png" alt="" class="wp-image-16277" srcset="https://www.aiuniverse.xyz/wp-content/uploads/2023/03/01-1024x555.png 1024w, https://www.aiuniverse.xyz/wp-content/uploads/2023/03/01-300x163.png 300w, https://www.aiuniverse.xyz/wp-content/uploads/2023/03/01-768x416.png 768w, https://www.aiuniverse.xyz/wp-content/uploads/2023/03/01.png 1366w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">3. CSS Class Selector:</h2>



<p>By using class selector, We can apply same CSS style for multiple html tags.</p>



<p>To select multiple tags we need to use class attributes.</p>



<p>To represent class name, we have to use dot(.).</p>



<pre class="wp-block-code"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
.center {
  text-align: center;
  color:purple;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;h1 class="center"&gt;This heading is purple and center-aligned.&lt;/h1&gt;  
    &lt;p class="center"&gt;This paragraph is purple and center-aligned.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre>



<p><strong>Output:</strong> </p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="557" src="https://www.aiuniverse.xyz/wp-content/uploads/2023/03/11-1024x557.png" alt="" class="wp-image-16278" srcset="https://www.aiuniverse.xyz/wp-content/uploads/2023/03/11-1024x557.png 1024w, https://www.aiuniverse.xyz/wp-content/uploads/2023/03/11-300x163.png 300w, https://www.aiuniverse.xyz/wp-content/uploads/2023/03/11-768x418.png 768w, https://www.aiuniverse.xyz/wp-content/uploads/2023/03/11.png 1366w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">4. CSS Group Selector:</h2>



<p>Grouping multiple selector is group selector. We use comma(,) for grouping selectors.</p>



<pre class="wp-block-code"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
h1, h2, p {
    text-align: center;
    color: rgb(255, 0, 106);
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;CSS Group selector Example&lt;/h1&gt;
&lt;h2&gt;Hello, How are You&lt;/h2&gt;
&lt;p&gt;This is a paragraph.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>



<p><strong>Output:</strong></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="550" src="https://www.aiuniverse.xyz/wp-content/uploads/2023/03/12-1024x550.png" alt="" class="wp-image-16279" srcset="https://www.aiuniverse.xyz/wp-content/uploads/2023/03/12-1024x550.png 1024w, https://www.aiuniverse.xyz/wp-content/uploads/2023/03/12-300x161.png 300w, https://www.aiuniverse.xyz/wp-content/uploads/2023/03/12-768x413.png 768w, https://www.aiuniverse.xyz/wp-content/uploads/2023/03/12.png 1366w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">5. Pseudo Selector:</h2>



<p>A CSS Pseudo selector is a keyword added to a selector that specifies a special state of the selected elements.</p>



<p><strong>Syntax:</strong></p>



<pre class="wp-block-code"><code>Selector: Pseudo Selector Name
{
Style Name: Value</code></pre>



<pre class="wp-block-code"><code>&lt;!DOCTYPE html>
&lt;html lang="en">
&lt;head>
    
    &lt;title>Pseudo selector&lt;/title>
    &lt;style>
        .abc:hover
        {
            color: red;
            cursor: pointer;
        }
    &lt;/style>
&lt;/head>
&lt;body>
    &lt;h1 class="abc">CSS Selector&lt;/h1>
    
&lt;/body>
&lt;/html></code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://www.aiuniverse.xyz/wp-content/uploads/2023/04/2-1024x576.png" alt="" class="wp-image-16297" srcset="https://www.aiuniverse.xyz/wp-content/uploads/2023/04/2-1024x576.png 1024w, https://www.aiuniverse.xyz/wp-content/uploads/2023/04/2-300x169.png 300w, https://www.aiuniverse.xyz/wp-content/uploads/2023/04/2-768x432.png 768w, https://www.aiuniverse.xyz/wp-content/uploads/2023/04/2.png 1366w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Note: When cursor touch an output(CSS Selector) , its will change the color.  </p>
<p>The post <a href="https://www.aiuniverse.xyz/css-selector-and-its-types/">CSS Selector and Its Types</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aiuniverse.xyz/css-selector-and-its-types/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
