Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9151599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:50:33+00:00 2026-06-17T11:50:33+00:00

I have a markup that looks like this: <div style=width: 150px; height: 250px;> <img

  • 0

I have a markup that looks like this:

<div style="width: 150px; height: 250px;">
    <img src="Image1.jpg" />

    <div class="YellowExclaimIcon iconsBlack"></div>
</div>

What I want to achieve is below:

Result

Meaning that the image should always be placed center (Both horizontal and vertical) in the parent div and the warning icon should on top of the image with a margin of 5 to the right and to the bottom.

Another thing to note is that, the image width and height is not always the same, but the position for the warning icon should always be the correct place.

The YellowExclaimIcon class contains a background image, but can be altered to a image if need be. Something to consider is the image also has a max-width and max-height.

I tried with the answer in this thread CSS Help – div over image but I could’t get it to work with the centering.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:50:35+00:00Added an answer on June 17, 2026 at 11:50 am

    if the image width & height are variable, you can only achieve this if you change the markup, something like this:

    <style type="text/css">
        div.container {
            width:150px; height:250px; display:table-cell; vertical-align:middle; 
            text-align:center; background-color:#ededed}
        div.image {
            position:relative; display:inline-block; }
        div.image img {
            display:block; }
        div.YellowExclaimIcon {
            position:absolute; width:80px; height:80px; bottom:5px; right:5px; 
            background:transparent url(your-icon.png) no-repeat 100% 100%}
    </style>
    
    <div class="container">
        <div class="image">
            <img src="Image.jpg" alt="" />
            <div class="YellowExclaimIcon"></div>
        </div>
    </div>
    

    The sample above will always horizontally & vertically align the image in the center, with an icon in the bottom right corner, 5px margin.

    Check a working sample: http://jsfiddle.net/Q9uhV/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have markup that looks like this <div class=myDiv><ul> <li><img src=img1.jpg/></li> <li><img src=img1.jpg/></li> .
I have got some markup that looks like this: <div class=button> <span class=image></span> <input
I have a container that looks like this <div id=container>This container has a <a
I have the following markup code in my page: <div id=root_img style=width:100%;height:100%> <div id=id_immagine
I have this markup: <div id=slider1> <div class=ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all> <a style=left:
I have the following markup: <div class=user-photo> <img src= /> </div> I want to
I have an angular template which looks like this... <div ng-repeat=message in data.messages ng-class=message.type>
I have an href image in this markup. <div class=imgdiv> <a class=imga href=http://destination.com> <img
I have a page that looks like: <div id=header>...</div><div id=navigation>...</div> similar for body and
I have a page built with jQuery mobile with header markup that looks like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.