473,795 Members | 2,967 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3169
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
5750
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 vertical align doesn't work in Mozilla): http://zintel.com/homepics.html I've used combinations of <center>, style align 'center', table cell align, valign and height='100%' to get what I want, but I wonder if CSS can do it by itself.
16
2184
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
9257
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
26875
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
1658
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 in the middle of the browser's viewport, both horizontally AND vertically. The site I'm building requires that I adhere to the HTML 4.01
11
3072
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 problems, but it caused my ability to center Tables vertically to disappear. If I remove that top line, all is good. Except for my previous inheritance problems. The thing is my code calls one funtion with the parameter $out_msg which is always in...
3
1977
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 about 20px. the amount of rows in those grids is changing, but the position of each datagrid seems to be fixed. this results in a grid overlaying another one or the space between two grids is way too high.
0
2336
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 class=c7bg style="top:202px;left:585px;width:55px;height:30px;"> <div class=c7fg style="top:7px;left:2px;"> <table><tr>
4
15910
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 the number 1 will be atop the first radio button starting at the left. Any thoughts on how to achieve this? <html> <head> <title></title> <style type="text/css">
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10436
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.