Use the CSS 3 property background-size
:
#my_container {
background-size: 100% auto; /* width and height, can be %, px or whatever. */
}
This is available for modern browsers, since 2012.
More Related Contents:
- elements are not centered aligned inside the wrapper and when I set the width of the wrapper it goes out of the browser width..any solution?
- How can I center text (horizontally and vertically) inside a div block?
- Why not use tables for layout in HTML? [closed]
- How do I auto-resize an image to fit a ‘div’ container?
- How can I position my div at the bottom of its container?
- Equal height rows in a flex container
- Google Chrome form autofill and its yellow background
- Why is ‘position: sticky’ not working with Core UI’s Bootstrap CSS
- Keep the middle item centered when side items have different widths
- Are you allowed to nest a link inside of a link?
- Using custom HTML Tags
- How can I display the checkbox over the images for selection?
- How can I align two divs horizontally? [duplicate]
- Hide vertical scrollbar in element
- How to make Scrollable Table with fixed headers using CSS [duplicate]
- Why is the parent div height zero when it has floated children
- CSS grid – maximum number of columns without media queries
- Can a dynamic class be styled using CSS? [duplicate]
- CSS filter:invert not working with background-color
- Empty vertical space between columns in Bootstrap 4
- Select second last element with css
- Css transition from display none to display block, navigation with subnav [duplicate]
- Apply CSS Style on all elements except with a SPECIFIC ID
- Is there a way to get a textarea to stretch to fit its content without using PHP or JavaScript?
- Select option padding not working in chrome
- How to make bootstrap carousel image responsive?
- Background-Color of BODY tag applied to the whole HTML [duplicate]
- How to make a flex item not fill the height of the flex container? [duplicate]
- Complete list of reasons why a css file might not be working
- What is HTML’s tag default display type?