The solution is to set your div
to display: inline-block
.
Related Contents:
- How to make a div fill a remaining horizontal space?
- How to make an element width: 100% minus padding?
- Div width 100% minus fixed amount of pixels
- resizes wrong; appears to have unremovable `min-width: min-content`
- Make an image width 100% of parent div, but not bigger than its own width
- How to make a div with no content have a width?
- td widths, not working?
- Display block without 100% width
- How to make table cell shrink according to the content?
- How to make div’s percentage width relative to parent div and not viewport
- How to get the in HTML tables to fit content, and let a specific fill in the rest
- Word wrap a link so it doesn’t overflow its parent div width [duplicate]
- 100% width is bigger than parent’s div
- Minimum and maximum value of z-index?
- How to prevent line breaks in list items using CSS
- How do I make a text input non-editable?
- Can I change the color of Font Awesome’s cog icon?
- IE8 support for CSS Media Query
- How can I make a CSS glass/blur effect work for an overlay?
- Imitating a blink tag with CSS3 animations
- White space showing up on right side of page when background image should extend full length of page [closed]
- How can I make the contents of a fixed element scrollable only when it exceeds the height of the viewport?
- Styling HTML email for Gmail
- Remove Microsoft Edge’s phone number styling
- Horizontal list items
- Can I specify maxlength in css?
- Why are double quotes shown only for the first element?
- Bootstrap 3 Glyphicons CDN
- How do I vertical center text next to an image in html/css?
- Aligning elements left and center with flexbox
- Radio/checkbox alignment in HTML/CSS
- width:100% vs. width:inherit
- Css transition from display none to display block, navigation with subnav [duplicate]
- CSS position absolute and width of parent container in percent
- Textarea height: 100%
- Video 100% width and height
- How to style a clicked button in CSS [duplicate]
- Why is my CSS style not being applied?
- Modifying content width of the Sphinx theme ‘Read the Docs’
- CSS padding is not working as expected in Outlook
- Set visited link color to whatever the color of un-visited link is (P.S. not the usual question)
- How can I get an absolutely-positioned div to extend outside its relativley-positioned parent, which has overflow: auto?
- using favicon with css
- How to stretch flex child to fill height of the container?
- CSS3 transition doesn’t work with display property [duplicate]
- CSS column breaks?
- How can I use CSS3 transform on a span? [duplicate]
- HTML CSS How to stop a table cell from expanding
- Why doesn’t margin get filled with background color in CSS?
- How to vertically center the contents of a flexbox item