After trying a lot of things I find a way that works. I share it here if it is useful to anyone. You can see it here working: http://jsbin.com/iquviq/30/edit
.content { width: 200px; height: 600px; background-color: blue; position: absolute; /*Can also be `fixed`*/ left: 0; right: 0; top: 0; bottom: 0; margin: auto; /*Solves a problem in which the content is being cut when the div is smaller than its' wrapper:*/ max-width: 100%; max-height: 100%; overflow: auto; }
Related Posts:
- Center form submit buttons HTML / CSS
- How can I make my footer center to the bottom of the page?
- How to center an unordered list?
- Failed to load resource: the server responded with a status of 404 (Not Found) css
- See answer keys in Google Form (quiz) source page?
- CSS Background Opacity [duplicate]
- CSS background-image-opacity?
- Resize image proportionally with CSS?
- How to align a to the middle (horizontally/width) of the page [duplicate]
- How do I vertically align text in a div?
- Embed image in a
- Why does z-index not work?
- How do I vertically center text with CSS?
- How do I vertically center text with CSS?
- Can I have an onclick effect in CSS?
- How to style a checkbox using CSS
- Set cookie and get cookie with JavaScript
- CSS Background Image Not Displaying
- CSS `height: calc(100vh);` Vs `height: 100vh;`
- CSS: Moving the text down a few pixels but keeping the background still?
- Fix footer to bottom of page
- CSS no text wrap
- How to position text over an image in css
- shifting a piece of text down using CSS
- Display Two
s Side-by-Side- Add border-bottom to table row
- CSS: Moving the text down a few pixels but keeping the background still?
- How to use css first-child with :not()
- How can I make a CSS glass/blur effect work for an overlay?
- How to “crop” a rectangular image into a square with CSS?
- Should I use px or rem value units in my CSS?
- Flexbox: center horizontally and vertically
- Maintain the aspect ratio of a div with CSS
- How to draw diagonal lines with css
- How to keep footer at bottom of screen [duplicate]
- jQuery.addClass not working
- what’s the easiest way to put space between 2 side-by-side buttons in asp.net
- Vertically centering a div inside another div
- How do I set vertical space between list items?
- Does bootstrap 4 have a built in horizontal divider?
- Check if an element contains a class in JavaScript?
- How to move image with css/html
- How can I set the image opacity for body background
- How to style the option of an html “select” element?
- CSS pick a random color from array
- html div background image not showing up
- Bring element to front using CSS
- How to apply style classes to td elements?
- Align DIV’s to bottom or baseline
- how to overlap two div in css?
- how to overwrite css style
- How can I move this text up using CSS?
- Target a css class inside another css class
- CSS float right not working correctly
- How can I vertically align elements in a div?
- How to give spacing between buttons using bootstrap
- CSS hover effect is not working on my code
- How can I override Bootstrap CSS styles?
- Space between two rows in a table?
- How do I style a dropdown with only CSS?
- Styling an input type=”file” button
- Make a div fill the height of the remaining screen space
- How to stick footer to bottom (not fixed) even with scrolling
- How to change the background-color of jumbrotron?
- Add image in title bar
- vertical divider between two columns in bootstrap
- Why an inline “background-image” style doesn’t work in Chrome 10 and Internet Explorer 8?
- How to center a navigation bar with CSS or HTML?
- center aligning a fixed position div
- vertical-align with Bootstrap 3
- How to add image that is on my computer to a site in css or html?
- My CSS won’t link to my HTML file
- How do I align in my image to move it vertically up?(CSS,HTML)?
- How to use PHP inside css file
- Table fixed header and scrollable body
- How to center links in HTML
- css display table cell requires percentage width
- Setting a max character length in CSS
- Bootstrap Columns Not Working
- How to write a:hover in inline CSS?
- CSS Resize/Zoom-In effect on Image while keeping Dimensions
- How to draw a trapezium/trapezoid with css3?
- PHP Include Nav-bar For Every Page Techniques?
- External CSS not working
- How to exclude particular class name in CSS selector?
- HTML/CSS–Creating a banner/header
- How to create a text box in PHP to output data
- Change hover color on a button with Bootstrap customization
- Alternate table row color using CSS?
- Set textarea width to 100% in bootstrap modal
- Can I apply a CSS style to an element name?
- How to create a hidden
in JavaScript?
- How can I make a div not larger than its contents?
- CSS “and” selector – Can I select elements that have multiple classes?
- position fixed is not working
- CSS: Background image and padding
- Place a button right aligned
- td widths, not working?
- Firefox CSS Animations Broke [closed]
- Main menu effect visited