469,938 Members | 2,496 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,938 developers. It's quick & easy.

Gap between images

5
Hi All,

I'm coding a page in which I would like a .js menu to overlay an image. The problem is this: putting the menu between two images gets it to appear where I want it, but it also creates a tiny gap between my two images, making it so they don't match up anymore. Currently using java to generate the images as well. I'm fairly new to both css and java, but I'm hoping I can css it with some sort of positioning code.
Any help would be greatly appreciated. My code is as follows:

<script LANGUAGE="JavaScript1.2">
<!-- Begin
if (screen.width >= 1024) {
document.write("<img src='topbar1024.jpg' width=100% border=0>");
}
else {
if (screen.width == 800) {
document.write("<img src='topbar800.jpg' width=100% border=0>");
}
}
// End -->
</script><center><script language="javascript" src="menu.js"></script></center><script LANGUAGE="JavaScript1.2">
<!-- Begin
if (screen.width >= 1024) {
document.write("<img src='menubar1024.jpg' width=100% border=0>");
}
else {
if (screen.width == 800) {
document.write("<img src='menubar800.jpg' width=100% border=0>");
}
}
// End -->
</script>
Oct 20 '06 #1
5 2923
kestrel
1,071 Expert 1GB
look, since you're using javascript, dont put them in separate tags (<script></script>)
you're going to want to combine them all in the <head> of your html page, and just call the function where you want them to appear
get what im saying?
Oct 20 '06 #2
Wolff
5
Can I call a .js file in the same script I'm using to choose an image? How would I write that?
Oct 20 '06 #3
kestrel
1,071 Expert 1GB
are you talking about external javascript(.js) files?
heres how you would do that:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" src="script.js"></script>
  2.  
then for example you want to call a script
you bould just put into your <body>
<body onload="nameofscript()">
make any sense?
Oct 21 '06 #4
ronverdonk
4,258 Expert 4TB
Well, I just had the same problem with concatenating images and giving a style in the image stmt with a negative right margin helped.
[html]<img style="margin:0 -4px 0 0;padding:0;" src="xxxxx">
[/html]

Ronald :cool:
Oct 21 '06 #5
drhowarddrfine
7,435 Expert 4TB
I haven't followed this because I thought it was all js talk but if the problem is the image not aligning correctly then it could be it's lining up with the text baseline. To fix this in the css just add vertical-align:bottom; to the image and see if that fixes it.
Oct 21 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Simon | last post: by
10 posts views Thread by Neo Geshel | last post: by
2 posts views Thread by mouseit101 | last post: by
reply views Thread by Frenchie | last post: by
1 post views Thread by Cerebral Believer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.