Applying style to first para only

This is a discussion on "Applying style to first para only" within the Web Page Design section. This forum, and the thread "Applying style to first para only are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Feb 27th, 2007, 23:22
Junior Member
Join Date: Dec 2005
Location: Aberdeen
Age: 25
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Applying style to first para only

Hi,

I've looked through a good few tutorials and CSS reference guides, and tried searching for this problem but had no luck.

Basically, I'm designing a Joomla template, and the paragraph I am trying to style is part of the generated content so I have no access to the html, so I can add a class.

There are 2 paragraphs within a <td>, and the first one is a heading, so I would like to style that seperately from the second paragraph, which is the content.

Am I right in thinking there is a way of only applying style to the first instance of a tag within another tag? Or have I just made that up?

Any help greatly appreciated!

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 27th, 2007, 23:28
BGarner's Avatar
Reputable Member
Join Date: Oct 2006
Location: In front of the computer.
Posts: 213
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Applying style to first para only

You can't edit the html? That kind of screws you up a bit when trying to style only one paragraph. Can you post the generated html code?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 27th, 2007, 23:34
Junior Member
Join Date: Dec 2005
Location: Aberdeen
Age: 25
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Applying style to first para only

Yeah tell me about it, 2 second job to sort if I could edit the HTML!

HTML: Select all
		<div id="main">			<div class="frame">				<div class="bg">								<table cellpadding="0" cellspacing="0" class="moduletable">					<tr>				<th valign="top">					Newsflash				</th>			</tr>					<tr>			<td>						<table class="contentpaneopen">				<tr>			<td valign="top" colspan="2">				<p>Latest event</p><p>The latest Cash In Your Pocket event is to be held in Northfield. Click for more</p>			</td>		</tr>
I know that .contentpanopen tr td p {} would allow me to style the paragraphs, but it would do both of them.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Feb 27th, 2007, 23:39
BGarner's Avatar
Reputable Member
Join Date: Oct 2006
Location: In front of the computer.
Posts: 213
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Applying style to first para only

Can "<p>Latest event</p>" not be changed to something like "<h2>Latest event</h2>"? Then you could style the h2 or whatever.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Feb 27th, 2007, 23:43
Junior Member
Join Date: Dec 2005
Location: Aberdeen
Age: 25
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Applying style to first para only

No, unfortunately not. The furthest into the above code that I have control over the HTML is to the <div class="bg"> tag.

I had it in my head that were was a way of applying a style to the first instance of a tag only. But after a whole lot of searching I can't find anything, so I'm starting to think I've imagined reading it before!!

Cheers for the replies.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Feb 27th, 2007, 23:52
BGarner's Avatar
Reputable Member
Join Date: Oct 2006
Location: In front of the computer.
Posts: 213
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Applying style to first para only

Yeah I've googled it a couple of times and I can't find anything.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Feb 28th, 2007, 10:28
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Applying style to first para only

http://www.w3.org/TR/REC-CSS2/selector.html

These will help you, but they're support is extremely limited. No go in IE. If you can add JavaScript, you can do it with that. Otherwise, you're out of luck.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
first, instance, styling, tag

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to tell IE7 to use a pariticular style in a single style sheet figo2476 Web Page Design 5 May 25th, 2007 14:23
Font Color Not Applying! Please Help!! tobymather Web Page Design 9 Apr 13th, 2007 23:59
Rollover behaviour applying to whole div-HELP tobymather Web Page Design 7 Apr 13th, 2007 23:52
Dreamweaver Templates - applying to batch pages wheatus Web Page Design 0 Apr 15th, 2004 12:18


All times are GMT. The time now is 16:28.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42