| Author |
Menu image positioning
|
Srikkanth Mohanasundaram
Ranch Hand
Joined: Feb 07, 2007
Posts: 185
|
|
Hello all,
I've a menu of items to be displayed , so I'm making use of the UL LI tags to build the list and apply appropriate styling to them. The HTML list i'm using would roughly look like this
The li item marked with class name parent has CSS definition with a background image (something like the expand image or plus image) . I would want check for the onclick event on this image (I guess it cannot be done,since the image is not a part of the DOM) and call a function which would expand the node. Since i was not able to do it, i tried with something similar to this (changed the HTML on line no. 5 in the previous snippet)
But as you would have guessed ,i didn't get the image to position properly . It was like, the image was on one line and the the span gets rendered in the next. I need them to be inline. Can someone let me know on how it should be done?
Thanks,
Srikkanth
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
Try to use style="float:left" with your image...
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
Srikkanth Mohanasundaram
Ranch Hand
Joined: Feb 07, 2007
Posts: 185
|
|
Thanks Ankit that helped. I was under the impression that image elements would display inline. Can someone explain?
Thanks,
Srikkanth
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
|
They will generally display inline, unless something else acts upon them, or the browser decides it needs to wrap for some reason.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Srikkanth Mohanasundaram
Ranch Hand
Joined: Feb 07, 2007
Posts: 185
|
|
Thanks Bear. I will check if there is some other conflicting CSS rule.
Thanks,
Srikkanth
|
 |
 |
|
|
subject: Menu image positioning
|
|
|