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

  • Home
  • SEARCH
  • 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 8467945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:47:30+00:00 2026-06-10T15:47:30+00:00

I have the following setup <div id=outerDiv style=width:100%;> <div id=innerDiv> <center> <a href=http:/… title=..>

  • 0

I have the following setup

<div id="outerDiv" style="width:100%;">
  <div id="innerDiv">
    <center> 
        <a href="http:/..." title="..">
            <img src="http://...jpg" width="800" height="xxx" alt=".."> 
        </a> 
    </center>
  </div>
<div>

The width of the outerDiv can change based on browser view-port. Is there a way to restrict the width on the innerDiv just by using a style attribute, such that it overrides the included image width (800 in this example). Currently the image spans beyond the viewport and I would like the div/browser to shrink the image to the inner-div-size.

Am looking for something like:

<div id="outerDiv" style="width:100%;">
  <div id="innerDiv" style="attribute:xxx;" or something similar>
    <center> 
        <a href="http:/..." title="..">
            <img src="http://...jpg" width="800" height="xxx" alt=".."> 
        </a> 
    </center>
  </div>
<div>

Please note that : the innerDiv is rendering ‘variable’ data coming from a stored parameter for instance. I only have control on the style on the innerDiv to make sure that things like ‘center’ or ‘width’ on the innerHtml does not go beyond what the outerDiv is setting. I have tried to use ‘max-width’ on the outer-div, but that didn’t seem to work (I am not an expert on html/css – so I could have done it incorrectly).

Many thanks for all your help !

  • 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-10T15:47:31+00:00Added an answer on June 10, 2026 at 3:47 pm

    max-width property can help you.

    Remove width attribute from img tag and write additional css code:

    <style>
    #innerDiv { text-align: center; width: 800px; }
    #innerDiv a > img { display: inline-block; max-width: 100%; }
    </style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following setup: <div>Element with CSS3 animated height change</div> <div><a href=#>Link</a></div> I
I have the following setup on 2 div tags: <div id='div1' style='position: absolute; z-index:
I have the following title div setup, but when only the leftmost div has
I have following setup: html: <div id=holder> <div> <img/> <img/> </div> </div> css #holder
I have the following jsfiddle setup: http://jsfiddle.net/cvn6n/ Based on the radio selection a div
I have the following ul setup: <div id=sidebar> <ul id=themenu class=sf-menu sf-vertical> <li> <a
I have a website with the following setup: <div id=container> <div id=header></div> <div id=content></div>
I have the following jsfiddle setup: http://jsfiddle.net/eyTBZ/2/ Basically almost everything works, apart from when
Ok... I have the following setup: A div with n divs as children (n
I have following setup: .calender-month{ float:left; } .buttondiv{ float:left; } <div class=buttondiv><button id=backbtn>back</button> <div

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.