CSS - how to get position: absolute; to work well with different screen sizes -


if want element positioned @ position on screen can use:

position: absolute; top: 614px; left: 215px; 

and on screen works perfect, element right want be. if use bigger screen wrong , if use small screen might have scroll see element @ all. how can fix this? i've tried researching , figured quite normal issue haven't found helpful. thanks!

the position absolute css works placing absolutely respect parent element. if parent element doesn't exit default way html element. in short means if parent changes absolute positioning changes.

it's better idea use percentages if want responsive. can use media queries adjust positions required.

  .my-absolute-px{          position: absolute;          top: 100px;          left: 100px;      }            .my-absolute-percent{          position: absolute;          top: 50%;          left: 45%;      }
              <div class="my-absolute-px">some px content</div>      <div class="my-absolute-percent">some % content</div>


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -