Topic: getting div and p to play nice (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=9699" title="Pages that link to Topic: getting div and p to play nice (Page 1 of 1)" rel="nofollow" >Topic: getting div and p to play nice <span class="small">(Page 1 of 1)</span>\

 
warjournal
Maniac (V) Mad Scientist

From:
Insane since: Aug 2000

posted posted 11-13-2003 17:41

I've been awhile from hand coding for a bit, but it's time to get back into it.

I have a div and it's all good. Position, padding, and margins. That is, as long as I use just div and content. Like:

[div] content [/div]

Cool beans. However, I get extra vertical space when I use p with the content:

[div] [p] content [/p] [p] more content [/p] [/div]

That's not good, and I'm not sure about an appropriate fix.

I suppose I could toss in some extra div to replace the p. Something like:

[div1] [div2] content [/div2] [div2] more content [/div2] [/div1]

But I would like to avoid that if there is a better, more "correct" solution.

I suspect something like p.span or p.whatever or something, but I don't know much about these inline things.

Feel free to toss some insight my way.

(Once I get this done, time to dig back into PHP.)

edit:
p.whatever
p class="whatever"
seems to do the job

Now, is there a way to adjust the space between the p tags? A little too far for my tastes.
Hmmm... I've to check the container properties.



[This message has been edited by warjournal (edited 11-13-2003).]

MajorFracas
Nervous Wreck (II) Inmate

From:
Insane since: Jul 2003

posted posted 11-13-2003 17:58

The p tag may be providing its own vertical spacing. Make sure that padding and margins for p tag are zero and then see where you stand. You may also want to set padding to 0 for the div as well...

code:
div {
padding: 0;
}

p {
padding: 0;
margin: 0;
}



warjournal
Maniac (V) Mad Scientist

From:
Insane since: Aug 2000

posted posted 11-13-2003 18:02

Damn. You beat me to it.

Yeah, all I had to do is adjust margin/padding for p.whatever.

Normally I'm not such an idiot and don't jump the gun so quickly. But, it's been known to happen.

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 11-13-2003 18:34

Yeah, it's always a good idea to specify such things for all of your block level elements, because each browser will have its own default.

So not only will it do things you don't want it to, it will do them differently in each browser

EDDII
Nervous Wreck (II) Inmate

From:
Insane since: May 2004

posted posted 05-03-2004 21:25

you could try br instead of p

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 05-04-2004 01:13

That would be a terrible, terrible thing, and should never be done.

The structure of HTML has been very thoroughly fleshed out, and each tag exists for a reason. They should be used for that reason.

Of course, I'm sure that in the 7 months since posting, this problem has worked itself out.....

krets
Paranoid (IV) Mad Scientist

From: Right-dead center
Insane since: Nov 2002

posted posted 05-04-2004 05:22

...that or there's a great big bloody hole in the middle of wj's desk....

:::11oh1:::

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 05-04-2004 09:57

this reminds me - we need a 'stupid html archive'



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu