Solved

Why does this div not display correctly?

Posted on 2013-11-27
3
209 Views
Last Modified: 2013-11-27
Head out to http://www.brucegust.com/drummerboy

I want the youtube video that's belligerently lurking at the bottom of the screen to be positioned where the youtube graphic is.

I've got the graphic positioned "relative" and the youtube div is "absolute," but I can't get the two to cooperate.

What am I doing wrong?

Here's my stylesheet:

body {
	font-family: Helvetica, Microsoft Sans Serif;
	font-size: 14px;
	color: #000000;
	vertical-align: top;
	height: 100%;
	width: 100%;
	margin-top:25px;
	background-color:#ffffff;
}


#graphic {
position:relative;
height:934px;
width:1085px;
text-align:center;
margin:auto;
}

#youtube {
position:absolute;
height:319px;
width:460px;
margin-left:579px;
margin-top:176px;
z-index:2;
}



		










		

Open in new window

0
Comment
Question by:brucegust
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 39681516
You're positioning your #youtube DIV absolutely so you need to tell it where to sit. Because you already have margins in place, just add top: 0; to the rule and it'll be fine:

#youtube {
    height: 319px;
    margin-left: 579px;
    margin-top: 176px;
    position: absolute;
    top: 0;
    width: 460px;
    z-index: 2;
}

Open in new window

0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 39681535
A better solution may be to remove the margins altogether and just position the DIV

#youtube {
    height: 319px;
    left: 579px;
    top: 176px;
    position: absolute;
    width: 460px;
    z-index: 2;
}

Open in new window

0
 

Author Comment

by:brucegust
ID: 39681589
That'll do it!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
This article discusses four methods for overlaying images in a container on a web page
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question