Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Positioning of DIV tag in center of the screen

Reply
Thread Tools

Positioning of DIV tag in center of the screen

 
 
123Jim
Guest
Posts: n/a
 
      01-26-2011

"Fokke Nauta" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Jonathan N. Little" <(E-Mail Removed)> wrote in message
> news:ihni83$p4f$(E-Mail Removed)-september.org...
>> Fokke Nauta wrote:
>>> "Jonathan N. Little"<(E-Mail Removed)> wrote in message
>>> news:ihn849$hcg$(E-Mail Removed)-september.org...
>>>> Fokke Nauta wrote:
>>>>
>>>>> centered: horizontally;
>>>>
>>>> There is not CSS property "centered". For list of valid properties
>>>> supported my most browsers currently:
>>>>
>>>> http://www.w3.org/TR/CSS2/propidx.html
>>>>
>>>> --
>>>> Take care,
>>>>
>>>> Jonathan
>>>
>>> OK, so it may be undocumented but it works in all browsers I tested.
>>> Thanks for the link BTW, I bookmarked it.
>>>
>>> But what's wrong with it as long as it works?

>>
>>
>> But it does *not* work. There is no such property. Invalid css rules are
>> ignored.
>>
>> .container {
>> background-image: url(main.jpg);
>> position: relative;
>> height: 525px;
>> width: 980px;
>>
>> margin-left: auto; <-- These two rules are actually doing
>> margin-right: auto; <-- the horizonal centering of container
>>
>> centered: horizontally; <-- These two rules are actually doing
>> centered: vertically; <-- nothing because they are ignored.
>> }
>>
>> I can prove it:
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
>> "http://www.w3.org/TR/html4/strict.dtd">
>> <html>
>> <head>
>>
>> <title>Proof</title>
>>
>> <style type="text/css">
>>
>> .valid { background: #efe; margin: auto; }
>> .invalid { background: #fee; centered: horizontally; centered:
>> vertically; }
>> div { padding: .5em; width: 10em; height: 5em; }
>>
>> </style>
>>
>> </head>
>> <body>
>>
>> <div class="valid">I am centered horizontally</div>
>>
>> <div class="invalid">I am not centered!</div>
>>
>> </body>
>> </html>
>>
>>

>
> Thanks, I have seen it.
> I have left out the invalid "centered" properties and now use margin:
> auto;.
> That does the trick.
>
> I assume it is not possible to center it vertically as well?
>


Take a look here:
http://www.jakpsatweb.cz/css/css-ver...-solution.html

maybe it's good, maybe not, I just found it on google and it seems promising
on first read.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
positioning a DIV right in the middle of the screen laredotornado@zipmail.com Javascript 0 02-14-2007 11:59 PM
Select text within a div tag by clicking on content of div tag or a button? visu Javascript 4 11-22-2006 06:25 AM
center div over another div Gernot Frisch Javascript 1 03-16-2006 01:42 PM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
Select text within a div tag by clicking on content of div tag? M Wells Javascript 0 10-06-2004 11:04 AM



Advertisments