CSS DIV web page positioning

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>

Open in new window

Joshua DavisIT TechnicianAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Here is a version using Bootstrap 4 and flex
<!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<title>Title</title>
<style>
.yellow-block {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 70%;
	background: yellow;
	z-index: -1;
}
.container {
	width: 800px;
	overflow: hidden;
}
.image-container {
	margin-top: 35px;
	margin-bottom: 35px;
}
</style>
</head>
<body>
<br>
<div class="container" style="position: relative">
	<div class="yellow-block"></div>
	<div class="image-container d-flex justify-content-end" style="z-index: 100">
		<div class="pr-5"><img src="t3391/main.jpg"></div>
		<div class="d-flex flex-column align-items-start justify-content-between">
			<div><img src="t3391/top.jpg"></div>
			<div><img src="t3391/second.jpg"></div>
			<div><img src="t3391/third.jpg"></div>
			<div><img src="t3391/fourth.jpg"></div>
			<div><img src="t3391/last.jpg"></div>
		</div>
</div>
</body>
</html>

Open in new window


Working sample here
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Joshua DavisIT TechnicianAuthor Commented:
Thanks for your help! It took a bit of playing around but I got it to work.
0
Julian HansenCommented:
You are welcome.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Joshua DavisIT TechnicianAuthor Commented:
Hi,

I have continued to work on this and its a bit further along, but i have come to a similar issue with positioning.
I am just trying to get my head round how the different positioning and flex methods work.

The section I am currently working on is the order form on the page. I have attached all of my code this time.Web-Challenge-Site---Copy.zip

If you could offer any advise it would be appreciated.

Thank you again,
Josh
0
Joshua DavisIT TechnicianAuthor Commented:
Hi,

I have continued to work on this and its a bit further along, but i have come to a similar issue with positioning.
I am just trying to get my head round how the different positioning and flex methods work.

The section I am currently working on is the order form on the page. I have attached all of my code this time.

If you could offer any advise it would be appreciated.

Thank you again,
Josh
0
Julian HansenCommented:
Best to open another question for this. Refer to this one and post the link to the new question here.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.