Solved

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

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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 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 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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

856 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