473,806 Members | 2,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Centering design on 'page'

25 New Member
I am working on cleaning up the code as per validation but the very first HTML problem it gives me is the <center> tag that aligns my 800px width design in the window.

The design is a table-based one because I build my image in PhotoShop and slice it in ImageReady which generates the HTML for it. I tweak as I go to make it work but I honestly do not know any way to ensure that my design displays mid-screen unless I use <center> tags in the body.

How would I make this happen using CSS? Every attribute I try doesn't have center as an option (like float which just makes sense that it should). I am completely baffled and I thank you for any education!

Kathy
Sep 18 '06 #1
7 1692
skase98
25 New Member
Thinking out loud after more consideration.. .

Do I use a body <div> that somehow uses a relative position? If so, what would it look like?

#bodyplcmt { position:relati ve; (but relative to what?!?)

I also get the feeling that, because I have no specified height for the table so that it stretches to accomodate all content, something in my CSS is breaking the table apart. Each table cell is valigned to top and has a specified height to avoid those breaks but they are now visible.

I wish I could just find these answers without asking and asking here! I hate deadlines!!! :)

Kathy
Sep 18 '06 #2
drhowarddrfine
7,435 Recognized Expert Expert
Kathy,
I just drank a wonderful wine on an empty stomach and I'm surprised my spelling is correct right now and I love you. Anyway, the center tag is deprecated so furgettabotit.

Never, ever design using tables. They are for data only and meant to be that way and have I said anything inappropriate yet?

Relative positioining will put the div relative to where it would normally go in the flow of the document.

If you want to center a div, try margin:0 auto;

Man this stuff is good but I'm wasted. Give me an hour.

Honestly, I'm not a drinker at all.
Sep 18 '06 #3
skase98
25 New Member
:) Your spelling is dandy!

Honestly, I really do want to learn how to get away from tables and I am really willing to learn. So far, I haven't found a 'Complete Moron's Guide to Not Using Tables Because They're Stoopit.' Unfortunately, I started doing this sort of stuff when tables were "THE WAY TO LAY OUT A PAGE" and those old habits refuse to go quietly into the night.

I think I'm going to spend the night playing with <div> tags. You just enjoy that wine!

Kathy
Sep 19 '06 #4
skase98
25 New Member
Paging Dr Howard... Paging Dr Fine...

Holy cannoli, Batman! Why didn't anyone tell me that this CSS stuff was so amazing?!? I have spent a bit of time redoing the site, eliminating the tables. So far, it's all going well except I'm having some trouble getting my background images to show.

Thank you for teaching me about the center alignment code! That gave me the courage to go 'all the way' as it were! I'm sure I still have plenty of questions and much work to do but I am doing a happy dance and keep saying out loud, "Oh my gosh! Look at that!"

Of course, there's always IE to battle...

Thank you more than you know,

Kathy
Sep 19 '06 #5
steven
143 New Member
Throw your table inside a div.

Style the div. Set the margins as such

margin: 0 auto 0 auto;

You can play around with it, but essentially, it will centre the div horizontally because the left and right margin setting are set to auto.

The thing to remember with properties of CSS like this, are that when defining things like this in one statement, the order is -

property: top_value right_value bottom_value left_value;
Sep 19 '06 #6
drhowarddrfine
7,435 Recognized Expert Expert
She's trying to get away from using tables so just throwing them in a div is not appropriate.

Kathy, I have just the opposite experience. I had no interest in coding for the web until about two years ago. I have never used tables for layout and have a hard time helping people who do.
Sep 19 '06 #7
skase98
25 New Member
Thank you for the advice! I did read the margin order at one point and sort of chant to myself every time - "like a clock... "

Admittedly, I was quite nervous about letting go of my table security blanket but I am finding using CSS is really entertaining. I change a number here or move a <div> there and elements just slide around! It's really amazing!

I have a long way to go before I truly understand each tag and what it does. At this point, I'm a hacker, much like when I play around with php and perl.

I'm still being confounded by my background images but, at the moment I can proudly report that I validated my code in progress and got no errors on both the HTML and the CSS!

So far, so good! And, heck - I've got another day before the phone calls and emails start flying fast and furious... ;)

Thank you for all your help so far!

Kathy
Sep 19 '06 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

7
2590
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 should I put into the stylesheet so that, no matter what resolution the viewer's screen is set to, the layout is always displayed centered ? Erik Schulp
5
14669
by: Charles Blaquière | last post by:
As part of my explorations in liquid design, I'm exploring ways to use the overflow: hidden property -- when browser windows become too narrow, I want (some) images to get cropped rather than have the layout break up. In some cases, losing parts of images can be an interesting option. http://www.hebig.org/blog/titlepic.php was the first example I found, and it's quite nifty. His image works well when progressively cropped from the right,...
4
2274
by: Justin Archie | last post by:
The subject says it all my friends. I have searched google to death about centering problems and for some reason no one seems to have the error I have. For the past few days I have been working on a website for a non-profit club and I and they were happy with the design and layout. I did not discover a problem with what I had until I was testing all browsers for compatibility. The following page...
15
13511
by: red | last post by:
How do I center two side by side divs ? I've been writing css pages for a while but there's one thing tha still eludes me. I can center a div with margin auto. I can place two divs side by side with float. But I can't center two side by side divs. If I float them and give them auto margins, the auto margins are ignored. If I wrap the two floated divs in another div, the two divs have no
3
2746
by: wmasterj | last post by:
I have a div i want it to be max a certain width - thats done already But - i want the empty sides of the div to have the same width - like with frames (cols="*,800, *") So no matter how much i resize the window, the div stays in the middle. I should know this from before but i'm just blacking out and need some help. the page in doing it on is: http://dinpc.no-ip.com:83/portal/jeroen
3
4214
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? 2. Verticle centering in <div>
8
4245
by: speralta | last post by:
I'm playing around with a test page that uses a <div id="main"within the context of a body with a width of 100% to center a fixed width field on a page. For some reason, the page is not centering in Internet Explorer. What's odd is that it works on my site's home page and most other pages, but not on pages that I am returning from a particular script. I've stripped out most of the content in an attempt to sort it out, but after kicking...
4
4075
by: SAL | last post by:
Hello, is there a way to menu control dynamically center itself horizontally on a page? I have placed a menu control in a panel control (no ajax) and would like it to center itself. Depending on whose logged in, the menu, or course, displays different items, sometimes just two items, other times many more. If all menu items are displaying, centering is not a problem but when only two items are displayed, the menu appears on the left hand...
1
2290
by: =?Utf-8?B?ZnJhbmt5?= | last post by:
Hello, I've created a table that has two rows that are span across three columns. The third row has three columns, each with an image. The last row is also span accross three columns. The span rows are centering their data. however, the row with three columns, each with images (myimages1-3) are not centering with the rest of the table. Any idea why? Thanks in advance!
0
9598
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
10623
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...
1
10373
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9192
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...
0
6877
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
5683
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3852
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3010
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.