Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placing an "Image" outside of a div, Example inside my post

Tags:

html

css

Okay, let's see if I can explain what I mean, here's an image to help:

Example

So as you can see in the image, I need to get the green arrow from its current location to being placed outside the main div that holds it. I need so if the page is re-sized the arrow will stay in its position. If you need any more information, please let me know. Sorry if this is too vague, I wasn't sure how to explain it. Thanks!

like image 449
Max McKinney Avatar asked Nov 24 '11 03:11

Max McKinney


People also ask

How do you put an image above a div?

Add a relative div placed in the flow of the page. Set the background image as relative so as the div knows how big it must be. Set the overlay as absolute, which will be relative to the upper-left edge of the first image.

Can I put an image in a div?

1) Create a DIV tag with a unique ID; 2) Place the image into a background:url style element of a DIV tag; 3) Set the height and width properties of the DIV tag to that of the selected image.

How do I force an image to stay inside a div?

Answer: Use the CSS max-width Property Additionally, you can also apply the max-height property if you've a fixed height div element, so that the image doesn't overflow from the div's boundary horizontally or vertically.

How do I put an image in text in a div?

This can be done by enclosing the image and text in an HTML “div”. Then make the position of div “relative” and that of text “absolute”. The absolute elements are positioned relative to their parent (div).


2 Answers

Give the container element position: relative; and then give the arrow position: absolute; top: 0; right: -x; (where x is the width of the arrow).

Here is an example: http://jsfiddle.net/joshnh/xpFPd/

like image 125
joshnh Avatar answered Nov 15 '22 04:11

joshnh


You need to apply absolute positioning. If it will always be a constant distance from the left or right then this is easy.

img.class {
    position: absolute;
    right: 16px;
}

For example.

like image 32
Godwin Avatar answered Nov 15 '22 03:11

Godwin