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 3980664
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:19:04+00:00 2026-05-20T05:19:04+00:00

I am trying to use CSS to size an image to the height of

  • 0

I am trying to use CSS to size an image to the height of parent div (which is height: auto) as if the image were removed from the flow. Here’s the markup:

 <div class="item">
        <asp:UpdatePanel ID="upTest" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="True">
            <ContentTemplate>
                <div class="title">Test</div>
                <div class="content">
                    <asp:DropDownList ID="ddlTest" runat="server">
                    </asp:DropDownList>
                </div>
                <div class="confirmation">
                    <img alt="" src="../Graphics/Check-icon.png" />
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
        <hr />
    </div>

The invisible HR is in there so that the parent div stretches down to cover the floating child divs. If there is a better way of handling this, I’d like to know about that, too.

Here’s the CSS:


.item
{   
    -moz-border-radius: 0.5em 0 0 0.5em;
    -webkit-border-radius: 0.5em 0 0 0.5em;
    -khtml-border-radius: 0.5em 0 0 0.5em;
    border-radius: 0.5em 0 0 0.5em;

    border-left: 1px solid black;
    border-bottom: 1px solid black;

    margin-left: 0.5em;
}

.item .title
{
    float: left;
    width: 15%;
}

.item .content
{
    float: left;
    width: 80%;
}

.item .confirmation
{
    float:left;
    width: 5%;
}

.item .confirmation img
{
    height: 1.3em;
}

.item hr
{
    clear: both;
    visibility: hidden;
    padding: 0;
    margin: 0;
}

Thanks for the help!

–Nick

  • 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-05-20T05:19:05+00:00Added an answer on May 20, 2026 at 5:19 am

    It sounds like you don’t know the height of the area you want the image to fill. If this is correct one way to size the image would be to use javascript. You would first have to get the height and width of the parent element and then set the image height and width respectively.

    You will also have to absolutely position the image and relatively position the parent element.

    .item { position:relative; }
    .item .confirmation img { position:absolute; }
    

    If you use jQuery you could resize the image like this.

    $(function() {
    
        /* Get the element and parent element and cache the selectors */
        var $img = $('.confirmation').find('img'),
            $parent = $img.parents('.item');
    
        /* 
           Set the dimensions of the image to match the parent
           If your parent element has margin and padding 
           use outerHeight() & outerWidth()
        */
        $img.css({
            height: $parent.height(),
            left: 0,
            top: 0,
            width: $parent.width()
        });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I am trying to use the CSS hack to set the max-height for
i'm very new at css/html, i'm trying to use an image on my page,
I'm trying to use the background-image css property with a website I'm building with
I'm currently trying to use jQuery to fade a particular div which contains a
I am trying to use a body background image which is center aligned, but
I am trying to use css to have a background image with opaque attributes
I'm trying to use the CSS word-wrap property with break-word value. I want to
I'm trying to use jquery and blueprint css to do a (so i thought)
I am trying to use jQuery to basically wrap a bunch of CSS modifications
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The

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.