Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > paddings or margins

Reply
Thread Tools

paddings or margins

 
 
Jon Slaughter
Guest
Posts: n/a
 
      03-23-2007
For my page I used padding to position some elements properly(I could not
set there position directly cause it just wasn't working right. Setting left
would not work but using padding-left does) and I'm wondering if I should
instead have used margins? Would there be any reason not to using padding
and if so would there be any preference to using margins? Or just I just try
and find a better way?

http://www.jonslaughter.com/MyPage.html

Maybe someone who has a little free time and doesn't mind could take a look
at the code and see if there is any better way I could achieve the same
effect. I'm a little worried about sorta hacking things to make it work. It
does work with firefox 2 and IE7 but I'd like it to work with other browsers
if possible(if I would just need to change a little code to make it so).

For example, I use the css attribute height and width but I can also set the
height and width in the html tag directly. Which one do I use? Do I use
both? (for web browsers that don't use CSS). Ofcourse if its to much
trouble to make it compatible with netscape navigator 3.2.1.23324 then I'm
not going to worry about it.

Thanks,
Jon


 
Reply With Quote
 
 
 
 
Ben C
Guest
Posts: n/a
 
      03-23-2007
On 2007-03-23, Jon Slaughter <> wrote:
> For my page I used padding to position some elements properly(I could not
> set there position directly cause it just wasn't working right. Setting left
> would not work but using padding-left does) and I'm wondering if I should
> instead have used margins? Would there be any reason not to using padding
> and if so would there be any preference to using margins? Or just I just try
> and find a better way?


See http://www.w3.org/TR/CSS21/box.html

left only applies to positioned boxes, padding is inside the border,
margin is outside.

> http://www.jonslaughter.com/MyPage.html
>
> Maybe someone who has a little free time and doesn't mind could take a look
> at the code and see if there is any better way I could achieve the same
> effect. I'm a little worried about sorta hacking things to make it work. It
> does work with firefox 2 and IE7 but I'd like it to work with other browsers
> if possible(if I would just need to change a little code to make it so).
>
> For example, I use the css attribute height and width but I can also set the
> height and width in the html tag directly. Which one do I use? Do I use
> both? (for web browsers that don't use CSS).


Use CSS. If the browser doesn't use CSS it's probably better to let it
decide what heights and widths (sounds, frequencies, ...) to make
things itself.
 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      03-23-2007
On 23 Mar, 12:42, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote:
> For my page I used padding to position some elements properly


Interesting use of "properly" there.

Stop typing. Read a tutorial. You're not going to get anywhere useful
by just twiddling a property at a time and seeing what happens.

Lie & Bos' book "Cascading Style Sheets" is good, as it O'Reilly's
"Head First HTML with CSS & XHTML". There's also an excellent CSS
positioning tutorial on http://brainjar.com/css/positioning/

In general though, leave padding alone and do most stuff with margins.
Remember that vertical margins collapse, sides don't. Be careful if
you ever change the position property. Float isn't intended for what
you seem to think and using it reliably isn't as simple as you might
expect.

 
Reply With Quote
 
 
 
Reply

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with margins, paddings, divs and floats! PLEASE HELP! Agix HTML 7 05-10-2007 10:38 PM
Firefox screwing with my style sheet margins! Bill Firefox 14 11-18-2005 03:30 PM
MARGINS NOT ALIGNING WHEN RECEIVED BY EMAIL Tony Microsoft Certification 1 04-12-2004 12:17 AM
Re: Page Margins on an ASP.NET page Chris D ASP .Net 0 11-19-2003 04:43 PM
Setting margins on an ASP.NET page Keith ASP .Net 1 11-04-2003 05:23 PM



Advertisments
 



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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57