Jump to content

Help with positioning


AJoy

Recommended Posts

Hi all. I'm pretty new to web design with CSS, so bear with me if this is a really basic question. I'm having trouble getting my positioning right. Here's the webpage so far:http://studentaccess...site/index.html I want the tabs to sit on top of the image. Even though they are before the <div id="content"> part in my HTML, they are still overlapping the image, as you see.I also want them to be flush with the left edge of the image (which is centered). Here's the relevant part of the HTML:<body bgcolor="#EDEDED"> <div id="header"><p><span id="title"> AVA </span><br> my challenge for the 2013 year is to record one original song or musical piece per month.</p></div> <div id="Tabs"><ul><li><a href="Challenge.html">This month's song</a></li><li><a href="Compositions.html">Compositions </a></li><li><a href="Covers.html">Covers </a></li><li><a href="hire.html">Hire AVA to sing </a></li></ul> </div> <!– End of Tabs Div –> <div id="content"> <div id="Content_Area"><p>...the text...</p></div> <div id="followbox">links to RSS feeds, etc., here</div></div> <!-End of content-> </body> And the relevant CSS:body {font-family: "Mona Lisa Solid ITC TT","Modern No. 20",Garamond,Gabriola,serif;font-size: 1.4em;} #Tabs {display: block;position: relative;margin: 0;margin-right: auto;margin-left: auto;} #Tabs ul {padding: 0px;list-style-type: none;} #Tabs ul li {display: inline-block;clear: none;float: left;} #Tabs ul li a {position: relative;margin-top: 0px;display: block;margin-left: 5px;line-height: 1em;padding-left: 10px;background: #f6f6f6;border: 1px solid #ccc;border-bottom: 0px;-moz-border-radius-topleft: 4px;border-top-left-radius: 4px;-moz-border-radius-topright: 4px;border-top-right-radius: 4px;/* end of rounded borders */ width: 150px;height: 50px;color: #000000;text-decoration: none;font-style: italic;} #Tabs ul li a:hover {text-decoration: underline;} #content {background-image: url(images/bg_image_med.jpg);background-repeat: none;border: 1px solid #000000;height: 500px;width: 900px;margin-left: auto;margin-right: auto;} #Content_Area {padding: 15px;overflow: hidden;position: relative;width: 620px;height: 500px;overflow: hidden;} p { padding: 15px; } What am I doing wrong?Thanks in advance!

Edited by AJoy
Link to comment
Share on other sites

Solved:

<html><header><title>Blah</title><style>body {font-family: "Mona Lisa Solid ITC TT","Modern No. 20",Garamond,Gabriola,serif;font-size: 1.4em;}#Tabs {width: 903px;display: block;margin-right: auto;margin-left: auto;overflow: hidden;}#Tabs ul {padding: 0px;list-style-type: none;}#Tabs ul li a {float: left;margin-top: 0px;display: inline-block;margin-right: 5px;line-height: 1em;padding-left: 10px;background: #f6f6f6;border: 1px solid #ccc;border-bottom: 0px;-moz-border-radius-topleft: 4px;border-top-left-radius: 4px;-moz-border-radius-topright: 4px;border-top-right-radius: 4px;width: 150px;height: 50px;color: #000000;text-decoration: none;font-style: italic;}#Tabs ul li a:hover {text-decoration: underline;}#content {background-image: url(images/bg_image_med.jpg);background-repeat: none;border: 1px solid #000000;height: 500px;width: 900px;margin-left: auto;margin-right: auto;}#Content_Area {padding: 15px;overflow: hidden;width: 620px;height: 500px;}p { padding: 15px; }</style></header>	<body bgcolor="#EDEDED"><div id="header"><p><span id="title"> AVA </span><br> my challenge for the 2013 year is to record one original song or musical piece per month.</p></div><div id="Tabs"><ul><li><a href="Challenge.html">This month's song</a></li><li><a href="Compositions.html">Compositions </a></li><li><a href="Covers.html">Covers </a></li><li><a href="hire.html">Hire AVA to sing </a></li></ul></div><div id="content"><div id="Content_Area"><p>...the text...</p></div><div id="followbox">links to RSS feeds, etc., here</div></div></body></html>

  • Like 1
Link to comment
Share on other sites

Wow, that was fast. Thanks!! So... it was the "overflow: hidden" that made the tabs jump up there. I don't quite get why. I understand your other changes, though--putting the margins between the tabs on the right instead of on the left makes perfect sense.You're my hero of the day! :)

Link to comment
Share on other sites

Actually there is a little more too it. Skype me and I will send you some cleaner code. I just did that from my iPad. I can clean it up on my Mac. Up to you. Cleanup:HTML:

<!DOCTYPE html><html><head><title>AVA's Website</title><link rel="stylesheet" type="test/css" href="ava.css"></head><body><div id="header"><h1>AVA</h1><p>My challenge for the 2013 year is to record one original song or musical piece per month.</p></div><div id="tabs"><ul><li><a href="Challenge.html">This month's song</a></li><li><a href="Compositions.html">Compositions</a></li><li><a href="Covers.html">Covers</a></li><li><a href="hire.html">Hire AVA to sing</a></li></ul></div><div id="content"><div id="contentArea"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p><p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p></div><div id="followBox"><p>links to RSS feeds, etc., here</p></div></div><div id="footer"><p>Image credit: <a href='http://www.123rf.com/photo_15922339_metallic-metal-texture-background.html'>ngonhan / 123RF Stock Photo</a> | Image credit: <a href='http://www.123rf.com/photo_12205959_smooth-and-elegant-satin-isolated-on-a-white-background.html'>yuliufu / 123RF Stock Photo</a></p><p class="copy">©2012 Abigail Smith</p></div></body></html>

CSS:

* {margin: 0;border: 0;padding: 0;}body {background: #ededed;font-family: "Mona Lisa Solid ITC TT","Modern No. 20",Garamond,Gabriola,serif;font-size: 1.4em;}a {text-decoration: none;}p,#contentArea,#header {padding: 15px;}#header,#content,#footer {width: 900px;}#header,#tabs ul li a {text-align: center;}#header {margin: 22px auto;background: #999999;color: #666666;font-weight: bold;font-size: 1em;letter-spacing: 3px;}#header h1,#header p{margin: 0;padding: 0;}#header h1 {font-size: 3em;text-align: left;}#tabs ul,#content,#footer {margin: 0 auto 0;overflow: hidden;}#tabs ul {list-style: none;width: 902px;}#tabs ul li a {display: inline-block;margin-right: 5px;border: 1px solid #cccccc;border-bottom: 0;-moz-border-radius-topleft: 4px;border-top-left-radius: 4px;-moz-border-radius-topright: 4px;border-top-right-radius: 4px;width: 150px;height: 50px;float: left;font-style: italic;color: #000000;background: #f6f6f6;line-height: 2.4em;}#tabs ul li a:hover {text-decoration: underline;}#content {border: 1px solid #000000;background: url(http://studentaccess.emporia.edu/~asmith40/AVAwebsite/images/bg_image_med.jpg) no-repeat;}#followBox { }#footer {margin-top: 10px;}#footer p {padding: 5px;}#footer p.copy {text-align: right;}

Edited by DarkxPunk
Link to comment
Share on other sites

Interesting that you write "background" alone, followed by the hex # or the background image. I was taught to use "background-color" and "background-image". Nice to see that the simplified way works as well. Thanks, again, can't say it enough, for your help. I learned a ton!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...