473,569 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Centering middle cell, code included.

I need to have two different backgrounds, one on the left and one on the
right of the screen, with the main content centered in the browser. This is
the code I have come up with

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="49%" background="lef t.gif"><img src="shim.gif" alt=""
height="1" width="1"></td>
<td width="2%" valign="top"> ALL CONTENT </td>
<td width="49%" background="rig ht.gif"><img src="shim.gif" alt=""
height="1" width="1"></td>
</tr>
</table>

This seems to work perfectly, however I'm slighlty unsure as the numbers
don't add up. Say my Content in the middle cell is a 750 pixel wide nested
table, this would obviously mean that the percentage are not as described.
Is there a chance that certain browsers will choke on this code? and maybe
not display the middle cell in the middle of the page?
Jul 23 '05 #1
5 2062
In article <cl**********@n ewsg4.svr.pol.c o.uk>,
"luke" <lu*********@no emailspam.com> wrote:
I need to have two different backgrounds, one on the left and one on the
right of the screen, with the main content centered in the browser. This is
the code I have come up with

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="49%" background="lef t.gif"><img src="shim.gif" alt=""
height="1" width="1"></td>
<td width="2%" valign="top"> ALL CONTENT </td>
<td width="49%" background="rig ht.gif"><img src="shim.gif" alt=""
height="1" width="1"></td>
</tr>
</table>

This seems to work perfectly, however I'm slighlty unsure as the numbers
don't add up. Say my Content in the middle cell is a 750 pixel wide nested
table, this would obviously mean that the percentage are not as described.
Is there a chance that certain browsers will choke on this code? and maybe
not display the middle cell in the middle of the page?


Wait, you mean, all that when this will do?

CSS:
body {
color: #000;
background: url("750pxwideg reenblock.png") #0000cc repeat-y;
text-align: center;
}
#content {
width: 750px;
margin: 0 auto;
text-align: left;
color: #000;
background: green;
}

HTML:
<body>
<div id="content">
Whatever content you have.
</div>
</body>

--
Kris
<kr*******@xs4a ll.netherlands> (nl)
Jul 23 '05 #2
"Kris" <kr*******@xs4a ll.netherlands> wrote in message
news:kr******** *************** ******@news1.ne ws.xs4all.nl...

Wait, you mean, all that when this will do?


Wait, I think you misread my post!
Jul 23 '05 #3
In article <cl**********@n ews5.svr.pol.co .uk>,
"luke" <lu*********@no emailspam.com> wrote:
Wait, you mean, all that when this will do?


Wait, I think you misread my post!


Maybe. So now what?

--
Kris
<kr*******@xs4a ll.netherlands> (nl)
Jul 23 '05 #4
luke wrote:
<td width="49%" background="lef t.gif"><img src="shim.gif" alt=""
<td width="2%" valign="top"> ALL CONTENT </td>
<td width="49%" background="rig ht.gif"><img src="shim.gif" alt=""
This seems to work perfectly, however I'm slighlty unsure as the numbers
don't add up.
My math says that 49 + 2 + 49 = 100. Seems to add up.
Say my Content in the middle cell is a 750 pixel wide nested
table, this would obviously mean that the percentage are not as described.

Why do you care? You already ignore the percentages to get an
expandable middle section. If the total image widths exceed the viewable
area, the table expands beyond the view.
You'd have to view the result with different browsers to verify how
they handle it.

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 23 '05 #5
luke wrote:
I need to have two different backgrounds, one on the left and one on
the right of the screen, with the main content centered in the
browser. This is the code I have come up with


Join the two backgrounds together using a graphics program then use
Kris' example with this single background.

--
frostie
http://brightonfixedodds.net
Jul 23 '05 #6

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

Similar topics

19
5720
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...
1
7892
by: Kenneth | last post by:
Okay, I've been scouring Google for hours looking for a solution to this problem, but as of yet I can't find one. XHTML Transitional seems to specify that I can no longer set a table's height to 100% and vertically center content inside of it. Therefore, I'm seeking a way, preferably in CSS to vertically center a site. Here's more of a...
3
6106
by: yawnmoth | last post by:
I'm trying to center list elements in a webpage I'm working on, and setting margin-left to auto for ol (or ul) seems to prevent the number (or bullet) from displaying in IE6 (strict mode) and Opera7 (it works fine in Firefox). Any ideas as to why and what I might do to fix it? I've set up a little demonstration of the problem here: ...
1
1868
by: Daniel Déchelotte | last post by:
Hi, This is actually two questions in one: how to have a block just fit the data it contains (see my "table-cell" kludge) and how to have it centered in a larger block? My idea is to have my page split into two columns (each half as wide as the whole page, this is the "bigblock" class), and to have in each of these columns one, typically...
4
5488
by: Daniel Kaplan | last post by:
Hi All, Am trying to vertically center a table, and failing miserably at it. Have tried everything with this: <table border=1 width=100% valign=MIDDLE> taking out width, etc. I just can't get the table to be centered.
2
2152
by: anonymous | last post by:
I have created a DataGrid control with checkboxes, TextBoxes, ComboBoxes, and NumericUpDowns. Since I used the DataGridBoolColumn, the checkbox is displayed in the center of the cell, horizontally and vertically aligned. I want the other cells with data to also be centered so that it is congruent with the checkbox. I'm having problems...
3
4192
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 top level <divthen I can place it with CSS attribute 'left:', but this is a fixed offset. Is it possible to have a <divcentered in the browser window?...
5
4810
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 doing this demo with tables. The main problems are the vertical centering of the info area, and of the text inside the squares.
2
3031
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 and the number of them can vary greatly. They are all contained within a parent table cell, which is centred on the page. But I am unable to find a...
0
7612
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...
0
7924
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. ...
0
6283
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...
1
5512
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...
0
5219
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...
0
3653
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...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
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...

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.