HighDots Forums  

div on side?

alt.html.dhtml alt.html.dhtml


Discuss div on side? in the alt.html.dhtml forum.



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

Default div on side? - 02-18-2006 , 11:33 AM






Hello. I'm wondering, say I have a centered bit of content (and center
of screen, so probably 100% width for that div), like so

<div align="center" style="width: 100%">
Some content that's centered
</div>

How exactly does one add something aligned to the right but in the same
"row" or "line" if you will (the right align content is not under the
centered, but to the right of it, with the centered content still being
in center, and not pushed over or anything.

So it would come out something like this:

Quote:
Centered Content Right Aligned |

(And the right aligned needs to stay to always hug the right side, so
when the screen is resized its still the same amount of space from the
right, and the centered is still center of the screen.)

I know I might not be doing it all right so far, so any pointers an help
would be greatly appreciated.

(Also, what if I wanted to also throw in a left side section, that acts
like the right side, but for the left instead, would that require
anything special compared to how ever its done for the right side
section?)




Reply With Quote
  #2  
Old   
David E. Ross
 
Posts: n/a

Default Re: div on side? - 02-18-2006 , 11:58 AM






Steve Kostecke wrote:
Quote:
Hello. I'm wondering, say I have a centered bit of content (and center
of screen, so probably 100% width for that div), like so

div align="center" style="width: 100%"
Some content that's centered
/div

How exactly does one add something aligned to the right but in the same
"row" or "line" if you will (the right align content is not under the
centered, but to the right of it, with the centered content still being
in center, and not pushed over or anything.

So it would come out something like this:

| Centered Content Right Aligned |


(And the right aligned needs to stay to always hug the right side, so
when the screen is resized its still the same amount of space from the
right, and the centered is still center of the screen.)

I know I might not be doing it all right so far, so any pointers an help
would be greatly appreciated.

(Also, what if I wanted to also throw in a left side section, that acts
like the right side, but for the left instead, would that require
anything special compared to how ever its done for the right side
section?)


Do you mean you want to create a right sidebar as in my home page? (See
the URL in my signature below.)

--

David E. Ross
<http://www.rossde.com/>


Reply With Quote
  #3  
Old   
Stan McCann
 
Posts: n/a

Default Re: div on side? - 02-18-2006 , 01:27 PM



"Steve Kostecke" <spamtrap (AT) ntp (DOT) isc.org> wrote in
news:45p43vF7rucfU1 (AT) individual (DOT) net:

Quote:
Hello. I'm wondering, say I have a centered bit of content (and
center of screen, so probably 100% width for that div), like so

div align="center" style="width: 100%"
Some content that's centered
/div

How exactly does one add something aligned to the right but in the
same "row" or "line" if you will (the right align content is not
under the centered, but to the right of it, with the centered
content still being in center, and not pushed over or anything.

So it would come out something like this:

| Centered Content Right Aligned |
See http://www.w3.org/TR/CSS21/visuren.html#propdef-float. Enclose
your right side content in an appropriate element and style that
element to float to the right. It will then hug the right margin.
Apply left instead of right for left side.

http://alamo.nmsu.edu/catalog/ shows an old example (scroll down). I
hadn't visited that page in quite some time. Looks like it needs some
work again (I'll do it in the site revision I'm in the process of).

--
Stan McCann, "Uncle Pirate" http://stanmccann.us/
Webmaster, NMSU at Alamogordo http://alamo.nmsu.edu/
Now blocking Google Grouper posts and replies.
http://blinkynet.net/comp/uip5.html


Reply With Quote
  #4  
Old   
Jim Moe
 
Posts: n/a

Default Re: div on side? - 02-18-2006 , 02:49 PM



Steve Kostecke wrote:
Quote:
div align="center" style="width: 100%"
Some content that's centered
/div

How exactly does one add something aligned to the right but in the same
"row" or "line" if you will (the right align content is not under the
centered, but to the right of it, with the centered content still being
in center, and not pushed over or anything.

So it would come out something like this:

| Centered Content Right Aligned |

div align="center" style="width: 100%"
<span style="float:right">Right Aligned</span>
Some content that's centered
</div>

or

<div align="center" style="width: 100%">
<span style="position: absolute; right: 2em;">Right Aligned</span>
Some content that's centered
</div>

or

<div align="center" style="width: 100%">
<div style="position: absolute; right: 2em; width: 10em">Right Aligned</div>
Some content that's centered
</div>

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


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

Default Re: div on side? - 02-21-2006 , 10:41 AM



I have done a similar thing with CSS. The same principle should hold
in HTML. Just align your text left -n% or right-n% to get it to one
side or the other of the centered content. For example, I have "top of
page" at various places linked to an anchor at, surprisingly enough,
the top of the page. You may have to use display and absolute
positioning. I have enclosed it in a <span> and then coded the css
file like this:
span.topofpage {
display: block;
position: absolute;
right: -20%;
}
This places my "top of page" links off to the right of the centered
content, which is also positioned absolutely by using similar code.
Whether this is the RIGHT way or not, I don't know; but it works for me.


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.