Solved

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

Posted on 2009-07-13
5
720 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
Comment Utility
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
Comment Utility
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
Comment Utility

<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
Comment Utility
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
Comment Utility
That did not work, it does not move with the page when its opened larger in the browser.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
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.
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 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…

772 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

14 Experts available now in Live!

Get 1:1 Help Now