AP Div Positioning

Posted on 2012-03-13
Last Modified: 2012-03-13
I am working on a website and trying to position an image to a specific spot. Here is the link to the page I'm testing it on:

The menu bar should be tight up against the bottom of the black banner and the red star should be just to the right of the main logo and on top of both the black banner and the blue menu bar - like this test page:

The problem with "indextest2" page is that when I resize the browser window, the start moves. So I created "layouttest" using a div for the black banner - setting its position to relative and adding the star div.

I'm new to using div's and positioning - unfortunately I've been using old school tables. I'm working at getting away from that, but at this I am.

I hope someone can help me out.
Question by:JustDuckyDesigns
LVL 12

Accepted Solution

Tony van Schaik earned 500 total points
ID: 37716914
This should work give it a shot:

#apDiv1 {
	margin-left: 820px; /* Instead of Left */
	top: 50px;

Open in new window

And an other advice. Don't use images in the layout itself, keep your layout free from images in the HTML. Instead add them in your stylesheet. It's easier to maintain...

Like this for example:
<div id="apDiv1>

#apDiv1 {
        background:url(KatieImages/13yearsstar275.png) no-repeat left top;
	margin-left: 820px; /* Instead of Left */
	top: 50px;

Open in new window


Author Closing Comment

ID: 37717128
Absolutely perfect! Exactly what I needed and even extra info that was very helpful!

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
align Linkedin sign to the right page 5 37
Why my select dropdown does not work? 8 41
How to position loader with CSS 3 41
css selector 1 17
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

803 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