Ahsaniqbalkmc 0 Report post Posted December 25, 2010 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"<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
Feelay 0 Report post Posted December 25, 2010 (edited) 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, Regards/Feelay Edited December 25, 2010 by Feelay (see edit history) Share this post Link to post Share on other sites
Ahsaniqbalkmc 0 Report post Posted December 25, 2010 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, Regards/FeelayYou 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
Feelay 0 Report post Posted December 25, 2010 (edited) I made a quick research and found a reference guide on the following website:W3.org - Child-SelectorsW3.org - First-ChildI 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 December 25, 2010 by Feelay (see edit history) Share this post Link to post Share on other sites
Ahsaniqbalkmc 0 Report post Posted December 25, 2010 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