Jump to content

3 Divs Left Center Middle behaving wierdly

Recommended Posts

Hi All,

Much has been learnt and heaps of progress has been made since my last post,

Coming across something weird now however.


If you inspect my test site here http://mrt.guardian1.com.au:57005/test2/index_template.php

you will see that in the footer I cannot seem to get the 3 divs to allign.


Can someone please point me in the right direction on what css to apply.


Specifically this is the HTML for the footer

<div data-role="footer" class="footer" data-id="footer" data-position="fixed">	<div>	<div>	<button onclick="history.go(0)" class="medbtn ui-btn ui-corner-all ui-icon-refresh ui-btn-icon-left" data-role="button" data-icon="refresh" >Refresh</button>	<button id="gps_address" class="medbtn ui-btn ui-corner-all ui-icon-navigation ui-btn-icon-left" data-role="button" data-icon="refresh" >Current Location ?</button>	</div>	<div class="center">	<label>YCH-882</label>	</div>	<div class="time right">	<span id="time" /><script src="custom/time.js"></script>	</div>	</div></div>

and this is the css

.footer{	display: block;	}.time{	margin-right:15px;	margin-top:8px;	}.right{	text-align: right;}.center{	text-align: center;}
Link to post
Share on other sites

They are block elements. Block elements always take the full width of their container and they stack vertically, so one is ontop of another and they don't share horizontal space.


What you could do is to float them left and give them a 33.33% width. You would have to remove all margin and padding for that. You can put margin and padding on elements inside the boxes.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...