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

Content does not align centered on page

shosholoza
I switched from tables to using Divs and now cannot get the content to align under the banner properly in the center of the page.

I have attached the code as well as screen image.

View page here portelizabethpropertydotcom/index9.html

My intention is to have everything under the banner with same width as banner. I am using Firefox 11
Attached Images
File Type: jpg Test-Page1.jpg (87.5 KB, 242 views)
Attached Files
File Type: doc html code.doc (44.5 KB, 326 views)
Apr 4 '12 #1
7 2560
drhowarddrfine
7,435 Expert 4TB
You can set the width of the body equal to the size of that banner image. Then, to center everything, set the body to 'margin:0 auto'.

Unfortunately, the rest of the markup is not really aligned to doing it that way and you'll see some shifting of elements.
Apr 4 '12 #2
Thx. Will get that done and then look at rest of content
Apr 5 '12 #3
I did as you recommended and think I grasp the principle - the other divs must be % of something in order to line up.
The alignment now seems fine - but the content is still not centered but is sitting on the left.
This is what code looks like now
html, body {
margin: 0; auto;
padding: 0;
width: 971px;
height: 100%;
}
Apr 7 '12 #4
after <body> just put <center> and complete this tag before <body>

like this :::
<body>
<center>
<div>

</div>
</center>
</body>
Apr 16 '12 #5
This has not made a difference. Page is still aligned to left.
Can be viewed at www.portelizabethproperty.com/index11.html
Apr 17 '12 #6
Changed to this under <head>
margin-left:auto;
margin-right:auto;

Now looks fine. Only problem is I do not yet understand why :-)
Apr 17 '12 #7
drhowarddrfine
7,435 Expert 4TB
Remove the center tags and never, ever use them again.

In your css for the body, change your margin to
Expand|Select|Wrap|Line Numbers
  1. margin:0 auto;
This will automatically adjust your margin to fit the width of the screen compared to the width of your body element which is acting as a container for its contents. The zero will set the margin at the top and bottom to zero.
Apr 17 '12 #8

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

Similar topics

3
by: chris ciotti | last post by:
Hello all - I'm trying to position content at the bottom of a page (I'd like to anchor it there). The majority of the code was generated using Photoshop CS and then hand edited. I'm having...
7
by: Jeff Thies | last post by:
I've got a page with content that I want aligned in the center, with equal margins on both sides (text, left aligned). It seems to me that this is a complex thing to get right on most browsers...
1
by: Martin | last post by:
Hi, I have an ASP page, whisch generates dynamic report for a SQL server DB. Now the users want to have the content in PDF format (not HTML page). The server machine had "adobe acrobat destiller"...
12
by: Rudy | last post by:
Hi, I need to make a request to a asp.net page using HttpWebRequest class and I need to trick this page into thinking it's a postback and a button was clicked. But the page doesn't handle the...
2
by: Daniel Frechette | last post by:
Hi, Is it possible to have secured (SSL/HTTPS) and non-secured (HTTP) content in the same page without breaking the security? I am developing a secured reservation system in which the user can...
3
by: Sam | last post by:
Hi All, Is it possible to get a web page content of one of my webpages using relative path? for example: If I have a website which consists of 2 pages: testpage1.aspx and testpage2.aspx...
11
by: McKirahan | last post by:
I am looking for feedback on an approach to using PHP. Below is a stripped down version of a Home page: "index.php". The content of the site is displayed in the middle of the page and is...
7
kaleeswaran
by: kaleeswaran | last post by:
Hi! i am trying to display different content with the same page.how to do that?... my idea is the page is static but the content will be displayed on the page dynamically change...
2
by: isarajeev | last post by:
I have a aspx page, say 'abc.aspx'. Within that page i have 4 tab controls. The tab controls open as iframe. I also have a print option on my page.(an anchor) <a id="aPrint" runat="server"...
2
by: visweswaran2830 | last post by:
I want to know to get content(in IE "View->Source" that produce current page content) of current aspx page in asp.net..
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.