473,378 Members | 1,489 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Centering floating objects

On the sample page at:

http://olifilth.co.uk/sample.htm

I have some span objects (the boxes) that are CSS-styled with float:
left. Whilst this allows the boxes to automatically wrap as the
browser window is resized, ideally I'd like the boxes to be centered
together on the page, rather than all pushed up to the left.

Is this possible?

Oli
Jul 20 '05 #1
2 3755
Inappropriate crossposting removed.

ol*******@hotmail.com (OliFilth) wrote:
On the sample page at:

http://olifilth.co.uk/sample.htm

I have some span objects (the boxes) that are CSS-styled with float:
left. Whilst this allows the boxes to automatically wrap as the
browser window is resized, ideally I'd like the boxes to be centered
together on the page, rather than all pushed up to the left.

Is this possible?


display:inline-block (CSS 2.1, support is rare).

Note that there are few examples where such a layout would be
appropriate. Show us an example of what you are actually trying to
achieve by using real content.

--
Spartanicus
Jul 20 '05 #2
In article <cd**************************@posting.google.com >,
ol*******@hotmail.com says...
On the sample page at:

http://olifilth.co.uk/sample.htm

I have some span objects (the boxes) that are CSS-styled with float:
left. Whilst this allows the boxes to automatically wrap as the
browser window is resized, ideally I'd like the boxes to be centered
together on the page, rather than all pushed up to the left.

Is this possible?


No, unless you know how much space on line of boxes will take.

It is possible to do differently:

..box {display:inline;display7:inline-block;display:inline-
table;width:10em;height:10em;}

Works on IE and Opera. IE because bug on display:inline handling and on
Opera as it supports CSS2 best. Use some gecko specific way to give it
float, and it works nicely. New versions of gecko might support inline-
block or inline-table, haven't checked since firebird.

http://www.student.oulu.fi/~laurirai/www/css/gallery/
Worked in mozilla 1.0, but they fixed one bug and I haven't yet updated
page. (works on IE and Opera since v5 IIRC)

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Andrew Fedoniouk | last post by:
<CITE src="http://www.w3.org/TR/html401/present/graphics.html#h-15.1.3"> 15.1.3 Floating objects Images and objects may appear directly "in-line" or may be floated to one side of the page,...
3
by: Chris | last post by:
Hi, I am pretty new to CSS authoring and find myself in a tricky situation. I have a series of divs (dynamically generated - there could be up to 8) as follows: <div class="person">...
2
by: Lee K. Seitz | last post by:
I stayed up late working on a CGI script and spent some time formatting my page with CSS. It looked fine in IE, which will be 95% of my audience, so I went to bed. Got up and looked at it in...
15
by: red | last post by:
How do I center two side by side divs ? I've been writing css pages for a while but there's one thing tha still eludes me. I can center a div with margin auto. I can place two divs side by side...
4
by: Dave | last post by:
Hi folks, I am trying to develop a routine that will handle sphere-sphere and sphere-triangle collisions and interactions. My aim is to develop a quake style collision engine where a player can...
1
by: OliFilth | last post by:
On the sample page at: http://olifilth.co.uk/sample.htm I have some span objects (the boxes) that are CSS-styled with float: left. Whilst this allows the boxes to automatically wrap as the...
3
by: John Pote | last post by:
1. Horizontal centering a <divin browser window. The current trend seems to be to place page content in a fixed width area in the middle of the browser window. How is this achieved? If I use a...
5
by: Markus Ernst | last post by:
Hello This is a test example: http://www.markusernst.ch/anthracite/ http://www.markusernst.ch/anthracite/living_divani.html After googling and experimenting for several hours, I ended up...
2
by: rudicheow | last post by:
SHORT VERSION ============= I have a bunch of identical fixed-size single-celled tables that rest against each other horizontally thanks to "float:left". These tables are dynamically generated...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.