Solved

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

Posted on 2009-07-13
5
734 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
  • 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Change color of modular 8 30
compact pure CSS Read More Toggle 4 58
Width of Page is Affecting Side Menu 6 24
Can't get container centered 4 12
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
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 transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

808 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