Home > OS >  Problem with the positioning of an aside in an html page
Problem with the positioning of an aside in an html page

Time:12-15

a week ago I started to learn html and css and to practice I decided to emulate an old web page with what I learned so far. The page is the following: enter image description here

CodePudding user response:

I'd just give the wrapper/body-element your desired background-color, make a new container inside of that wrapper-element, give that your other desired background-color, and then center it. This way you don't have to make 2 new elements.

* {
  margin: 0;
  padding: 0;
}

body {
  background-color: lightcyan;
}

.wrapper {
  background-color: rgb(35, 168, 221);
  height: 100vh;
  max-width: 75%;
}

.container {
  background-color: lightcyan;
  max-width: 80%;
  height: 100%;
  margin-left: auto;
  margin-right: auto;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>ELECTRIC PAGES Reading Notes</title>
  <link rel="stylesheet" href="css/style.css" />
</head>

<body>
  <main>
    <div >
      <div >
        <h2>Reading Notes</h3>
      </div>
    </div>
  </main>
</body>

</html>

  • Related