HTML – die besten Beiträge

Website?

Hallo

Ich habe direkt 2 Fragen:

  1. Wieso ist um diese Navbar ein weisser Balken?
  2. Wenn ich über die Links(in der Navbar) hovere wird nur ein kleiner Hintergrund helleres blau. Jedoch möchte ich das von der Höhe die ganze Navbar helleres Blau wird. Wie kann ich dass machen?

Bei Fragen melden. Vielen Dank im Voraus

Lg Luca

CSS:
body{
    font-family:sans-serif;
    font-size: 16px;
}


/* Navbar */
.topnav {
    background-color: #1E262D;
    overflow: hidden;
  }


/* Logo Navbar */
.logonav{
    width: 20%;
    height: 20%;
    min-width: 120px ;
    min-height: 91px;
}
  
  /* Links */
  .topnav a {
    float: right;
    display: block;
    color: #f2f2f2;
    text-align: center;
    padding: 16px;
    text-decoration: none;
    margin-top: 2%;
    margin-bottom: 2%;
  }


  /* Links Hover */
  .topnav a:hover {
    background-color: #2C3E50;
    background-size: 100%;
  }
  
  .topnav .icon {
    display: none;
  }


  /* Media Queries  */
@media screen and (max-width: 600px) {
    .topnav a:not(.child) {display: none;}
    .topnav a.icon {
      float: right;
      display: block;
      background-color: #1E262D;
      color: #ddd;
    }
  }
  
@media screen and (max-width: 600px) {
    .topnav.responsive {position: relative;}
    .topnav.responsive a.icon {
      position: absolute;
      right: 0;
      top: 0;
      background-color: #1E262D;
      color: #ddd;
    }
    .topnav.responsive a {
      float: none;
      display: block;
      text-align: left;
    }
  }








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


<!--Head-->
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Responsive</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <script src="java.js"></script>
  </head>
<body>


<div class="topnav" id="myTopnav">
  <!--<img src="logoblue.png" alt="logo" class="logonav">-->
  <a href="contact.html">Contact</a>
  <a href="portfolio.html">Portfolio</a>
  <a href="index.html" >About me</a>
  <a href="javascript:void(0);" class="icon" onclick="myFunction()">
    <i class="fa fa-bars"></i>
  </a>
</div>


  </body>
</html>
Computer, Internet, HTML, Webseite, Design, CSS

CSS 3D-Würfel: Wie kann ich die Rückseite so wie die anderen Würfelseiten bewegen lassen?

Ich habe einen 3D-Würfel per CSS erstellt und würde ihm nun gerne eine 3D-Animation beim Hovern verleihen.

An sich komme ich auf das richtige Ergebnis, aber irgendwie verstehe ich die Rotation der Rückseite nicht und würde gerne wissen, wie ich sie so wie die anderen Würfelseiten bewegen lasse und nicht über diese komische Seitwärtsbewegung. Beziehungsweise ich möchte wissen, weswegen es bei rotateX überhaupt eine Seitwärtsbewegung durchführt.

Hier der Code:

HTML:

<div class="scene">
  <div class="cube">
    <div class="cube__face cube__face--front"></div>
    <div class="cube__face cube__face--back">back</div>
    <div class="cube__face cube__face--right">right</div>
    <div class="cube__face cube__face--left">left</div>
    <div class="cube__face cube__face--top">top</div>
    <div class="cube__face cube__face--bottom">bottom</div>
  </div>
</div>

CSS:

.scene {
  width: 200px;
  height: 200px;
  border: 1px solid #CCC;
  margin: 80px;
  perspective: 400px;
  transition-duration: 1s
}

.cube {
  transition-duration: 1s;
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: translateZ(-100px);
}

.scene:hover .cube {
  transform: translateZ(-10px);
}

.cube__face {
  ;
  border: 3px solid black;
  position: absolute;
  width: 200px;
  height: 200px;
  color: white;
  font-size: 2.5em;
  transform: scale(2.5);
  text-align: center;
  font-weight: bold;
  line-height: 200px;
  transform: perspective(500px) translateZ(250px)
}

.cube__face--front {
  transition-duration: 1s;
  transform: rotateY(0deg) translateZ(100px);
  background: url(Gesichr.png) hsla(214, 100%, 46%, 0.7);
  opacity: 0.5;
  background-size: cover;
}

.cube__face--right {
  transition-duration: 1s;
  transform: rotateY(90deg) translateZ(100px);
  background: hsla(99, 100%, 36%, 0.7);
}

.cube__face--back {
  transition-duration: 1s;
  transform: rotateY(180deg) translateZ(100px);
  background: hsla(63, 99%, 59%,0.7)
}

.cube__face--left {
  transition-duration: 1s;
  transform: rotateY(-90deg) translateZ(100px);
  background: hsla(10, 100%, 50%, 0.7)
}

.cube__face--top {
  transition-duration: 1s;
  transform: rotateX(90deg) translateZ(100px);
  background: hsla(181, 100%, 67%,0.8)
}

.cube__face--bottom {
  transition-duration: 1s;
  transform: rotateX(-90deg) translateZ(100px);
  background: hsla(38, 100%, 52%,0.7)
}

.scene:hover .cube__face--front {
  transform: rotatex(-30deg) translateZ(100px);
}

.scene:hover .cube__face--right {
  transform: rotateY(90deg) translateZ(100px) rotatez(-30deg);
}

.scene:hover .cube__face--back  {
  transform: rotateY(0deg) rotateX(150deg) translateZ(100px) rotate(-180deg);
}

.scene:hover .cube__face--left {
  transform: rotateY(-90deg) translateZ(100px) rotatez(30deg);
}

.scene:hover .cube__face--top  {
  transform: rotateX(60deg) translateZ(100px);
}

.scene:hover .cube__face--bottom {
  transform: rotateX(-120deg) translateZ(100px);
}
Programm, HTML, 3D, programmieren, CSS, Code, Webdesign

Meistgelesene Beiträge zum Thema HTML