How to align an icon to the right of content

SearchForKnowledge

I have some contents within a DIV. I want to add an image icon to the right of but not push down the rest of the contents underneath it.

Here is my HTML:

<div id="subpageFooter">
    <div id="subpageFooterLeft">
          <div style="z-index: 15; position: relative; left: 0; padding-left: 20px; padding-top: 30px; font-weight: bold; color: #00A0BE; font-size: 13px;">
                Administrative Office
          </div>
          <div style="z-index: 14; position: relative; left: 0; padding-left: 40px; padding-top: 10px; padding-right: 8px; font-weight: normal; color: #000000; font-size: 12px;">
                1250 Avenue, Purchase, NY 36253-2547<br>
                972.656.0700<br>
          </div>
          <img style="position: relative; display: inline-block; left: 80%; margin-right: 15px; width: 52px; height: 51px;" src="theImages/locateit.png" title="Locate Administrative Office" alt="LocateAdministrative Office" />
    </div>
</div>

Here is my CSS:

#subpageFooter {
    position: relative;
    width: 100%;
    height: 625px;
    background: url('../theImages/bg_90_w.png');
    /*box-shadow: 0 0 10px #FFFFFF;*/
}
#subpageFooterLeft {
    position: absolute;
    left: 0;
    float: left;
    width: 60%;
    height: 100%;
}

With the above code the page displays the following:

enter image description here

What I really want is:

enter image description here

Also when I resize the page the content on the left and the icon on the right will proportion correctly in space taken.

How can I accomplish that?

Mark Overton

If you change your code around a bit it works.

<div id="subpageFooter">
<div id="subpageFooterLeft">
      <div style="z-index: 15; position: relative; left: 0; padding-left: 20px; padding-top: 30px; font-weight: bold; color: #00A0BE; font-size: 13px;">
            Administrative Office
          <img style="position: absolute; float: right; display: inline-block; left: 80%; margin-right: 15px; width: 52px; height: 51px;" src="theImages/locateit.png" title="Locate Administrative Office" alt="LocateAdministrative Office" />
      </div>
      <div style="z-index: 14; position: relative; left: 0; padding-left: 40px; padding-top: 10px; padding-right: 8px; font-weight: normal; color: #000000; font-size: 12px;">
            1250 Avenue, Purchase, NY 36253-2547<br>
            972.656.0700<br>
      </div>
</div>
</div>

Working fiddle:

http://jsfiddle.net/nbx7F/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to align icon to the left with text to the right?

From Dev

How to align material icon on right of a input field?

From Dev

How to align content inside ListView ItemTemplate to the right?

From Dev

how to get image icon to align right in a Linear Layout?

From Dev

Align icon to the right in a table cell?

From Dev

Align right content in div element

From Dev

Align right content in div element

From Dev

Flex box, align content to the right

From Dev

Bootstrap - Right Align Icon Buttons in Header on Mobile

From Dev

Right align icon in an ngFor <il> loop

From Dev

How to align a Button to the Right?

From Dev

How to align right social media icon with navbar-collapse in Bootstrap 3?

From Dev

How do i right align an icon set arrow under conditional formatting so that both number and arrow are on right side of cell neatly together?

From Dev

Right Align List Item Content in Ionic Framework

From Dev

Right align the content in a column inside a row

From Dev

how to align the number in MarkerClusterer icon?

From Dev

How to align badge on top of icon

From Dev

how to align the number in MarkerClusterer icon?

From Dev

How to vertically align icon font

From Dev

QPushButton: How to align icon and text

From Dev

How to align my content

From Dev

How to align Image to right in iText?

From Dev

How to align a flex item to the right?

From Dev

How to right align in linear layout

From Dev

How to align overflown div to right?

From Dev

How to align a TextView to the right with LinearLayout

From Dev

How to align overflown div to right?

From Dev

How to align a <td> right and left

From Dev

How to align a div to the right of an iframe?

Related Related

HotTag

Archive