473,395 Members | 1,516 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,395 software developers and data experts.

Vertically aligning to the middle in a fixed div?

Hi.

I've got a few divs on a page that are positioned as "fixed". I now want
my text to centre itself both horizontally and vertically. "text-align:
center" on the body works for horizontal, but I can't seem to get the
text to move from the top of each div. Any suggestions?

Incidentally, the page layout I'm aiming for is as follows:

..-------------------------------------------.
| .-------.-------.-------. |
| | | | | |
| | TXT | TXT | TXT | |
| | | | | |
| |-------+-------+-------| |
| | | | | |
| | TXT | TXT | TXT | |
| | | | | |
| |-------+-------+-------| |
| | | | | |
| | TXT | TXT | TXT | |
| | | | | |
| |-------+-------+-------| |
| | Extra centered text | |
| '-----------------------' |
'-------------------------------------------'

The outer rectangle is supposed to be the viewport. This is easy with
tables, but I'm currently using fixed divs for the ten rectangles. Is
there a better way to do this?

Thanks,

Iain Hallam.
Jul 20 '05 #1
2 3154
On Mon, 01 Mar 2004 16:41:03 +0000, Iain Hallam wrote:
I now want
my text to centre itself both horizontally and vertically.


http://www.quirksmode.org/css/centering.html
http://www.wpdfd.com/editorial/thebox/deadcentre4.html

--

..

Jul 20 '05 #2
Vigil wrote:
Iain Hallam wrote:
I now want my text to centre itself both horizontally and vertically.

http://www.quirksmode.org/css/centering.html
http://www.wpdfd.com/editorial/thebox/deadcentre4.html


Thanks - that's got it working, although I've had to go back to a table
design. The markup is much smaller and the CSS less twisted with a table
for this site.

- Iain.
Jul 20 '05 #3

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

Similar topics

19
by: George Ziniewicz | last post by:
.. I try to use CSS when possible, though I am still learning and don't maximize its use. In particular, I still use a table to provide for a centered image in a few slideshows (though table...
16
by: C.W | last post by:
I have a top box element that houses the web site title: #top_section { height: 20px; padding: 10px; text-align: left; background: navy; color: white; }
27
by: FL | last post by:
Hi Everyone, I know howto center a block using margin-left: auto ; margin-right: auto ; but I'm trying to center vertically a box, any idea to solve this?
10
by: john T | last post by:
Is there anyway to vertically center a html table using css in such a way it does not alter the html table. When I tryied it just screws up.
7
by: Scott Teglasi | last post by:
Hi all, I was curious as to how others whom have dealt with this problem have handled it. The problem is that I have a site design of a fixed width and height and want to center that content...
11
by: Serg | last post by:
I had some CSS problems, and they were solved by someone who pointed out to me that I should have <!DOCTYPE ..... at the top of my code, which I now do. And it fixed all the inheritance...
3
by: Mark Wiewel | last post by:
hi all, i am a newbie in ASP.NET and i couldn't find the solution to this one: i have a form with three datagrids on it. i would like to align them vertically with a space between each grid of...
0
by: pamelafluente | last post by:
Hello experts, I need some help to do in a proper way what I am doing. I have some "cells" in a web page. Each "cell" is made of 2 DIV. One is inside the other. Example with 2 "cells" : <div...
4
by: Greg Scharlemann | last post by:
I'm having difficulty getting the radio buttons to align vertically with one another and the header (1 2 3 4 5) at the top. Ideally each radio button will be directly below the one above it and...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.