473,789 Members | 2,925 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to centre a fixed-width box without border

Hi,

I have a centred table 700px wide. I'd like to use CSS instead of a
table. Is the following the best, relatively standards compliant way
for a non-expert to have content centred that will be rendered right
by the main browsers incl IE5.5?

And if you state 0 as a value, does it have to be followed by px or em
etc or can it be left just as 0?

<div style="text-align:center;">
<div style="width:70 0px;margin:0px
auto;text-align:left;padd ing:10px;border :0px;">
</div>
</div>

Thanks
Dave
Jul 21 '05 #1
10 3837
On 13 Feb 2005 14:17:14 -0800, Dave <ze********@yah oo.com.au> wrote:
Is the following the best, relatively standards compliant way
for a non-expert to have content centred that will be rendered right
by the main browsers incl IE5.5?

Expert or not has nothing to do with the correct way to do things.
And if you state 0 as a value, does it have to be followed by px or em
etc or can it be left just as 0?

A length of zero needs no unit defined.
<div style="text-align:center;">
text-align: is intended to be used with inline elements. A div is not an
inline element.
Use the margin:0 auto; as you do and the div will center itself.
<div style="width:70 0px;margin:0px
auto;text-align:left;padd ing:10px;border :0px;">


Best put these styles in a seperate stylesheet and also: read up on liquid
design (<http://www.google.com/search?q=liquid +design>
--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
Jul 21 '05 #2
Barbara de Zoete wrote:
On 13 Feb 2005 14:17:14 -0800, Dave <ze********@yah oo.com.au> wrote:
<div style="text-align:center;">

text-align: is intended to be used with inline elements. A div is not
an inline element.


You lost me here.

http://www.htmlhelp.com/reference/cs...ext-align.html

"Applies to: Block-level elements"

"The text-align property can be applied to block-level elements (P, H1,
etc.) to give the alignment of the element's text."

Is this deprecated, and not noted as such, there? (Yes, I see the
copyright date.)

--
Blinky Linux Registered User 297263

Who has implemented Usenet Solution #45933:
Now killing all posts made from Google Groups
Jul 21 '05 #3
in comp.infosystem s.www.authoring.stylesheets, Barbara de Zoete wrote:
On 13 Feb 2005 14:17:14 -0800, Dave <ze********@yah oo.com.au> wrote:
Is the following the best, relatively standards compliant way
for a non-expert to have content centred that will be rendered right
by the main browsers incl IE5.5?
Expert or not has nothing to do with the correct way to do things.
Correct.
A length of zero needs no unit defined.
<div style="text-align:center;">
text-align: is intended to be used with inline elements. A div is not an
inline element.
Use the margin:0 auto; as you do and the div will center itself.


Yes. But he did say IE5.5.
http://dorward.me.uk/www/centre/#ie
Best put these styles in a seperate stylesheet and also: read up on liquid
design (<http://www.google.com/search?q=liquid +design>


--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.
Jul 21 '05 #4
in comp.infosystem s.www.authoring.stylesheets, Blinky the Shark wrote:
Barbara de Zoete wrote:
On 13 Feb 2005 14:17:14 -0800, Dave <ze********@yah oo.com.au> wrote:
<div style="text-align:center;">

text-align: is intended to be used with inline elements. A div is not
an inline element.


You lost me here.


Because Barbara snipped bit too agressively, OP had
<div style="text-align:center;">
<div style="width:70 0px;margin:0px
auto;text-align:left;padd ing:10px;border :0px;">
</div>
</div>
http://www.htmlhelp.com/reference/cs...ext-align.html "Applies to: Block-level elements"

"The text-align property can be applied to block-level elements (P, H1,
etc.) to give the alignment of the element's text."

Is this deprecated,
No.
and not noted as such, there? (Yes, I see the copyright date.)


Use real reference:
http://www.w3.org/TR/CSS2/text.html#alignment-prop
http://www.w3.org/TR/CSS21/text.html#alignment-prop (CR)

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.
Jul 21 '05 #5
Lauri Raittila wrote:
in comp.infosystem s.www.authoring.stylesheets, Blinky the Shark wrote:
http://www.htmlhelp.com/reference/cs...ext-align.html "Applies to: Block-level elements" "The text-align property can be applied to block-level elements (P, H1,
etc.) to give the alignment of the element's text." Is this deprecated,

No.


Good. Thanks.

--
Blinky Linux Registered User 297263

Who has implemented Usenet Solution #45933:
Now killing all posts made from Google Groups
Jul 21 '05 #6
Blinky the Shark wrote:
"Applies to: Block-level elements"

"The text-align property can be applied to block-level elements (P, H1,
etc.) to give the alignment of the element's text."


It aligns the element's text - it doesn't align the element's block
children.

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 21 '05 #7
David Dorward wrote:
Blinky the Shark wrote:
"Applies to: Block-level elements" "The text-align property can be applied to block-level elements (P, H1,
etc.) to give the alignment of the element's text."

It aligns the element's text - it doesn't align the element's block
children.


What I'm having trouble understanding, then, is a case like this:

In this simplified case:

<div style="text-align: foo;>

<div>
<img>
and/or
text

If the second div isn't being styled by the first, how come the image or
text is rendered as foo-aligned? Is the idea/language I should wrap my
head around, here, that style foo is directly applied to image/text,
rather than being applied to the second div which in turn foo-styles
the image/text? Is that in keeping with your explanation, above?

--
Blinky Linux Registered User 297263

Who has implemented Usenet Solution #45933:
Now killing all posts made from Google Groups
Jul 21 '05 #8
On 14 Feb 2005 20:56:37 GMT, Blinky the Shark <no*****@box.in valid> wrote:
David Dorward wrote:
Blinky the Shark wrote:

"Applies to: Block-level elements" "The text-align property can be applied to block-level elements (P, H1,
etc.) to give the alignment of the element's text."

It aligns the element's text - it doesn't align the element's block
children.


What I'm having trouble understanding, then, is a case like this:

In this simplified case:

<div style="text-align: foo;>

<div>
<img>
and/or
text

If the second div isn't being styled by the first,


Oh, but it is. In a way. It's children inherit values appropriate. A block
level element like the first child is, will not be centred. But inline
content of both the first div and the child div will, unless it is
otherwise specified.
--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
Jul 21 '05 #9
Blinky the Shark wrote:
It aligns the element's text - it doesn't align the element's block
children.
In this simplified case:

<div style="text-align: foo;>
<div>
<img> If the second div isn't being styled by the first, how come the image or
text is rendered as foo-aligned?


The default value for the text-align property is "inherit", so unless you
explicitly specify the value of the property from an element, it will use
the same value as its parent.

That is the same as:

<div style="text-align: foo;>
<div style="text-align: inherit;>
<img>

and thus:

<div style="text-align: foo;>
<div style="text-align: foo;>
<img>
--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 21 '05 #10

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

Similar topics

0
1436
by: kayodeok | last post by:
Another Link from my web travels for you to take apart ;) Dead Centre http://www.wpdfd.com/editorial/thebox/deadcentre4.html From the site: "This text is DEAD CENTRE and stays there!" -- Kayode Okeyode http://www.kayodeok.co.uk/weblog/
16
2900
by: Andy Mabbett | last post by:
The page at: <http://www.westmidlandbirdclub.com/club/logo.htm> has a logo "floated" in the top left, and another "floated" in the top right, with the H1 heading centred between them (and this centred on the page). I would like to only have the logo top left, but retain the centering of
3
2796
by: CJM | last post by:
I want to create a footer with 3 items, one of which will always stay to the left, one will be in the centre, and the 3rd will be at the right. As you might imagine, I want the Right & Centre items to adjust accordingly as the window is resized. I know this is a relatively simple task, but I've gone wrong somewhere on my initial attempts..! http://aif-advocacy.org.uk/new/
7
3258
by: Alex | last post by:
Hi all, I am trying to install a java stored procedure via the windows development centre. The linux box is running 8.1 FP4 as is the windoze platform. If I am on the linux box i can install the sample jdbc stored procedures o.k. For the purpose of this test I created a sample procedure that executes "select * from department" when conected to the sample database on the linux box.
8
3573
by: DB2 Novice | last post by:
I am trying to use DB2 Control Centre (version 8.2) to load one flat file into multiple tables. However, I don't see the options in Control Centre that allows that. Anyone knows how to do this? DB2 Novice
1
2355
by: jan.gezels | last post by:
Hi We're use DB2 with Data propagator. When I open Replication Centre no config is shown (no capture or apply servers) but everything is still working like it should. If I try to reconfigure, I get the following error: There are no cataloged servers to choose from. You must add at least one server to the DB2 UDB catalog.
0
1047
by: David Buckley | last post by:
I remember seeing an app on a site that had the basic look and feel of media centre i was wanting to find the app again to start buidling a media centre for a home project can anyone point me in the right direction i think it was on gotdotnet but can no longer find it Many thanks David Buckley
2
1165
by: =?Utf-8?B?U3UgbmVpbA==?= | last post by:
My media centre will only let me create data dvd's and not slideshow dvd's can anyone help with a solution. I have a dell dimension 9150 and media centre 2005
4
1820
by: OrchidNut | last post by:
Hi, need to have a new notebook and want to avoid Vista. XP pro is my favourite but hard to get on a notebook. I can get XP Media Centre 2005 but not interested in entertainment. Is it possible to upgrade the Media Centre version to XP Pro as someone suggested? Thanks in advance.
0
1069
by: shamshujjuhah | last post by:
I am using the following code to open file. Now I want to position the fileopen dialog to the centre of screen. Can someone tell me how can I acheive this? code: -------------- OpenFileDialog fileDialog = new OpenFileDialog(); if (fileDialog.ShowDialog() == DialogResult.OK) { //do something }
0
9666
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
9511
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
10200
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...
0
9984
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
9020
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
6769
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
5418
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...
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
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.