By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,203 Members | 1,392 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,203 IT Pros & Developers. It's quick & easy.

Gap between images

P: 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
Share this Question
Share on Google+
5 Replies


kestrel
Expert 100+
P: 1,071
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

P: 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
Expert 100+
P: 1,071
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
Expert 2.5K+
P: 4,258
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
Expert 5K+
P: 7,435
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.