/    Sign up×
Community /Pin to ProfileBookmark

Removing spacing between inline elements and positioning divs straight.

[url]http://crytekuk.info/[/url]

On there you will see in the bottom left corner what is supposed to be a bar. The problem is it isn’t very much like a bar. The html consists of a div container which is mainly used to position the bar as fixed. And then there are images to separate other divs which are used to contain links. The images and divs have spaces between them for some reason. The divs then aren’t properly in-line. They seem to both drop slightly and then the background image doesn’t stretch to be straight with the rest of the bar.

For quickness the HTML is this:

[code=html]<div id=”fim”>
<img id=”buttons_load” src=”http://crytekuk.info/wordpress/wp-content/plugins/fixed_interactive_menu/styles/Blue_glass/load.gif”></img>
<img class=”fim_null_spacer” src=”http://crytekuk.info/wordpress/wp-content/plugins/fixed_interactive_menu/styles/Blue_glass/spacer_left.png”></img>
<div class=”fim_link_container”>
<a id=”toggle_link” href=”javascript:toggleimg()”></a>

</div>
<img class=”fim_null_spacer” src=”http://crytekuk.info/wordpress/wp-content/plugins/fixed_interactive_menu/styles/Blue_glass/spacer_right.png”></img>
<img class=”fim_null_spacer” src=”http://crytekuk.info/wordpress/wp-content/plugins/fixed_interactive_menu/styles/Blue_glass/spacer_left.png”></img>
<div class=”fim_link_container”>
<a id=”new_background” href=”javascript:set_background()”></a>
</div>
<img class=”fim_null_spacer” src=”http://crytekuk.info/wordpress/wp-content/plugins/fixed_interactive_menu/styles/Blue_glass/spacer_right.png”></img>
<img class=”fim_background_grey” src=”http://crytekuk.info/wordpress/wp-content/plugins/fixed_interactive_menu/styles/Blue_glass/background_grey.png”></img>
</div>
[/code]

NOTE: fim_null_spacer changes by javascript to fim_spacer.

CSS:

[CODE]#fim{
position:fixed;
left:0px;
bottom:0px;
opacity: 0.7;
height: 20px;
background: transparent;
z-index:100;
}
.fim_link_container{
margin: 0px;
display: inline;
height: 100&#37;;
background:transparent url(“<? echo $wpu; ?>/fixed_interactive_menu/styles/<? echo $ft ; ?>/background_blue.png”) repeat-x;
border-spacing:0px;
}
.fim_link_container a{
color: #FFF;
font-size: 12px;
padding: 4px 0px;
border-spacing:0px;
}
#buttons_load{
height: 100%;
background:transparent url(“<? echo $wpu; ?>/fixed_interactive_menu/styles/<? echo $ft ; ?>/background_grey.png”) repeat-x;
}
.fim_null_spacer,.fim_spacer,.fim_background_grey,.fim_background_blue,#buttons_load{ /* Reset annoying CSS set by themes */
margin: 0px;
padding:0px;
border-spacing:0px;
}
.fim_null_spacer{
width: 0px;
}
.fim_spacer{
height: 100%;
}
.fim_background_grey{
width: 100%;
}[/CODE]

Thank you for any help given.

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@god0fgodauthorJun 18.2009 — It seems that one of the problems is because the background image doesn't scale. I used a 100px height in case I ever wanted the bar to be bigger. I may have to compromise. I believe CSS3 will have better background properties but browsers use none of it yet. It's a big nuisance. It doesn't explain the space problem though.

Hmm, I could try putting an img in their but how I would do that I don't know.
Copy linkTweet thisAlerts:
@god0fgodauthorJun 21.2009 — Read the bottom of this - http://209.85.229.132/search?q=cache:MElj6JrhfyAJ:www-sul.stanford.edu/tools/tutorials/html2.0/img.html+spaces+between+inline+images&cd=2&hl=en&ct=clnk&gl=uk&client=firefox-a

It explains the unwanted space issue. It's bloody stupid, how that could happen.

Why can't I simply tell what the browser to do and it does it accurately? Why do browsers add rubbish to everything?

Anyway, I've almost fixed everything through strange ways. Doesn't matter that they are weird, at least they work.

Okay, It works.

Other things I have done to get it to work were using vertical-align:5px; to lift the links from the bottom and using padding:10px 0px; to spread the background image across the toolbar height (20px).

Don't use display: inline-block; It didn't work for me. I couldn't use margin-bottom for example with it to lift the links.

But now it works, it's great.... I do have to test it on other browsers though. *gulp*
×

Success!

Help @god0fgod spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...