/    Sign up×
Community /Pin to ProfileBookmark

replace ‘P’ tag with a class?

Hi everyone,

I’m bug fixing on a site that has div’s nested within paragraph tags which don’t comply to xhtml validation. I want to create new classes that match what a P tag does. Does anyone know what properties the ‘P’ tag has? i.e. padding:5px?

Thanks in advance.

?

to post a comment
CSS

11 Comments(s)

Copy linkTweet thisAlerts:
@FangJul 07.2008 — Padding varies between browsers. Set it to your own requirements.
Copy linkTweet thisAlerts:
@CentauriJul 07.2008 — What a <p> tag "does" is denotes a paragraph of text. How it is normally rendered is up to the browser, but typically it is rendered as a block element with top and bottom margins, which as Fang has suggested, varies between browsers.
Copy linkTweet thisAlerts:
@Declan1991Jul 07.2008 — Why would you want to have a div inside a paragraph element?
Copy linkTweet thisAlerts:
@jgs240Jul 08.2008 — Why would you want to have a div inside a paragraph element?[/QUOTE]

If i read it correctly, i think he is trying to fix that problem. ?
Copy linkTweet thisAlerts:
@felgallJul 08.2008 — The needed fix is to get rid of the div tag (unless the "paragraphs" are not really paragraphs and that tag has been misused). Anything inside a paragraph needs to be inline within the paragraph and a div tag can't be inline (unless you are overriding it in the stylesheet to make it identical to a span tag).
Copy linkTweet thisAlerts:
@Declan1991Jul 08.2008 — If i read it correctly, i think he is trying to fix that problem. ?[/QUOTE]
I was trying to find out which was incorrect, the p or the div. Depending on that, the solution is totally different.
Copy linkTweet thisAlerts:
@CentauriJul 08.2008 — I was trying to find out which was incorrect, the p or the div.[/QUOTE]

That depends totally on the content contained within.
Copy linkTweet thisAlerts:
@sollyauthorJul 08.2008 — Hi guys, thanks for the replies, it's much appreciated.

I'm bug fixing for British Airways and some of the development is slightly unorthodox hence the div inside the p tag. I've managed to sort it out anyway, I just added padding at 10px 10px 0px and it looks exactly the same in IE and FF.

Much appreciated. ?
Copy linkTweet thisAlerts:
@felgallJul 08.2008 — Adding padding doesn't sound like a valid fix for having a div inside a p where it isn't allowed. You either have to change the div to a span or change the p to a div.
Copy linkTweet thisAlerts:
@sollyauthorJul 10.2008 — I've changed the P to a class in my .css and the <p> to <div class="paraFix"> and it's working fine now, thanks for the brainstorm fellas.
Copy linkTweet thisAlerts:
@felgallJul 10.2008 — A more meaningful name for the class would make it easier to maintain in the future. The <p> should never have been there in the first place since it isn't a paragraph and so the class name paraFix is somewhat misleading.
×

Success!

Help @solly spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...