Jump to content
xisto Community
Ahsaniqbalkmc

Can This Effect Be Achieved? [solved]

Recommended Posts

I have a wordpress based website (mananatomy.com) and I am looking for an effect to achieve. The format of my pages is somewhat like that;==========================================<h1> ( the title of the post I make through wordpress)==========================================Outline: (<strong class="outline">)Introduction to "keyword":P<h2>)<h2><h2>==========================================Now what I actually want to achieve is that the first <strong> tag in my post automatically gets the class "outline" so that I do not have to write it again and again with every page I enter. Is this possible?

Share this post


Link to post
Share on other sites

I assume that you are using CSS.

If that's the case, you can write it like this,

strong:first-child{CSS-Code goes here.}

This will do that EVERY FIRST "strong" element inside another element (or in the body) gets those preferences.
Is that what you're looking for?

If that's not the case, I'll blame it on the time, (A)
It's almost 4AM here, :P

Regards
/Feelay
Edited by Feelay (see edit history)

Share this post


Link to post
Share on other sites

I assume that you are using CSS.
If that's the case, you can write it like this,

strong:first-child{CSS-Code goes here.}

This will do that EVERY FIRST "strong" element inside another element (or in the body) gets those preferences.
Is that what you're looking for?

If that's not the case, I'll blame it on the time, (A)
It's almost 4AM here, :P

Regards
/Feelay
You have given me some light but this is not the exact solution. I do not want first <strong> child of every element to be of that specific design. I want first <strong> child of div.summary to be of that particular design.

Share this post


Link to post
Share on other sites

I made a quick research and found a reference guide on the following website:
W3.org - Child-Selectors
W3.org - First-Child

I made a quick example on my local PC, and this is the important part of the code. It works, and I think this is exactly what you want:

<head>	<style type="text/css">		div.summary > strong:first-child		{			color:red;		}	</style></head><body>	<div class="summary">La<strong>lalal</strong>La<strong>lalal</strong></div></body>

Now what will happen here is that the first strong element will make the text red, while the second strong element will do what it usually does, making text bold.
I hope this is what you are looking for.

Regards,
/Feelay
Edited by Feelay (see edit history)

Share this post


Link to post
Share on other sites

I made a quick research and found a reference guide on the following website:

W3.org - Child-Selectors

W3.org - First-Child

 

I made a quick example on my local PC, and this is the important part of the code. It works, and I think this is exactly what you want:

 

<head>[tab][/tab]<style type="text/css">[tab][/tab][tab][/tab]div.summary > strong:first-child[tab][/tab][tab][/tab]{[tab][/tab][tab][/tab][tab][/tab]color:red;[tab][/tab][tab][/tab]}[tab][/tab]</style></head><body>[tab][/tab]<div class="summary">La<strong>lalal</strong>La<strong>lalal</strong></div></body>

Now what will happen here is that the first strong element will make the text red, while the second strong element will do what it usually does, making text bold.

I hope this is what you are looking for.

 

Regards,

/Feelay

That was really nice and it has solved my problem

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.