?
Solved

Why does this div not display correctly?

Posted on 2013-11-27
3
Medium Priority
?
211 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 2000 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

Independent Software Vendors: 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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
Suggested Courses
Course of the Month9 days, 22 hours left to enroll

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