By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,396 Members | 1,882 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,396 IT Pros & Developers. It's quick & easy.

css help centering some content?

P: n/a

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.


Feb 1 '07 #1
Share this Question
Share on Google+
1 Reply

P: n/a
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.

Feb 1 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.