[Django]-Responsive onesite website padding to centre

3๐Ÿ‘

โœ…

Try this(without the use of media-query);Sorry late to the party

section {
width: 100%;
height: 100vh;
}

.main section.page1 {
background: #81D4FA;
  }

 .main section.page2 {
    background: #F5F5F5;
    }

   .main section.page3 {
   background: #81D4FA;
   }

   .page1{
  display:flex;
  min-height: 100%;
  align-items: center;
 text-align: center;
 flex-direction: column;
justify-content:center;
}

h1 {
font-size: 8vw;
color: #efefef;    
   }

    h2
   {
   list-style-type: none;
   font-size: 4vw;
   color: #efefef;
   text-align: center;
   }

  a.read-more{
  border: 2px solid #efefef;
  text-decoration: none;
  color: inherit;
  }
  .notnav {
    list-style-type: none;
    font-size: 3vw;
    clear: both;
   }
๐Ÿ‘คAbhilekh Gautam

1๐Ÿ‘

Based on your code, here is example of adaption for section.page1 with Media queries. This is what you should use to make your code adapting and responsive.

@media screen and (min-width: 400px){
      section {
        width: auto;
        height: auto;
      }
      section.page1{
        padding: 20px;
      }
      h1 {
        font-size: 8vw;
        color: #efefef;
        text-align: top;
        padding-top: 10px;
        padding-left: 15%;
      }
    }

Here is a large explication about it : Mozilla Developper Using_media_queries

Get more practice and Examples with w3Schools

You can also use bootstrap to get easy css with their grid system : Bootstrap Grid

section {
  width: 100%;
  height: 100vh;
}

.main section.page1 {
  background: #81D4FA;
}

.main section.page2 {
  background: #F5F5F5;
}

.main section.page3 {
  background: #81D4FA;
}


h1 {
  font-size: 8vw;
  color: #efefef;
  text-align: top;
  padding-top: 50%;
  padding-left: 15%;
}

h2
{
  list-style-type: none;
  font-size: 4vw;
  color: #efefef;
  text-align: center;
  padding-top: 2%;
}

a.read-more{
  border: 2px solid #efefef;
  text-decoration: none;
  color: inherit;
}


.notnav {
  list-style-type: none;
  font-size: 3vw;
  padding-top: 2%;
  padding-left: 5%;
  padding-right: 15%;
}

@media screen and (min-width: 400px){
  section {
    width: auto;
    height: auto;
  }
  section.page1{
    padding: 20px;
  }
  h1 {
    font-size: 8vw;
    color: #efefef;
    text-align: top;
    padding-top: 10px;
    padding-left: 15%;
  }
}
<div class="main">
  <section class="page1"> 
    <h1>
      ABOUT ME
    </h1>
    <div class="notnav">
        I am John, 19 years old computer science student. Mainly coding in python, but I am quick lerner and flexible person. I am currently intrested in Artificial Intelligence, Big Data and Design 
      </div>
    <h2>
      <a class="read-more" href='/about'>Read More</a>
    </h2>
  </section>
  <section class="page2">        
     <h1>
      PROJECTS
    </h1>
  </section>
  <section class="page3"> 
    <h1>
      CONTACT
    </h1>
  </section>
</div>
๐Ÿ‘คMaxiGui

Leave a comment