473,729 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[CSS] Centralizing

How can I centralize all page elements with CSS? Like the equivalent of
wrapping the body in <center>..</center>?
Jul 23 '05 #1
19 9030
On Sat, 18 Dec 2004 04:08:44 +0000, Cool Guy <co*****@abc.xy z> wrote:
How can I centralize all page elements with CSS? Like the equivalent of
wrapping the body in <center>..</center>?

text-align: center

Read any CSS tutorial, it will reveal wonders.
Jul 23 '05 #2
Were you thinking of having all the paragraphs centered, like centered
text, or do you mean all the elements centered in the browser window
like on my site (http://bigorangesign.com/)

If its the latter, the short answer is to start with:
html, body {
width: 800px; /* insert your width there */
margin: 0 auto;
}

It took me a few hours of messing around to nail it down, but the
effort was worth it.

Jul 23 '05 #3
Were you thinking of having all the paragraphs centered, like centered
text, or do you mean all the elements centered in the browser window
like on my site (http://bigorangesign.com/)

If its the latter, the short answer is to start with:
html, body {
width: 800px; /* insert your width there */
margin: 0 auto;
}

It took me a few hours of messing around to nail it down, but the
effort was worth it.

Jul 23 '05 #4
Cool Guy <co*****@abc.xy z> wrote:
How can I centralize all page elements with CSS? Like the equivalent of
wrapping the body in <center>..</center>?


The center element is only allowed *inside* the body element, so you
can't "wrap" the body element inside a center element.

There is no drop in css replacement for the html center element because
css treats inline and block level content differently.

Have a look at http://dorward.me.uk/www/centre/

Btw, css queries should go to c.i.w.a.stylesh eets

--
Spartanicus
Jul 23 '05 #5
Cool Guy wrote:
How can I centralize all page elements with CSS? Like the equivalent of
wrapping the body in <center>..</center>?


http://dorward.me.uk/www/centre/

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #6
Michael Carvin wrote:
like on my site (http://bigorangesign.com/)


Doesn't work. I get a horizontal scrollbar in my 800px window. All
your pages are this way. I also don't see the need for a contact form
on *every* page. Move that to a Contact Us page.

BTW, you have too many <h1>. Your current <h1>'s should be <h2> and
your <h2> should be <h3>. Then make one main heading as the <h1>. The
<hx> is not about font size, if that's what you were thinking.

<h1>Page Main Heading</h1> <- similar to <title>
<h2>Sub-heading</h2>
<h3>Sub-sub-heading</h3>
<h3>Sub-sub-heading</h3>
<h2>Sub-heading</h2>
<h3>Sub-sub-heading</h3>
<h4>Sub-sub-sub-heading, if necessary</h4>
<h3>Sub-sub-heading</h3>

--
-bts
-This space intentionally left blank.
Jul 23 '05 #7
"Neal" <ne*****@yahoo. com> wrote in message
news:op******** ******@news.ind ividual.net...
On Sat, 18 Dec 2004 04:08:44 +0000, Cool Guy <co*****@abc.xy z> wrote:
How can I centralize all page elements with CSS? Like the equivalent of
wrapping the body in <center>..</center>?

text-align: center

Read any CSS tutorial, it will reveal wonders.


Read closer. Trying out this CSS with standards-compliant browsers will
also reveal wonders: namely that text-align:center is not effective for
blocks; you have to use margin-left:auto and margin-right:auto ... but you
also have to use text-align:center because IE (surprise!) gets this wrong.

Jul 23 '05 #8
Thanks for the critique, although I was trying to assist Cool Guy with
his problem. I don't understand why you decided to turn the topic of
the thread into a crit.

First, it does work. It has a horizontal scrollbar on 8x6 and under
because the site is designed for windows larger than that. If you are
viewing the site in a window larger than 8x6 and you get scrollbars,
please send me a screenshot. Second, the contact form is experimental;
I've gotten both positive and negative feedback on it. Third, I see the
value in your h-tag suggestions and will rewrite the site in January
with that in mind. I am aware that h-tags are not about font size, but
semantics.

Next time I need a crit, I'll be sure contact you.

Back to the topic at hand, Mr. Upsdell echoes the margin: 0 auto;
advice but I don't use text-align: center; in my CSS, and I would be
interested in what environments that declaration would be necessary
(maybe pre-IE5.5?).

Jul 23 '05 #9
Michael Carvin wrote:
Back to the topic at hand, Mr. Upsdell echoes the margin: 0 auto;
advice but I don't use text-align: center; in my CSS, and I would be
interested in what environments that declaration would be necessary
(maybe pre-IE5.5?).


http://dorward.me.uk/www/centre/#ie

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #10

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

Similar topics

5
8644
by: andy johnson | last post by:
Hi All, I called an external stylesheet main.css, created the html files and checked them locally OK. I uploaded everything to the server. When I checked it, the connection kept crashing. I finally figured out that the connection was freezing up every time I called index.html. I changed the name of the stylesheet and changed the links, and I no longer had the problem. Doing a Google search turned up nothing, can anyone give me any...
59
4580
by: Mason A. Clark | last post by:
Is there information content in this observation? use html tables for layout: http://www.microsoft.com and http://www.netscape.com uses styles: http://www.opera.com
145
8833
by: Mark Johnson | last post by:
Oddly enough, I found it difficult, using Google, to find a list of best-of sites based on the quality of their css packages. So I'd ask. Does anyone know of particularly good sites which are in good measure because of their creative and useful css designs? I'm aware of Zen Garden and a few others. So don't bother with those. And I hope I don't get replies from people with a 'tin ear' and no design sense. Good sites. Good pages. That's...
48
8703
by: David J Patrick | last post by:
I'm trying to rewrite the CSS used in http://s92415866.onlinehome.us/files/ScreenplayCSSv2.html. using the w3.org paged media standards as described at http://www.w3.org/TR/REC-CSS2/page.html The ScreenplayCSS is flawed, for several reasons; -overuse of <div id= tags -doesn't scale screen resolutions (convert from px to in, pt ?) -no media="print" (how much coule be shared between "screen" & "print") -no automatic page breaks (with...
4
39727
by: g | last post by:
I'd like to have a CSS file for everything that's common to my site, and other CSS files that are specific to certain pages or groups of pages. When a page loads, it would load in BOTH the General CSS and the specific CSS file for that page. As long as none of the selector names were the same on both, could the page follow the styles set out in both files? Greg Guarino
0
1054
by: Keith Patrick | last post by:
I'm curious how folks are generally (if at all) centralizing the setting of both MasterPage and Theme of a large group of pages. I have a content viewer app where my initial solution was to just have 1 page with a master page and theme, but I run into issues with site map navigation (long story). So now, I'm moving towards the more standard usage of a MasterPage whereby each page is just content wrapped by the master page such that the app...
6
1548
by: D. Shane Fowlkes | last post by:
I posted this on another forum, and as I feared, the response(s) were too complex and sophisticated. I certainly don't mind learning new methods, in fact, that's why I asked, but I was hoping to emphasize that needed to take small steps. The responses I received talked about Public Classes and DLLs and such. =( I'm tinkering in ASP.NET 2 (VB) and have been tinkering with VWD for about a couple of weeks. I've written a few app pages...
8
1699
by: | last post by:
I'm looking for some design guidance on a collection of projects I'm working on. The project involves a bunch of websites constructed out of a collection of user controls. Different user populations with different access rights and "roles" will be visiting the site. I will be using ASP.NET 2.0's membership, roles, and profiles stuff to manage access. User controls need to be visible or not visible depending on user role. In some...
1
4464
by: matz2k | last post by:
I've got a big problem with the CSS layout which I've produced with Photoshop/Dreamweaver especially for my ebay auctions. This is what it looks like http://cgi.ebay.de/ws/eBayISAPI.dll?ViewItem&item=250542673235 As you can see it can only be seen partially , can anyone help me with this? As fas as I can tell ebay's Iframe is messing up my layput, or am I wrong? Thx! here is the css/html code
0
8917
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9426
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...
0
9281
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
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
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2163
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.