Solved

CSS Possition, Offset DIV 180px to the right of center

Posted on 2009-07-13
5
741 Views
Last Modified: 2012-05-07
I need to offset a div 'bannerAd' 180px to the right of center.

Every time I try to do it its looks right then I open the widow a little more and it changes.

The bannerAd div is 160px if that matters

I would love any help, thanks.
0
Comment
Question by:movieprodw
[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
  • 2
5 Comments
 
LVL 4

Expert Comment

by:ryangiglio
ID: 24846096
How is the div positioned?

position:absolute is in relation to the browser window, so it would change when you resized the window.

position:relative is in relation to the element's container, so unless your entire page rearranges when you resize the window, it should stay put.

If that doesn't help, maybe you could post the CSS and we could look for something a little more complicated.
0
 
LVL 1

Author Comment

by:movieprodw
ID: 24846116
Well its a two column CSS setup and I have set the right margin 180px and I have the new banner that I setup and I would like to just stick it on the edge rather then rebuilding a 3 column design.
0
 
LVL 17

Accepted Solution

by:
selvol earned 500 total points
ID: 24847248

<div style="position:absolute;left:180px;top:22px;width:161px;height:161px;z-index:256" title="" id="Layer1">
Bold text.
1. Is the position right and  left negative "-122" is ok
2. Up and Down Position
3. Width
4 Height
Banner HERE  is where yo put the banner code.
Place the at the end of you page right before </html>
Make sure no </dive> are after it
Move the banner as needed by changing the values of left and top
 
Selvol

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div style="position:absolute;left:180px;top:22px;width:161px;height:161px;z-index:256" title="" id="Layer1">
Banner HERE
</div>
</body>
</html>

Open in new window

0
 
LVL 17

Expert Comment

by:selvol
ID: 24847265
Apologies you can get rid of everything else in the code but .
 
<div style="position:absolute;left:180px;top:22px;width:161px;height:161px;z-index:256" title="" id="Layer1">
Banner HERE
</div>
 
But do place it HERE
</body>
</html>
 
Selvol
0
 
LVL 1

Author Comment

by:movieprodw
ID: 24851097
That did not work, it does not move with the page when its opened larger in the browser.
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

Suggested Solutions

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 is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

738 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