Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Old 12-19-2010, 04:06 PM styling empty p tags
Ultra Talker

Posts: 254
Trades: 0
i am using the following for p tags
p{
margin: 0 0 8px 0;
line-height: 18px;
}

with this each para has a line height and margin between paragraphs

however in the html editor where the content is written when i add spaces empty <p></p> tags are being created by the editor and with the above style for p tags there is lot of unwanted vertical gaps being created

is there a way to style empty <p></p> tag so that these vertical gaps will not be created



also i am using a separate css for printing when i print in firefox i have set the url to print at top right and if the url is too long only a portion of the url is being printed, is there a way to print the entire url or is this a normal printer behaviour to print the url to whatever extent the width is available
sudhakararaog is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-19-2010, 04:23 PM Re: styling empty p tags
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,376
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
set margins, padding, height, line-height & font-size to 0

then style the ones you do need.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-19-2010, 04:31 PM Re: styling empty p tags
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Mozilla took up this issue with its :empty pseudo-selector, but unfortunately other browser vendors have not followed suit, and it has not been standardized either.

If you use jQuery you could do something like this:
Code:
$(document).ready(function() {
    $('p:empty').css({margin: 0});
});
This will only work with JavaScript enabled of course. Don't do the same thing in your stylesheet, however, as I just read that Safari will then apply this style to every P element.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.

Last edited by wayfarer07; 12-19-2010 at 04:33 PM..
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 12-20-2010, 02:23 AM Re: styling empty p tags
Super Moderator

Posts: 1,584
Location: Kokkola, Finland
Trades: 1
remove the unwanted <p> tags
davemies is offline
Reply With Quote
View Public Profile Visit davemies's homepage!
 
Old 12-20-2010, 10:10 AM Re: styling empty p tags
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Agreed.. remove the unwanted <p> tags. Let me guess, you're using Dreamweaver - because DW does that when you hit enter between paragraphs, creating it's usual messy code. I believe you can make it stop doing that in the preferences.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to styling empty p tags
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.51812 seconds with 12 queries