adaminglis / adaminglis.github.io

Adam Inglis' Portfolio
https://adaminglis.github.io/
0 stars 0 forks source link

Using Grid Layout #1

Open berryny opened 4 years ago

berryny commented 4 years ago

The HTML Code Layout Create a file inside the htmlclass/ named grid.html

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="css/grid.css">
  <title>Grid Layout</title>
</head>

<body>
  <div class="wrapper">
    <header class="header"></header>
    <aside class="aside">
      <div class="banner-content">
        <img src="https://picsum.photos/id/1027/700" alt="company logo" class="logo round">
        <h1>First Last</h1>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
        <button onclick="window.location.href = 'https://github.com';" class="link-btn">Button Link</button>
        <a href="https://www.github.com" class="link-btn">Anchor Link</a>
        <nav class="socialmedia-icons">
          <ul>
            <li><a href="https://dribbble.com/" target="_blank"><i class="fab fa-dribbble"></i></a></li>
            <li><a href="https://www.behance.net/" target="_blank"><i class="fab fa-behance"></i></a></li>
            <li><a href="https://www.linkedin.com/" target="_blank"><i class="fab fa-linkedin-in"></i></a></li>
          </ul>
        </nav>
      </div>
    </aside>

    <div class="site-content">

      <main class="main">
        <div class="portfolio-container">
          <h2>Headline One</h2>
          <h3>Subheadline</h3>
          <section class="portfolio-projects gridCols">
            <div class="portfolio-project">
              <img src="https://picsum.photos/id/0/700" alt="placeholder">
              <h4>Project Name</h4>
            </div>
          </section>
        </div>
        <div class="research-container">
          <h2>Headline Two</h2>
          <h3>Subheadline</h3>
          <section class="research-projects gridCols">
            <div class="research-project">
              <img src="https://picsum.photos/id/201/700" alt="placeholder">
              <h4>Research Headline One</h4>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
            </div>
            <div class="research-project">
              <img src="https://picsum.photos/id/180/700" alt="placeholder">
              <h4>Research Headline Two</h4>
              <p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
            </div>
            <div class="research-project">
              <img src="https://picsum.photos/id/160/700" alt="placeholder">
              <h4>Research Headline Three</h4>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
            </div>
          </section>
        </div>
      </main>

      <footer>
        <h3>Contact</h3>
        <p>&copy; 2020 by First Last</p>
      </footer>

    </div> <!-- .site-content -->

  </div> <!-- .wrapper -->
</body>

</html>
berryny commented 4 years ago

Create a file inside the htmlclass/css named grid.css

@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css");
@import url('https://fonts.googleapis.com/css?family=PT+Sans:400,700&display=swap');
@import "normalize.css";

/* NOTE: Global Styles */
*, *:before, *:after {
  box-sizing: inherit;
}
html {
  box-sizing: border-box;
}
body {
  font-family: 'PT Sans', sans-serif;
  font-weight: 400;
  font-size: 1em;
  line-height: 1.25em;
  color: #575454;

    -webkit-animation: fadein 2s; /* Safari, Chrome and Opera > 12.1 */
       -moz-animation: fadein 2s; /* Firefox < 16 */
        -ms-animation: fadein 2s; /* Internet Explorer */
         -o-animation: fadein 2s; /* Opera < 12.1 */
            animation: fadein 2s;
}

@keyframes fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Firefox < 16 */
@-moz-keyframes fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Safari, Chrome and Opera > 12.1 */
@-webkit-keyframes fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Internet Explorer */
@-ms-keyframes fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Opera < 12.1 */
@-o-keyframes fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

a, a:link, a:visited, a:focus {
  color: #575454;
}
a:hover {
  color: #4176FA;
}

ul {
  margin: 0;
  padding: 0;
}

/* NOTE: Custom Styles Area */

/*
  NOTE: Using display grid and template areas
  Learn more: https://gridbyexample.com/examples/
*/
.wrapper {
  display: grid;
  grid-template-areas:
    "header header"
    "sidebar main";
  grid-template-columns: 1.5fr 3fr;
}
.header {
  grid-area: header;
}

.aside {
  grid-area: sidebar;
  align-self: center;
}

.link-btn, .link-btn:link {
  display: inline-block;
  background-color: rgb(255, 0, 0);
  color: rgb(255, 255, 255);
  border: 1px solid rgb(255, 255, 255);
  text-decoration: none;
  padding: .5em 1em;
  border-radius: .45em;
  cursor: pointer;
  font-size: 1.15em;
}

.link-btn:hover {
  background-color: rgb(255, 255, 255);
  color: rgb(255, 0, 0);
  border: 1px solid rgb(255, 0, 0);
}

.socialmedia-icons ul {
  margin: 2em 0;
}

.socialmedia-icons ul li {
  display: inline;
  font-size: 1.75em;
  margin-right: 1em;
  margin-bottom: 1em;
}
.socialmedia-icons ul li:last-child {
  margin-right: 0;
}

.socialmedia-icons .fa-dribbble:hover {
  color: rgb(250, 94, 151);
}
.socialmedia-icons .fa-behance:hover {
  color: rgb(65, 118, 250);
}
.socialmedia-icons .fa-linkedin-in:hover {
  color: rgb(0, 122, 185);
}

.site-content {
  grid-area: main;
  position: relative;
}
.main h2, .main h3 {
  text-align: center;
}

.gridCols {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr) );
  grid-gap: 1em;
}
.gridCols img {
  display: block;
  width: 100%;
}

/* NOTE: Large Screens */
@media only screen and (min-width: 758px) and (min-height: 758px) {
  body {
    overflow: hidden;
    -ms-scroll-limit: 0 0 0 0;
    -ms-overflow-style: none;
  }
  .wrapper, .site-content {
    height: 100vh;
    min-height: 758px;
  }
  .wrapper {
    overflow: hidden;
  }
  .header {
    display: none;
  }
  .logo {
    display: block;
    width: 100%;
  }
  .round {
    border-radius: 50%;
  }
  .banner-content {
    padding: 0 20%;
  }
  .site-content {
    overflow: auto;
  }
}

/* NOTE: Portable Devices */
@media only screen and (max-width: 758px), (max-height: 758px) {
  .wrapper {
    display: grid;
    grid-template-areas:
      "header"
      "main";
    grid-template-columns: auto;
  }

  .header {
    display: block;
    height: 100vh;
    /* min-height: 600px; */
    border-bottom: 1px solid #eee;
  }

  .aside {
    grid-area: header;
    padding-top: 2%;
  }
  .banner-content {
    text-align: center;
  }
  .banner-content img.logo {
    display: block;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
  }

  .gridCols > div h4,
  .gridCols > div p {
    padding: 0 2%;
  }

  footer {
    text-align: center;
  }
}
@media only screen and (max-height: 758px) {
  .aside {
    padding: 0 2%;
  }

  .banner-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, auto) );
    grid-gap: .5em;
    align-items: center;
    text-align: center;
  }
  .banner-content img.logo {
    display: block;
    width: 100%;
    max-width: 150px;
    margin: 0 auto;
  }

}