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

css help centering some content?

css'ers:

As on old time raw html coder I am still struggling to grasp the nuances of
css. But, I'm getting there... however slowly!

I am currently having a problem I've spent way too much time on and I was
hoping someone with these skills might be able to assist or at least point
me in the right direction?

I am using a four box layout (header, left nav, right content, footer) and
all but the contents box seem to be behaving as expected. For the
particular page I am creating (it's functional BTW) I have a form with
several fields in a table to keep the descriptors and the input fields
strictly aligned and below these a series of input fields aligned in rows
of columns. Of course, a few action buttons are below these fields.
Finally, around all of this is a fieldset and legend.

I would like to "float" all this content in the center of the contents div
section (which itself is positioned:relative to the header and left nav
div). In HTML I would have used the old <centertag. With css I've tried
adding text-align: center which centers the table but not the column area
(these stay left). Also, whether the input fields stay left or get cented,
the fieldset box drawn around this takes up the entire width of the
contents div. Again, in old html it would just surround the max width of
the fields surrounded.

I know this is some css and some html and I already tried asking in the html
forum and got hollered at!!! As questions regarding formatting are
becoming more and more css only, I am hoping someone here can assist.

And yes, I have several css books, I've scoured several detailed css
information sites, and tried numerous techniques prior to posting this.

I'm hoping its a relatively easy response for someone!

Thanks in advance.

bobmct

Feb 1 '07 #1
1 1619
By jove...

upon continuing my research following my post, I came across some
discussions of such centering. What I ended up with was to code the
attributes right on the <fieldset statement as:

<fieldset style="width: 400px; text-align: center; margin-left: auto;
margin-right: auto;">

And it gives me nearly 100% of what I was trying to do.

Now, if there is a better, neater, more standard way to accomplish this,
then PLEASE advise.

bobmct
Feb 1 '07 #2

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

Similar topics

11
by: Jeff Thies | last post by:
I have a series of blocks that are float left that I need centered on the page. <div class="center" align="center"> <div style="width: 100 px;float: left">thumbnail 1</div> <div style="width:...
3
by: Jonah Bishop | last post by:
I have a puzzling problem with centering text, and I'm hoping that someone here can help me out. First of all, let me state that I am using XHTML 1.0 Strict and CSS for all layout purposes (no...
7
by: Erik Schulp | last post by:
Hi all, I am trying to get a CSS defined layout to center on the page, have tried doing this with the <center></center> tags but than everything is centered, including text etc etc. What...
3
by: CMAR | last post by:
To center my <div>, I am currently using something like <div id="navcontainer" align="center"> This centers fine, but is deprecated code. I have seen these two solutions recommended. 1) ...
5
by: Robert J. O'Hara | last post by:
For some time I've made use of the max-width property in CSS to cause my pages to appear as a centered block against a contrasting background. This works well in new browsers (Mozilla, etc.) and...
3
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...
3
by: SamMan | last post by:
A few months ago, I recalled reading somewhere the way to center content in Mozilla-based browsers was like this... body { margin: 0px auto; text-align: center; /*for IE*/ } My memory...
6
by: Simon Wigzell | last post by:
I have the following funciton that centers my website content for any size window and will center it in real time as the window is expanded or shrunk. It is activated by a onresize="CenterIt();"...
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...
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: 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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.