473,387 Members | 1,572 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.

Centering main area on the page

Hi all

Using VB 2005

I am trying to recreate some existing pages made originally in Dreamweaver
to ASP.net. Now I am stuck at the first hurdle.
Original code using css

div.edges {
border-left: 2px solid #c7c7c7;
border-right: 2px solid #c7c7c7;
height: 600px;
width: 780px;
}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<body>
<div align="center">
<!-- Set Vertical Lines -->
<div class="edges">
</div>
</div>

Produced 2 vertical lines 780px wide centered on the page in IE6 / 7 and
Mozilla 2.0.0.3 between which I do my creation of art for the internet.

Using the same DOCTYPE I cannot get the same results from VB2005
Using a table or a Panel I can get the results with IE7 not tried IE6 but
not with Mozilla I just get a left aligned page. I have tried this with a
css stylesheet and inline styles.

This is a little disturbing that I cannot center the main area on the page
in all browsers.

Any ideas would be great.

Thanks

DaveG

Apr 24 '07 #1
3 1189
"Dave Griffiths" <da*********@hotmail.com.nospamwrote in message
news:Y5*********************@telenor.com...
This is a little disturbing that I cannot center the main area on the page
in all browsers.
The problem is that you're not using XHTML-compliant markup. Despite what
some people will tell you, this is pretty much the only way to guarantee
that your pages will display correctly in all modern browsers.

Specifically in your case, you're using <div align="center">

The align property of the div tag is deprecated, and is not XHTML compliant.

Use this instead:

<div style="margin-left:auto;margin-right:auto;">
Apr 24 '07 #2
You could try using margin:auto; in the div style and that will force
it to align center.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<title>Untitled</title>
<style>
div.edges {border-left: 2px solid #c7c7c7;border-right: 2px solid
#c7c7c7;height: 600px;width: 780px;margin:auto;}
</style>
<body>

<div>
<!-- Set Vertical Lines -->
<div class="edges"></div>
</div>

</body>
</html>
deftone

On Apr 24, 9:24 am, "Dave Griffiths" <davegino...@hotmail.com.nospam>
wrote:
Hi all

Using VB 2005

I am trying to recreate some existing pages made originally in Dreamweaver
to ASP.net. Now I am stuck at the first hurdle.
Original code using css

div.edges {
border-left: 2px solid #c7c7c7;
border-right: 2px solid #c7c7c7;
height: 600px;
width: 780px;

}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<body>
<div align="center">
<!-- Set Vertical Lines -->
<div class="edges">
</div>
</div>

Produced 2 vertical lines 780px wide centered on the page in IE6 / 7 and
Mozilla 2.0.0.3 between which I do my creation of art for the internet.

Using the same DOCTYPE I cannot get the same results from VB2005
Using a table or a Panel I can get the results with IE7 not tried IE6 but
not with Mozilla I just get a left aligned page. I have tried this with a
css stylesheet and inline styles.

This is a little disturbing that I cannot center the main area on the page
in all browsers.

Any ideas would be great.

Thanks

DaveG

Apr 24 '07 #3
Thanks guys

Works great now

Dave
"Dave Griffiths" <da*********@hotmail.com.nospamwrote in message
news:Y5*********************@telenor.com...
Hi all

Using VB 2005

I am trying to recreate some existing pages made originally in Dreamweaver
to ASP.net. Now I am stuck at the first hurdle.
Original code using css

div.edges {
border-left: 2px solid #c7c7c7;
border-right: 2px solid #c7c7c7;
height: 600px;
width: 780px;
}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<body>
<div align="center">
<!-- Set Vertical Lines -->
<div class="edges">
</div>
</div>

Produced 2 vertical lines 780px wide centered on the page in IE6 / 7 and
Mozilla 2.0.0.3 between which I do my creation of art for the internet.

Using the same DOCTYPE I cannot get the same results from VB2005
Using a table or a Panel I can get the results with IE7 not tried IE6 but
not with Mozilla I just get a left aligned page. I have tried this with a
css stylesheet and inline styles.

This is a little disturbing that I cannot center the main area on the page
in all browsers.

Any ideas would be great.

Thanks

DaveG
Apr 25 '07 #4

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

Similar topics

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...
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...
15
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...
1
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...
13
by: Raffi | last post by:
Hi, We have an application that requires IE. We recently incorporated CSS scroll areas. The scroll fields are supposed to be centered. They are except for IE5 for the Mac. I have tried various...
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...
8
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...
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...
4
by: harryusa | last post by:
I am trying to center 2 images concentrically which are z-indexed to lay on top of each other making an image with a border from another image that has a transparent center. I need the images to be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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: 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
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
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,...

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.