Posted by Yuri Shtil on 08/08/07 22:58
Neredbojias wrote:
> Well bust mah britches and call me cheeky, on Wed, 08 Aug 2007 22:10:56
> GMT Yuri Shtil scribed:
>
>>>> Basically I need to know:
>>>> - how to create a container element that can be positioned
>>>> horizontaly
>>>> or vertically relative to the parent container.
>>> Any container within a relatively-positioned outer container and
>>> positioned absolutely will do that. Normally it's a <div>.
>>>
>> Could you point to an example? How do I make sure boxes are aligned
>> and not overlapping? I looked at a couple of CSS books and articles.
>> For example in Cascading Style Sheets by Eric A.Meyer on page 294 the
>> author says: [Positioning] allows you to define exactly where element
>> boxes will appear relative to ... a parent element or another element.
>> Unfortunately I cannot figure out how to do this specifically how to
>> position relative to another element(sibling I guess).
>
> I prefer styles in the <head> section or a stylesheet, but for this
> example...
>
> <div style="position:relative;width:80%;margin:auto;">
> <div style="position:absolute;top:1em;left:2em;">
> Hello dere!
> </div>
> </div>
>
> The outer div will be centered and 80% of screen width. The inner div with
> text will be positioned within it at 1 em (appx 16px at "normal" font size)
> from the outer div's top and 2 em from its left.
>
> For css to work best, you should always use an html 4.01 strict doctype.
>
This is great, but what if I have an another inner div I want positioned to the right of the first inner div?
[Back to original message]
|