Home > Blockchain >  How to add logo to top left of page?
How to add logo to top left of page?

Time:12-13

I am trying to put a logo image in the top left were SYLK is. It keeps going to the center of the page. I need the image to go where sylk is on the page. I tried just adding the img into it but it goes right to the center. Any help is much appreciated. The logo is going to act as a home button.

HTML

<!doctype html>
<html>
   <head>
      <title>SYLC</title>
      <link rel="stylesheet" type="text/css" href="style.css">
      <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" integrity="sha512-5A8nwdMOWrSz20fDsjczgUidUBR8liPYU WymTZP1lmY9G6Oc7HlZv156XqnsgNUzTyMefFTcsFH/tnJE/ xBg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
   </head>
   <body>
      <header>
         <A href="#" >sylk</A>
         <ul>
            <li><a href="#" >Home</a></li>
            <li><a href="#">Merch</a></li>
            <li><a href="#">Work</a></li>
            <li><a href="#">Contact</a></li>
         </ul>
      </header>
      <section>
         <img src="img/stars.png" id="stars">
         <img src="img/moon.png" id="moon">
         <img src="img/mountains_behind.png" id="mountains_behind">
         <h2 id="text">Sweti Yeti</h2>
         <a href="#sec" id="btn">Mint Now</a>
         <img src="img/mountains_front.png" id="mountains_front">
         <div >
      </section>
      <div  id="sec">
      <h2>A Collection of 9,999 Yetis</h2>
      <p>A Colorful, Engaging and Inovating Community. The Sweti Yeti's, a community focused club. 
      </p>
      <h2>Yeti Trip</h2>
      <div >
         <div >
            <ul>
               <li>
                  <div >
                     <h3 >20th may, 2010</h3>
                     <h1>Heading 1</h1>
                     <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Consectetur tempora ab laudantium voluptatibus aut eos placeat laborum, quibusdam exercitationem labore.</p>
                  </div>
               </li>
               <li>
                  <div >
                     <h3 >20th may, 2010</h3>
                     <h1>Heading 2</h1>
                     <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Consectetur tempora ab laudantium voluptatibus aut eos placeat laborum, quibusdam exercitationem labore.</p>
                  </div>
               </li>
               <li>
                  <div >
                     <h3 >20th may, 2010</h3>
                     <h1>Heading 3</h1>
                     <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Consectetur tempora ab laudantium voluptatibus aut eos placeat laborum, quibusdam exercitationem labore.</p>
                  </div>
               </li>
               <li>
                  <div >
                     <h3 >20th may, 2010</h3>
                     <h1>Heading 4</h1>
                     <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Consectetur tempora ab laudantium voluptatibus aut eos placeat laborum, quibusdam exercitationem labore.</p>
                  </div>
               </li>
            </ul>
         </div>
      </div>





      <div >
         <div >
            <img src="imG/yeti.png" alt="Accordion Image">
         </div>
         <div >
            <div >FAQ</div>
            <ul >
               <li>
                  <div >
                     <span >What is the total supply?</span>
                     <i ></i>
                  </div>
                  <p>A total of 9999 unique Sweti Yeti's will be created.</p>
                  <span ></span>
               </li>
               <li>
                  <div >
                     <span >How Whitelist?</span>
                     <i ></i>
                  </div>
                  <p>Participate in our Discord Community is a supportive and consistent way.</p>
                  <span ></span>
               </li>
               <li>
                  <div >
                     <span >Wen mint/presale?</span>
                     <i ></i>
                  </div>
                  <p>Pre-pre Jan 22nd, Pre Feb 12, Full Feb 14</p>
                  <span ></span>
               </li>
               <li>
                  <div >
                     <span >What is SWETI?</span>
                     <i ></i>
                  </div>
                  <p>Share With Everyone To Inspire. Our goal is to make it easier for guys like us, who have big visions but little support in execution. Also relates to kid charity shtuff.</p>
                  <span ></span>
               </li>
               <li>
                  <div >
                     <span >IMX or whatever chain stuff</span>
                     <i ></i>
                  </div>
                  <p>bleh</p>
                  <span ></span>
               </li>
               <li>
                  <div >
                     <span > How to bother you?</span>
                     <i ></i>
                  </div>
                  <p>Insert contact info</p>
                  <span ></span>
               </li>
            </ul>
         </div>
      </div>
      </div >
      <script type="text/javascript">
         let moon = document.getElementById('moon');
         let stars = document.getElementById('stars');
         let mountains_behind = document.getElementById('mountains_behind');
         let mountains_front = document.getElementById('mountains_front');
         let text = document.getElementById('text');
         let btn = document.getElementById('btn');
         let header = document.querySelector('header');
         window.addEventListener('scroll', function() {
           var value = window.scrollY;
           moon.style.top = -value * -1.05   'px';
           stars.style.left = value * 0.25   'px';
           mountains_behind.style.top =-value * -0.5   'px';
           header.style.top =-value * -0.5   'px';
           mountains_front.style.top =-value * 0   'px';
           text.style.marginTop = value * 1.5   'px';
           btn.style.marginTop = value * 1.5   'px';
           text.style.marginRight = value * 4   'px';
         });
      </script>
      <script>
         let li = document.querySelectorAll(".faq-text li");
         for (var i = 0; i < li.length; i  ) {
           li[i].addEventListener("click", (e)=>{
             let clickedLi;
             if(e.target.classList.contains("question-arrow")){
               clickedLi = e.target.parentElement;
             }else{
               clickedLi = e.target.parentElement.parentElement;
             }
            clickedLi.classList.toggle("showAnswer");
           });
         }
      </script>

CSS

@import url("https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800,900&display=swap");
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
  scroll-behavior: smooth;
}
body {
  background: linear-gradient(#2b1055, #7597de);
}
section {
  position: relative;
  width: 100%;
  height: 100vh;
  padding: 100px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}
header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 30px 100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
}
header .logo {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  font-size: 2em;
  text-transform: uppercase;
  letter-spacing: 2px;
}
header ul {
  display: flex;
  justify-content: center;
  align-items: center;
}
header ul li {
  list-style: none;
  margin-left: 20px;
}
header ul li a {
  text-decoration: none;
  padding: 6px 15px;
  color: #fff;
  border-radius: 20px;
}
header ul li a.active,
header ul li a:hover {
  background: #fff;
  color: #2b1055;
}
section:before {
  content: "";
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100px;
  background: linear-gradient(to top, #1c0522, transparent);
  z-index: 1000;
}
section img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
section img#moon {
  mix-blend-mode: screen;
}
section img#mountains_front {
  z-index: 10;
}
h2#text {
  position: absolute;
  color: #fff;
  right: -350px;
  white-space: nowrap;
  font-size: 7.5vw;
  transform: translateY(0px);
}
#btn {
  text-decoration: none;
  padding: 8px 30px;
  border-radius: 40px;
  background: #fff;
  color: #2b1055;
  transform: translateY(100px);
  font-size: 1.5em;
  z-index: 9;
}
.sec {
  position: relative;
  min-height: 500px;
  padding: 100px;
  background: #1c0522;
}
.sec h2 {
  font-size: 3.5em;
  margin-bottom: 10px;
  color: #fff;
  text-align: center;
}
.sec p {
  font-size: 1.2em;
  color: #fff;
}

::selection {
  background: #7d2ae8;
  color: #fff;
}
.accordion {
  display: flex;
  max-width: 1010px;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-radius: 25px;
  padding: 45px 90px 45px 60px;
  margin: 0 auto;
}
.accordion .image-box {
  height: 360px;
  width: 300px;
}
.accordion .image-box img {
  height: 100%;
  width: 100%;
  object-fit: contain;
}
.accordion .accordion-text {
  width: 60%;
}
.accordion .accordion-text .title {
  font-size: 35px;
  font-weight: 600;
  color: #7d2ae8;
  font-family: "Fira Sans", sans-serif;
}
.accordion .accordion-text .faq-text {
  margin-top: 25px;
  height: 263px;
  overflow-y: auto;
}
.faq-text::-webkit-scrollbar {
  display: none;
}
.accordion .accordion-text li {
  list-style: none;
  cursor: pointer;
}
.accordion-text li .question-arrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.accordion-text li .question-arrow .question {
  font-size: 18px;
  font-weight: 500;
  color: #595959;
  transition: all 0.3s ease;
}
.accordion-text li .question-arrow .arrow {
  font-size: 20px;
  color: #595959;
  transition: all 0.3s ease;
}
.accordion-text li.showAnswer .question-arrow .arrow {
  transform: rotate(-180deg);
}
.accordion-text li:hover .question-arrow .question,
.accordion-text li:hover .question-arrow .arrow {
  color: #7d2ae8;
}
.accordion-text li.showAnswer .question-arrow .question,
.accordion-text li.showAnswer .question-arrow .arrow {
  color: #7d2ae8;
}
.accordion-text li .line {
  display: block;
  height: 2px;
  width: 100%;
  margin: 10px 0;
  background: rgba(0, 0, 0, 0.1);
}
.accordion-text li p {
  width: 92%;
  font-size: 15px;
  font-weight: 500;
  color: #595959;
  display: none;
}
.accordion-text li.showAnswer p {
  display: block;
}

@media (max-width: 994px) {
  body {
    padding: 40px 20px;
  }
  .accordion {
    max-width: 100%;
    padding: 45px 60px 45px 60px;
  }
  .accordion .image-box {
    height: 360px;
    width: 220px;
  }
  .accordion .accordion-text {
    width: 63%;
  }
}
@media (max-width: 820px) {
  .accordion {
    flex-direction: column;
  }
  .accordion .image-box {
    height: 360px;
    width: 300px;
    background: #ffffff;
    width: 100%;
    border-radius: 25px;
    padding: 30px;
  }
  .accordion .accordion-text {
    width: 100%;
    margin-top: 30px;
  }
}
@media (max-width: 538px) {
  .accordion {
    padding: 25px;
  }
  .accordion-text li p {
    width: 98%;
  }
}

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@300;500&display=swap");
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  font-family: "Montserrat";
}
.container {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 0;
  background-color: #1c0522;
}
.timeline {
  width: 80%;
  height: auto;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.timeline ul {
  list-style: none;
}
.timeline ul li {
  padding: 20px;
  background-color: #655ee1;
  color: white;
  border-radius: 10px;
  margin-bottom: 20px;
}
.timeline ul li:last-child {
  margin-bottom: 0;
}
.timeline-content h1 {
  font-weight: 500;
  font-size: 25px;
  line-height: 30px;
  margin-bottom: 10px;
}
.timeline-content p {
  font-size: 16px;
  line-height: 30px;
  font-weight: 300;
}
.timeline-content .date {
  font-size: 12px;
  font-weight: 300;
  margin-bottom: 10px;
  letter-spacing: 2px;
}
@media only screen and (min-width: 768px) {
  .timeline:before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background-color: gray;
  }
  .timeline ul li {
    width: 50%;
    position: relative;
    margin-bottom: 50px;
  }
  .timeline ul li:nth-child(odd) {
    float: left;
    clear: right;
    transform: translateX(-30px);
    border-radius: 20px 0px 20px 20px;
  }
  .timeline ul li:nth-child(even) {
    float: right;
    clear: left;
    transform: translateX(30px);
    border-radius: 0px 20px 20px 20px;
  }
  .timeline ul li::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background-color: gray;
    top: 0px;
  }
  .timeline ul li:nth-child(odd)::before {
    transform: translate(50%, -50%);
    right: -30px;
  }
  .timeline ul li:nth-child(even)::before {
    transform: translate(-50%, -50%);
    left: -30px;
  }
  .timeline-content .date {
    position: absolute;
    top: -30px;
  }
  .timeline ul li:hover::before {
    background-color: aqua;
  }
}

Thanks in advance for any and all help.

CodePudding user response:

Try adding to the header .logoclass

float:left;
margin-top:0;

I copied your code and added a small image I had that is only about 75x39 pixels respectively and it shows even with your menu and about 2" in on my monitor. It's not dead left on my laptop monitor but it should be in the ball park. I add a a bigger image 246x205 and it looks okay.

One thing I noticed when I copied your html and css down, I can't see your entire page. You man need some other modifications. The Mint Now is centered.

CodePudding user response:

  header .logo {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  font-size: 2em;
  text-transform: uppercase;
  letter-spacing: 2px;
  float:left;
  margin-top:0;
 position:fixed;
}

Note: I also added a position-fixed at the bottom. This will scroll your logo with the page. If you don't want to do that with your page, just remove the position tag.

If your logo still goes to the center, you may have something else conflicting with the positioning. I just used these two files you posted here.

 <header>
     <A href="#" ><img src="sam.jpg"></A>
  • Related