General Notes of CSS

CSS is the language we use to style an HTML document. CSS describes how HTML elements should be displayed. This is general notes of CSS.

Body Width that Expands or Shrinks on Zoom In or Out of Browser

Setting width of body or div of HTML document is using width and height, and the values can be px, %, vw, vh, and em. But setting width will not respect zooming in and out of browser when you hit Ctrl + -, Ctrl + = and Ctrl + 0. Meaning the width of body will not expands or shrinks on zooming in and out the browser.

To make the width of body or div so, setting max-width to px value is the trick. See:

body {
  margin: auto;
  max-width: 1000px;
  padding-left: 9px;
  padding-right: 9px;
}
@media only screen and (max-width: 700px) {
  body {
      width: 100%;
      padding-left: 9px;
      padding-right: 12px;
  }
}

 

Positioning Text Over Iamge

See: Positioning Text Over a Image

Comments

Popular posts from this blog

printf - Printing with format

rebase or no-rebase for git pull

dmmsh-wlr for managing outputs in Wayland using wlr-randr