473,405 Members | 2,349 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,405 software developers and data experts.

Please, help me vertically fit text into an inner DIV

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>
<td width=49px height=14px valign=middle>SHIPVIA</td>
</tr>
</table>
</div>
</div>
<div class=c6bg style="top:202px;left:643px;width:80px;height:30px ;">
<div class=c6fg style="top:7px;left:2px;">
<table><tr>
<td width=74px height=14px valign=middle>EMPLOYEEID</td>
</tr>
</table>
</div>
</div>
where these are the styles

<style type="text/css" media="screen">

..c6bg{position:absolute;background:#B8860B;border-width:1px;border-style:outset;}
..c6fg{position:absolute;border-width:0;color:#FFFFFF;background:transparent;text-align:center;font-family:Tahoma;font-size:11px;font-weight:bold;}
..c7bg{position:absolute;background:#DAA520;border-width:1px;border-style:outset;}
..c7fg{position:absolute;border-width:0;color:#FFFFFF;background:transparent;text-align:center;font-family:Tahoma;font-size:11px;font-weight:bold;}

</style>

The outer DIV represents the "background" of the cell, while the
inner (with background:transparent) represents
the "foreground".
The foreground needs to be sometimes vertically centered
(valign=middle). Some other times it needs to be Top or Bottom. I did
that using a <TABLE>.

** Question ***

I feel I am not doing this right. In particular I would like to get
rid of that ridiculous table thingy

<table><tr>
<td ... valign=middle>text</td>
</tr>
</table>

and still to be able to vertically center/top/bottom the text.

How can transform this poor code in some nice CSS? I need actual code
suggestions which work with Firefox and IE, at least. Thanks

If you see other things that are wrong please do advise.

-P

Sep 7 '06 #1
0 2288

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...
1
by: Vancer | last post by:
I am having trouble vertically positioning text in a simple table layout using background css images. I need the Page1 , Page2 text to be vertically centred within the table cell. See the...
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.
8
by: Terry | last post by:
Trying my hand at table-less design. Looking for an XHTML 1.0 strict, CSS2 compliant solution. Here's the result I'm looking for: Div I: Some header text DIV II: Some text and a form which...
5
by: Jean Christophe Avard | last post by:
Hi! I have a query that INNER JOIN's three other tables. All the relation are 1 to 1, except for one, where an Item can have more than one price. I have this query that work fine in MSDE Query...
3
by: vtashore | last post by:
I downloaded Steve Leban's RTF2 control and it works as advertised. Good news! After reading reference material on the RTF standard codes, I have been able to write update queries to universally...
4
by: avi | last post by:
Hello, I am trying to vertically center text in a background image, I found a solution on this site that sets the line-height to the height of the background image. This works just fine, except...
1
by: Maxime | last post by:
Hello, I want to make a button that automatically resizes according to the text length and the font size (which can be changed in firefox pretty easily with the browser). The button already...
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: 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
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...
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
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,...
0
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...

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.