Solved

Positioning of Graphics

Posted on 1998-10-10
11
237 Views
Last Modified: 2010-04-09
I have two, somewhat related, questions concerning placing graphics on a web page.
1. I would like to place an image at the very top-left of my page, but when I view it in Netscape it appears that there are about 5 or so pixels "border" between the edge of the screen and where my graphic image starts.  (This is not inside a table.)
2. Can I place one image on top of another without resorting to layers?  I'd like to maintain maximum compatibility with older browsers.

Thanks.
0
Comment
Question by:thartin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 10

Expert Comment

by:MasseyM
ID: 1838601
1) you can use the CSS positioning <IMG SRC="image.gif" STYLE="left:0;top:0;margin-left:0;margin-top:0;">

2) This will not work with the older browsers... You can only do this with CSS.
0
 

Author Comment

by:thartin
ID: 1838602
I kinda thought that I wouldn't be able to overlap graphical images without layers.  

Using CSS positioning to nudge my graphic up into the top left corner has the same drawback, however, in that only newer browsers will be able to read it.  Is there no other way (besides frames)?
0
 

Author Comment

by:thartin
ID: 1838603
< see last comment >
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:jbirk
ID: 1838604
There is another way to make it appear in the upper left corner but it too is 4.0+ browser compatible only.  MasseyM has answered the question as best as it can be answered.  (Apparently before 4.0 browsers there were no graphic designers working with the coders of the browsers, because you sure didn't have very much control over the design/layout of the page.)
0
 
LVL 28

Expert Comment

by:sybe
ID: 1838605
1. use the image you want to position in the top-left as a backgrund in the body tag. The problem is that it will repeat itself when it's bigger then the doecumtn it is displayed in. So make the image bigger then the page, if you don't want it to be repeated. Disadvantage: lots of kb's.
2. When you use an image as background, you can place another image over it without using layers.
0
 

Author Comment

by:thartin
ID: 1838606
Thanks for the suggestion, but it won't work for what I'm doing since I already have a different background image.
0
 

Expert Comment

by:tunct
ID: 1838607
Face it, I'd say... there is no way to put images without margins in older browsers other than using the background. Bummer...

T.
0
 
LVL 2

Accepted Solution

by:
Grdv earned 150 total points
ID: 1838608
1)use this in you body tag
topmargin=0 leftmargin=0 marginwidth=0 marginheight=0
if your using frames then in the frameset you should also specify
framespacing=0
then to place the image correctly, use a table:
<table>
<tr><td valign="top" align="left"><img src="whatver.gif" name="whatever"></td></tr>
</table>

2) then the only posability in older browsers also (NS3) to change the image is to refer to it in javascript and set the source of the object like this
document.images["whatever"].src="whatever2.gif";

I think that should be a reasonable answer??

// Grdv
0
 
LVL 2

Expert Comment

by:Grdv
ID: 1838609
oops, forgot to mention that inside the table tag, you should have:
cellpadding=0 cellspacing=0 topmargin=0 leftmargin=0 border=0
that's it...
0
 

Author Comment

by:thartin
ID: 1838610
Very good!  And to think I was almost about to give up and delete the question!

A couple notes: you don't appear to need the TOPMARGIN and LEFTMARGIN parameters within either the TABLE or HEAD tags for it to work.  You do, however, need all the other parameters included (as per your answer).  And for some reason, this seems to have applied itself to my other tables further down the page, but I'm sure I can get them back to normal.


Thanks!
0
 
LVL 2

Expert Comment

by:Grdv
ID: 1838611
TOPMARGIN and LEFTMARGIN is different in different browsers...
and
all those other parameters you can alter anyway you want further down... :)

//Grdv
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question