troubleshooting Question

CSS DIV web page positioning

Avatar of Joshua Davis
Joshua Davis asked on
CSSHTML
6 Comments1 Solution131 ViewsLast Modified:
Hi Everyone,

I am currently working on a small web page challenge as a test for a junior web developer.

I am to build a basic web page (based on the attached mock up). I understand the concept, however it has been along time since i have written in CSS\HTML and last time i did it was common practice to use tables for positioning. I have since learnt that this is no longer correct and I am struggling to get 2 of my components to line up.



The section is an image gallery, which I have already got working and fully interactive, however i cannot get the main image and the sample images to line up as required.

Below is the code I have written, if anyone could help me with the positioning it would be greatly appreciated. (Also if there is anything in there that is bad practice please flag it up)

Thank you,
Josh

<!doctype html>
<html class="no-js" lang="">
    <html>
    <head>
    <link rel="stylesheet"
                href="https://fonts.googleapis.com/css?family=Merriweather">
    <link rel="stylesheet"
                href="https://fonts.googleapis.com/css?family=Baskerville">
    </head>
    </html>

    <body>
<!--[if lte IE 9]>
    <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
  <![endif]--> 

<!-- Add your site or application content here --> 
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>

.content {
    max-width: 600;
    margin: auto;
    background: white;
    padding: 10px;
}

  .topnav {
    overflow: hidden;
    background-color: #ffffff;
  }
  
  .topnav a {
    float: left;
    color: #000000;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-family: Merriweather;
	font-size:10px;
	max-width: 500px;
    margin: auto;
  }
  
  .topnav a:hover {
    background-color: #ddd;
    color: black;
  }
  
  .topnav a.active {
    background-color: #ddd;
    color: black;
  }
  
  .topnav-right {
    float: right;
  }



  
  code {
  background: #ddd;
  border-radius: 6px;
  color: #000000;
  display: block;
  font: 14px/24px "Source Code Pro", Inconsolata, "Lucida Console", Terminal, "Courier New", Courier;
  padding: 24px 15px;
  text-align: center;
}



header,
section,
aside,
footer {
  margin: 0 1.5% 24px 1.5%;
}
section {
    /*float: left;*/
    display: inline-block;
  width: 63%;
}
aside {
  /*float: right;*/
  display: inline-block;
  width: 30%;
}
footer {
  clear: both;
  margin-bottom: 0;
}




.content {
    max-width: 1000px;
    margin: auto;
    background: white;
    padding: 10px;
}
.container {
  position: relative;
}

/* Hide the images by default */
.mySlides {
  display: none;
}
 

.row:after {
  content: "";
  display: table;
  clear: both;
}





.sampleimages {
  float: down;
  width: 25%;
}

.activesample,
.demo:hover {
border: 3px solid #FAEA20; 
} 

.square{
    width: 600px;
    height: 700px;
    padding-top: 30px;
    padding-left: 50px;
    Background-color: #FAEA20;
}



  </style>
<div class="content">
      <header>
    <div class="topnav"> <a class="active" href="#home">Home</a> <a href="#men">Men</a> <a href="#women">Women</a> <a href="#Style_Accessories">Style & Accessories</a> <a  href="#logo_home"><img src="Images/Logo.png" width="57" height="57" alt="Logo"></a>
          <div class="topnav-right"> <a href="#myaccount">My Account</a> <a href="#saveditems">Saved Items</a> <a href="#mybasket"><img src="Images/BasketImage.png" width="69" height="57" alt="Basket"></a> </div>
        </div>
  </header>
      <section>
    <div class="mySlides">
          <div class="square"> <img src="Images/Prod1_1.png" style="width:120%;"> </div>
        </div>
    <div class="mySlides">
          <div class="square"> <img src="Images/Prod1_2.png" style="width:120%"> </div>
        </div>
    <div class="mySlides">
          <div class="square"> <img src="Images/Prod1_3.png" style="width:120%"> </div>
        </div>
    <div class="mySlides">
          <div class="square"> <img src="Images/Prod1_4.png" style="width:120%;"> </div>
        </div>
    <div class="mySlides">
          <div class="square"> <img src="Images/Prod1_5.png" style="width:120%"> </div>
        </div>
    <div class="mySlides">
          <div class="square"> <img src="Images/Prod1_6.png" style="width:120%"> </div>
        </div>
  </section>
      <aside>
    <div class="sampleimages"> <img class="demo cursor" src="Images/Prod1_1.png" style="width:100%" onclick="currentSlide(1)" > </div>
    <div class="sampleimages"> <img class="demo cursor" src="Images/Prod1_2.png" style="width:100%" onclick="currentSlide(2)" > </div>
    <div class="sampleimages"> <img class="demo cursor" src="Images/Prod1_3.png" style="width:100%" onclick="currentSlide(3)" > </div>
    <div class="sampleimages"> <img class="demo cursor" src="Images/Prod1_4.png" style="width:100%" onclick="currentSlide(4)" > </div>
    <div class="sampleimages"> <img class="demo cursor" src="Images/Prod1_5.png" style="width:100%" onclick="currentSlide(5)" > </div>
    <div class="sampleimages"> <img class="demo cursor" src="Images/Prod1_6.png" style="width:100%" onclick="currentSlide(6)" > </div>
  </aside>
      <footer> <code>&#60;footer&#62;</code> </footer>
    </div>
</body>
    </html><script>

    var slideIndex = 1;
    showSlides(slideIndex);
    
    function currentSlide(n) {
      showSlides(slideIndex = n);
    }
    
    function showSlides(n) {
      var i;
      var slides = document.getElementsByClassName("mySlides");
      var dots = document.getElementsByClassName("sampleimages");
      if (n > slides.length) {slideIndex = 1}
      if (n < 1) {slideIndex = slides.length}
      for (i = 0; i < slides.length; i++) {
          slides[i].style.display = "none";
      }
      for (i = 0; i < dots.length; i++) {
          dots[i].className = dots[i].className.replace(" activesample", "");
      }
      slides[slideIndex-1].style.display = "block";
      dots[slideIndex-1].className += " activesample";
      captionText.innerHTML = dots[slideIndex-1].alt;
    }
    </script>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros