lundi 3 septembre 2018

css - how to keep relations of elements with smaller displays

how can I keep the relations of 'details' and 'picture' if the display gets smaller i.e. on a mobile phone? I want 'details' always stick left to 'picture' with a certain margin.

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <style type='text/css'>
    body {
      margin: 0;
      overflow: auto;
    }
    #picture {
      display: inline;
      float: left;
    }
    #image {
      margin-top: 50px;
    }
    #details {
      position: relative;
      border-width: 1px;
      border-style: solid;
      float: left;
      display: block;
      margin-left: 30%;
      margin-right: 20px;
    }
  </style>
</head>
<body>
  <div id='image'>
    <div id='details'>
      Lorem ipsum dolor sit amet, <br>consectetur adipisicing elit
    </div>
    <img height=400 width=400 src='' id='picture'>
  </div>
</body>



</html>




Aucun commentaire:

Enregistrer un commentaire