[thelist] css - margin-right property

rudy limeback r937 at interlog.com
Wed Aug 23 08:41:45 CDT 2000


>ok this should be mega easy for most of you.

hi lisa

css is easy until you come to the part that you don't know

;o)


> I am virtually just beginning learning css.
> I have an image in a table. The table is 100% the image right aligned.
> In IE the image goes right to the edge of the browser window.
> In Netscape it does not. I presume the only way to do this is with css.

no, you can do it without css too, but it's always a good idea to try stuff
in css first

you might even need a mix of css and non-css to make something work


>I have made an external style sheet in notepad.
> So far it only contains the following:
>BODY {margin-right: 0}
>Do I have to specify a length such as px to make it work?

no, what you have is fine -- at least, it should be


>Also have I linked the css file correctly to the page?
>I wrote:
><LINK rel="stylesheet" type="text/css" href="lawton.css"> and put it in
the
>head section.

yes


>The page I am working on can be found at www.lawtonasia.com/test
> I want the navigation bar to go to the right edge of the page.

lisa, i hope you don't mind, but you have a couple other problems with this
page that should be fixed

you have a horizontal scrollbar at 800x600 because of the way you coded
your table cell widths

your background gradient jpeg jarringly disrupts your navigation bar at
1024x768

now, to your actual question...

as far as i can tell the nav bar is properly right align in the table

<tip>
always include hspace=0 and vspace=0 for images which have to touch
something like a table cell wall or another image
</tip>

but getting the nav bar to touch the right edge of the page is not really
what you want

for proof of this outrageous statement, i cite as evidence the h1 that is
just over your nav bar

   <h1 align="right"><font face="Arial, Helvetica, sans-serif"
        size="2" color="#666666">Lawtonasia is a leading provider
        of specialist financial planning<img src="images/spacer.gif"
        width="10" height="8"><br>
        services to expatriates and international
        investors.</font><font face="Arial, Helvetica, sans-serif"
        size="3" color="#666666"><img src="images/spacer.gif" width="10"
        height="1"><br>
        <img src="images/spacer.gif" width="10" height="1"></font></h1>

presumably the 10-pixel shims are intended to get the words *away* from
the right browser window, presumably for readability purposes -- and this
is A Good Thing (tm)

for the same reason, you don't want the words "What's New" in your nav bar
to be too close to the edge, either

i think the only part that might be bothering you is the little blue
gradient bar "behind" the round buttons, and i think this was supposed to
blend in with the gradient of the background image, right?

you may want to have a look at your page in several different resolutions

the answer to your immediate problem would be to make the bar part of the
nav bar image transparent

but you should really address the background image problem -- you might not
need to override browser margins after all...

;o)

by the way, in your body tag --

    <body leftmargin="0" marginwidth="0" topmargin="0" rightmargin="0"
        bgcolor="#FFFFFF" background="images/bggradiant.jpg"
        marginheight="0"
        text="#666666" link="#99CCFF" vlink="#999999" alink="#99CCFF">

you have 5 margin attributes   ;o)


lisa, i hope i'm not coming across as negative, by just finding things that
are wrong with your code

making the transition to css is really easy -- once you've done it

doing it the first time can be a pain


if you want to try setting margins with css, first take those margin
attributes out of the body tag, then use the style

   BODY { margin: 0 }

and if it doesn't work, go look up why

<tip>
for css bug help, see http://richinstyle.com
</tip>


to make a long story short (i know, it's too late for that) --


patient: "doc, it hurts when i do that"

doctor: "don't do that"


;o)








More information about the thelist mailing list