Solved

Why does this div not display correctly?

Posted on 2013-11-27
3
204 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
  • 2
3 Comments
 
LVL 42

Expert Comment

by:Chris Stanyon
Comment Utility
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 42

Accepted Solution

by:
Chris Stanyon earned 500 total points
Comment Utility
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
Comment Utility
That'll do it!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now