Solved

Positioning of Graphics

Posted on 1998-10-10
11
224 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
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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?
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

809 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