Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

Responsive container centered

.container {
  width: 400px;
  height: 300px;
  background-color: #ccc;
  position: absolute;
  /*it can be fixed too*/
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  margin: auto;
  /*this to solve "the content will not be cut when the window is smaller than the content": */
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Responsive #container #centered
ADD COMMENT
Topic
Name
1+4 =