HighDots Forums  

Re: 2 lists: 1 left aligned and 1 right aligned on same line

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Re: 2 lists: 1 left aligned and 1 right aligned on same line in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Spartanicus
 
Posts: n/a

Default Re: 2 lists: 1 left aligned and 1 right aligned on same line - 02-24-2006 , 11:37 AM






Please list important information not just in the message header, but
repeat it in the message body.

"JB" <me (AT) here (DOT) com> wrote:

Subject: 2 lists: 1 left aligned and 1 right aligned on same line

about: http://www.borovere.plus.com/css/new.htm

Why are you using 2 lists?

Your minimised test case doesn't allow us to see the context and thus
what you are actually trying to do.

Judging by the little information that is there one list seems more
appropriate.

If you want something resembling this navbar:
http://www.pan-europe.utvinternet.ie/links.htm

It can be done by setting <li> to inline, specifying text-align:right on
the <ul>, specify position:relative on the <ul> to make it the
containing element, absolutely positioning the one link you want left
aligned, and then giving the <ul> a left padding in em's to the size of
the positioned link text.

--
Spartanicus

Reply With Quote
  #2  
Old   
JB
 
Posts: n/a

Default Re: 2 lists: 1 left aligned and 1 right aligned on same line - 02-25-2006 , 06:15 AM







"Spartanicus" <invalid (AT) invalid (DOT) invalid> wrote

Quote:
Please list important information not just in the message header, but
repeat it in the message body.

"JB" <me (AT) here (DOT) com> wrote:

Subject: 2 lists: 1 left aligned and 1 right aligned on same line

about: http://www.borovere.plus.com/css/new.htm

Why are you using 2 lists?

Your minimised test case doesn't allow us to see the context and thus
what you are actually trying to do.

Judging by the little information that is there one list seems more
appropriate.

If you want something resembling this navbar:
http://www.pan-europe.utvinternet.ie/links.htm

It can be done by setting <li> to inline, specifying text-align:right on
the <ul>, specify position:relative on the <ul> to make it the
containing element, absolutely positioning the one link you want left
aligned, and then giving the <ul> a left padding in em's to the size of
the positioned link text.

--
Spartanicus
Hi Spartanicus,

Great advice thanks. It now looks great in Firefox but is messed up in IE6.
The "home" link which I want to be on the left of the screen is now
appearing 3 ems (padding-left) from the leftmost part of the <ul>. When I
set the width of the <ul> to 100%, it looks perfect in IE6 but in Firefox, I
get a horizontal scroll.

So close! http://www.borovere.plus.com/css/new.htm

Thanks,

Jeff




Reply With Quote
  #3  
Old   
JB
 
Posts: n/a

Default Re: 2 lists: 1 left aligned and 1 right aligned on same line - 02-25-2006 , 06:26 AM




"JB" <me (AT) here (DOT) com> wrote

Quote:
"Spartanicus" <invalid (AT) invalid (DOT) invalid> wrote in message
news:fcguv112jnmmmo69jts9v440vpd7n1eg1h (AT) news (DOT) spartanicus.utvinternet.ie...
Please list important information not just in the message header, but
repeat it in the message body.

"JB" <me (AT) here (DOT) com> wrote:

Subject: 2 lists: 1 left aligned and 1 right aligned on same line

about: http://www.borovere.plus.com/css/new.htm

Why are you using 2 lists?

Your minimised test case doesn't allow us to see the context and thus
what you are actually trying to do.

Judging by the little information that is there one list seems more
appropriate.

If you want something resembling this navbar:
http://www.pan-europe.utvinternet.ie/links.htm

It can be done by setting <li> to inline, specifying text-align:right on
the <ul>, specify position:relative on the <ul> to make it the
containing element, absolutely positioning the one link you want left
aligned, and then giving the <ul> a left padding in em's to the size of
the positioned link text.

--
Spartanicus

Hi Spartanicus,

Great advice thanks. It now looks great in Firefox but is messed up in
IE6. The "home" link which I want to be on the left of the screen is now
appearing 3 ems (padding-left) from the leftmost part of the <ul>. When I
set the width of the <ul> to 100%, it looks perfect in IE6 but in Firefox,
I get a horizontal scroll.

So close! http://www.borovere.plus.com/css/new.htm

Thanks,

Jeff

In fact, I've fixed it. Had a padding issue!

Thanks all.

Jeff




Reply With Quote
  #4  
Old   
Viken Karaguesian
 
Posts: n/a

Default Re: 2 lists: 1 left aligned and 1 right aligned on same line - 02-25-2006 , 07:17 AM



Quote:
It can be done by setting <li> to inline, specifying text-align:right on
the <ul>, specify position:relative on the <ul> to make it the
containing element,
Spartanicus,

How does position:relative make the <ul> a containing element? Can you
expand on this concept or maybe point me to a url that explains?

Thanks.

--
Viken K.
http://home.comcast.net/~vikenk




Reply With Quote
  #5  
Old   
Spartanicus
 
Posts: n/a

Default Re: 2 lists: 1 left aligned and 1 right aligned on same line - 02-25-2006 , 11:12 AM



"Viken Karaguesian" <vikenkNO_SPAM (AT) NO_SPAMcomcast (DOT) net> wrote:

Quote:
How does position:relative make the <ul> a containing element? Can you
expand on this concept or maybe point me to a url that explains?
http://www.w3.org/TR/CSS21/visudet.h...-block-details

--
Spartanicus


Reply With Quote
  #6  
Old   
Viken Karaguesian
 
Posts: n/a

Default Re: 2 lists: 1 left aligned and 1 right aligned on same line - 02-26-2006 , 08:07 AM



Quote:
How does position:relative make the <ul> a containing element? Can you
expand on this concept or maybe point me to a url that explains?

http://www.w3.org/TR/CSS21/visudet.h...-block-details
Thanks for the reply Spartanicus. If I understand this correctly, a
containing element is similar to a block type element? Setting something as
position: relative makes it display: block by default?

(from the w3.org link)
"For other elements, if the element's position is 'relative' or 'static',
the containing block is formed by the content edge of the nearest
block-level, table cell or inline-block ancestor box."

So, in this case, setting a <ul> to position: relative (without specifying
left: and top also aligns it to the left edge of its containing <div> or
<td>?

--
Viken K.
http://home.comcast.net/~vikenk




Reply With Quote
  #7  
Old   
Spartanicus
 
Posts: n/a

Default Re: 2 lists: 1 left aligned and 1 right aligned on same line - 02-26-2006 , 04:26 PM



"Viken Karaguesian" <vikenkNO_SPAM (AT) NO_SPAMcomcast (DOT) net> wrote:

Quote:
How does position:relative make the <ul> a containing element? Can you
expand on this concept or maybe point me to a url that explains?

http://www.w3.org/TR/CSS21/visudet.h...-block-details

Thanks for the reply Spartanicus. If I understand this correctly, a
containing element is similar to a block type element?
No, the correct phrase is "containing block" (not "containing element"),
and the containing block can be inline.

Quote:
Setting something as
position: relative makes it display: block by default?
It has no effect on the display property.

Quote:
(from the w3.org link)
"For other elements, if the element's position is 'relative' or 'static',
the containing block is formed by the content edge of the nearest
block-level, table cell or inline-block ancestor box."

So, in this case, setting a <ul> to position: relative (without specifying
left: and top also aligns it to the left edge of its containing <div> or
td>?
No, positioned elements (The "Home" link in this example) are positioned
relative to their "containing block". The containing block is the
nearest ancestor with a position of "absolute", "relative" or "fixed",
or the "initial containing block" if there is no such element.

In this case setting "position:relative" to the <ul> causes the
positioned descendant (the "Home" link) to be positioned relative to the
padding edge of the <ul>.

See the box model diagram in the CSS spec to see where the padding edge
lies.

--
Spartanicus


Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.