Difference between revisions of "Team:Linkoping Sweden/Description"

Line 1: Line 1:
 
{{Linkoping_Sweden/Header}}
 
{{Linkoping_Sweden/Header}}
  
 +
<!DOCTYPE html>
 
<html>
 
<html>
 
 
<head>
 
<head>
 
<style>
 
<style>
 
body {margin:0;}
 
body {margin:0;}
  
.topnav {
+
/* Add a background color to the top navigation */
 +
.topnav, uses {
 
   overflow: hidden;
 
   overflow: hidden;
   background-color: #019966;
+
   background-color: #333;
 
}
 
}
  
 +
 +
/* Style the links inside the navigation bar, used my non-lists/non-buttons */
 
.topnav a {
 
.topnav a {
 
   float: left;
 
   float: left;
 
   display: block;
 
   display: block;
   color: white;
+
   color: #f2f2f2;
 
   text-align: center;
 
   text-align: center;
 
   padding: 14px 16px;
 
   padding: 14px 16px;
 
   text-decoration: none;
 
   text-decoration: none;
 
   font-size: 17px;
 
   font-size: 17px;
  font-weight: bold;
 
 
}
 
}
  
 +
/* Change the color of links on hover, uses */
 
.topnav a:hover {
 
.topnav a:hover {
   background-color: white;
+
   background-color: green;
   color: #019966;
+
   color: black;
  <!--border: 2px solid #019966;-->
+
 
}
 
}
  
 +
/* Hide the link that should open and close the topnav on small screens */
 
.topnav .icon {
 
.topnav .icon {
 
   display: none;
 
   display: none;
 
}
 
}
  
 +
/* When the screen is less than 600 pixels wide, hide all links, except for the first one ("Home"). Show the link that contains should open and close the topnav (.icon) */
 
@media screen and (max-width: 600px) {
 
@media screen and (max-width: 600px) {
 
   .topnav a:not(:first-child) {display: none;}
 
   .topnav a:not(:first-child) {display: none;}
Line 41: Line 45:
 
}
 
}
  
 +
/* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens (display the links vertically instead of horizontally) */
 
@media screen and (max-width: 600px) {
 
@media screen and (max-width: 600px) {
 
   .topnav.responsive {position: relative;}
 
   .topnav.responsive {position: relative;}
Line 56: Line 61:
 
}
 
}
  
<!-- CSS-kod för meny -->
+
/*Full container box, not used*/
 
+
.container {
ul
+
    overflow: hidden;
li {float: left;}  /*Where the menu is in the block */
+
    background-color: #333;
 
+
    font-family: Arial;
.dropbtn  {     /* The color, border and other stuff to form the box */
+
  background: #019966;
+
  border: 1px solid #019966;
+
  border-radius: 3px;
+
  color: white;
+
  display: inline-block;
+
  margin: 10px 10px;
+
  padding: 14px;
+
  text-decoration: none;
+
 
}
 
}
  
.dropbtn:hover:not(.active) {  /* color of the dropdown box and text when hovering*/
+
/*Text color for non-dropdown text, not used*/
    background-color: white;
+
.container a {
    color: #019966;
+
     float: left;
}
+
     font-size: 16px;
 
+
     color: white;
.active {         /*Color of the box that the user is on*/
+
     background-color: white;
+
     color: #019966;
+
}
+
 
+
 
+
.dropbtn .menu-content a {    /*Shape and size of the dropdown box*/
+
    display: inline-block;
+
     color: #019966;
+
 
     text-align: center;
 
     text-align: center;
 
     padding: 14px 16px;
 
     padding: 14px 16px;
Line 91: Line 78:
 
}
 
}
  
.dropbtn:hover, .dropmenu:hover .dropbtn {  /*Color of the mainbox when hovering*/
+
/* LIST */
     background-color: white;
+
/* The container <div> - needed to position the dropdown content, uses */
     color: #019966;
+
.dropdown {
 +
     float: left;
 +
     /*overflow: hidden;*/
 +
}
  
 +
/* Dropdown Button, uses */
 +
.dropdown .dropbtn {
 +
    font-size: 16px;   
 +
    border: none;
 +
    outline: none;
 +
    color: white;
 +
    padding: 14px 16px;
 +
    background-color: inherit; /*inherited from .topnav*/
 
}
 
}
  
.dropmenu {  /*Determine what type of attribute the box is*/
+
/* Background color when hovering, uses */
     display: block;
+
.container a:hover, .dropdown:hover .dropbtn {
 +
     background-color: blue;
 
}
 
}
  
.menu-content { /*The background of the dropdown box*/
+
/* Dropdown Content (Hidden by Default), uses */
 +
.dropdown-content {
 
     display: none;
 
     display: none;
 
     position: absolute;
 
     position: absolute;
     background-color: #019966;
+
     background-color: #f9f9f9;
 
     min-width: 160px;
 
     min-width: 160px;
 
     box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
 
     box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
 
+
    z-index: 1;
 
}
 
}
  
.menu-content a {  /*Color of the text in the dropdown box*/
+
/* Links inside the dropdown, uses */
     color: white;
+
.dropdown-content a {
 +
    float: none;
 +
     color: black;
 
     padding: 12px 16px;
 
     padding: 12px 16px;
 
     text-decoration: none;
 
     text-decoration: none;
 
     display: block;
 
     display: block;
     text-align: center;
+
     text-align: left;
 
}
 
}
  
.dropmenu:hover .menu-content {   /*Makes sure that the menu drops*/
+
/* Change color of dropdown links on hover, uses */
 +
.dropdown-content a:hover {
 +
    background-color: #ddd;
 +
}
 +
 
 +
/* Show the dropdown menu on hover */
 +
.dropdown:hover .dropdown-content {
 
     display: block;
 
     display: block;
}
 
 
.menu-content a:hover{
 
    background: white;
 
    color: #019966;
 
 
}
 
}
 
 
 
 
</style>
 
</style>
 
</head>
 
</head>
 
<body>
 
<body>
 
  
 
<div class="topnav" id="myTopnav">
 
<div class="topnav" id="myTopnav">
<ul>
+
   <a href="#home">Home</a>
   <li class="dropmenu">
+
  <a href="#news">News</a>
    <a href="#" class="dropbtn">The Project</a>
+
    <div class="menu-content">
+
      <a href="#">What</a>
+
      <a href="#">Why</a>
+
      <a href="#">How</a>
+
    </div>
+
  </li>
+
  
    <li class="dropmenu">
+
  <div class="dropdown">
     <a href="#" class="dropbtn">The team</a>
+
     <button class="dropbtn">DropdownX</button>
     <div class="menu-content">
+
     <div class="dropdown-content">
       <a href="#">About us</a>
+
       <a href="#">Link 1</a>
       <a href="#">Why</a>
+
       <a href="#">Link 2</a>
       <a href="#">How</a>
+
       <a href="#">Link 3</a>
 
     </div>
 
     </div>
   </li>
+
   </div>
 
    
 
    
    <li class="dropmenu">
 
    <a href="#" class="dropbtn">Modeling</a>
 
    <div class="menu-content">
 
      <a href="#">What</a>
 
      <a href="#">Why</a>
 
      <a href="#">How</a>
 
    </div>
 
  </li>
 
 
 
    <li class="dropmenu">
 
    <a href="#" class="dropbtn">Human Practice</a>
 
    <div class="menu-content">
 
      <a href="#">What we have done</a>
 
      <a href="#">Silver</a>
 
      <a href="#">Gold</a>
 
    </div>
 
  </li>
 
</ul>
 
 
 
   <a href="javascript:void(0);" style="font-size:15px;" class="icon" onclick="myFunction()">&#9776;</a>
 
   <a href="javascript:void(0);" style="font-size:15px;" class="icon" onclick="myFunction()">&#9776;</a>
 
 
</div>
 
</div>
  
Line 183: Line 155:
  
 
<script>
 
<script>
 +
/* Toggle between adding and removing the "responsive" class to topnav when the user clicks on the icon */
 
function myFunction() {
 
function myFunction() {
 
     var x = document.getElementById("myTopnav");
 
     var x = document.getElementById("myTopnav");
Line 192: Line 165:
 
}
 
}
 
</script>
 
</script>
</nav>
+
 
 
</body>
 
</body>
 +
</html>
  
  
Line 259: Line 233:
 
------------------------------------------------------------------------------- -->
 
------------------------------------------------------------------------------- -->
  
</html>
 
 
{{Linkoping_Sweden/Footer}}
 
{{Linkoping_Sweden/Footer}}

Revision as of 13:00, 19 June 2017

<!DOCTYPE html>

Responsive Topnav Example

Resize the browser window to see how it works.