How to position two elements left and right aligned purely using CSS?
March 8, 2008 11:19 AM
Subscribe
HTML/CSS Design Filter! How do I position two elements in the same line but, one left aligned, and the other right aligned using just CSS?
I'm a bit of a n00b to pure-css design, so forgive my ignorance!
I'm trying to position the page title and the logo in the header of the page. I want the title to be left aligned, and the logo to be right-aligned. Oh, and I want to make it a flexible layout, i.e. I'd like the page to expand/contract as the browser window size changes.
I've been
reading up a on purely css based design, but for the life of me I can't figure out how to accomplish this.
Here's the
link to the page.
Also, any resources for learning more of this stuff are welcome.
posted by ogami to technology (10 comments total)
8 users marked this as a favorite
What I changed:
- Made the title and logo both their own div (instead of using span)
- Made the title float left and the logo float right
- Put in a "clear" div below the header. The clear is needed because when you use float, any other content that comes afterward will flow around the floated divs.
posted by sanitycheck at 11:31 AM on March 8, 2008