Solved

Positioning of Graphics

Posted on 1998-10-10
11
203 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
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now