PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon May 21, 2018 9:11 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: DIV and H3 CSS
PostPosted: Fri Feb 26, 2016 6:01 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4416
Location: United Kingdom
Hi

So I have a simple bit of HTML. I have the H3 set just so, but I want to custom each of the two H3 tags to have set colors.

Syntax: [ Download ] [ Hide ]
<div class='mobile-bullets'>
<h3 class='smile'>What instant benefits ?</h3>
</div>

<div class='mobile-bullets'>
<h3 class='sad'>What instant downfalls?</h3>
</div>


I thought it would be like this:

Syntax: [ Download ] [ Hide ]
.mobile-bullets h3
{
margin: 0px;
font-family: Titillium Web, SegoeUILightWF;
font-weight: 600;
font-size: 25px;
border-bottom: 1px solid #cccccc;
padding-bottom: 10px;
margin-bottom: 10px;
color: #422782;
}

.mobile-bullets sad h3
{
color: #ff0000;
}


.mobile-bullets smile h3
{
color: #009900;
}
 


But it doesn't work.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
 Post subject: Re: DIV and H3 CSS
PostPosted: Fri Feb 26, 2016 6:41 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA
What kind of element does ".mobile-bullets" apply to? What kind of element does "h3" apply to?


Top
 Profile  
 
 Post subject: Re: DIV and H3 CSS
PostPosted: Fri Feb 26, 2016 6:51 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4416
Location: United Kingdom
.mobile-bullets is a DIV.
H3 is just wrapped around the title text within the DIV.

There are just <ul><li></li></ul> tags inside the DIV, and one image.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
 Post subject: Re: DIV and H3 CSS
PostPosted: Fri Feb 26, 2016 9:30 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA
I meant technically, as in "technically, '.mobile-bullets' is anything that has a class of 'mobile-bullets'" and "technically, 'h3' is any <h3>".

That would then trigger the thought "so that means that, technically, '.mobile-bullets sad h3' would target a <h3> within a <sad> within anything with a class of 'mobile-bullets'". Which is clearly not what you want.

Then you'd think "if I want to target a h3 with a class of 'smile' within something with a class of 'mobile-bullets' then I should use '.mobile-bullets h3.sad'".


Top
 Profile  
 
 Post subject: Re: DIV and H3 CSS
PostPosted: Fri Feb 26, 2016 12:25 pm 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4416
Location: United Kingdom
That's it - you got it. That last statement you made was it.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group