search
HomeWeb Front-endCSS TutorialDetailed implementation of CSS3 single-page switching navigation menu interface design

This is a single-page switching navigation menu interface design effect made using pure CSS3. In this page effect, a set of navigation buttons are arranged vertically on the left side of the page. When the navigation button is clicked, the corresponding page will slide out from the right side of the screen. The effect is very cool.

Detailed implementation of CSS3 single-page switching navigation menu interface design

Instructions

HTML structure

The HTML structure of the single-page switching navigation menu interface is as follows:

<p class="ct" id="t1">
  <p class="ct" id="t2">
    <p class="ct" id="t3">
      <p class="ct" id="t4">
         <p class="ct" id="t5">
          <ul id="menu">
            <a href="#t1"><li class="icon fa fa-bolt" id="uno"></li></a>
            <a href="#t2"><li class="icon fa fa-keyboard-o" id="dos"></li></a>
            <a href="#t3"><li class="icon fa fa-rocket" id="tres"></li></a>
            <a href="#t4"><li class="icon fa fa-dribbble" id="cuatro"></li></a>
            <a href="#t5"><li class="icon fa fa-plus-circle" id="cinco"></li></a>
          </ul>
          <p class="page" id="p1">
             <section class="icon fa fa-bolt"><span class="title">Bolt</span><span class="hint">...</section>
          </p>
          <p class="page" id="p2">
            <section class="icon fa fa-keyboard-o"><span class="title">Type</span></section>
          </p>
          <p class="page" id="p3">
            <section class="icon fa fa-rocket"><span class="title">Rocket</span></section>
          </p>
          <p class="page" id="p4">
            <section class="icon fa fa-dribbble">
              <span class="title">Dribbble</span>
              <p class="hint">
                Im ready to play, <span class="hint line-trough">invite me </span> find me   
              </p>
              <p class="hint">...</p>
            </section>
          </p>
          <p class="page" id="p5">
            <section class="icon fa fa-plus-circle">
              <span class="title">More</span>
              <p class="hint">
                ...   
              </p>
            </section>
          </p>
        </p>
      </p>
    </p>
  </p>
</p>

CSS Style

The single-page switching navigation menu interface uses transform and transition to create page switching animation effects. And use the :target pseudo-element to complete the page switching when the button is clicked. The complete CSS code is as follows. The browser manufacturer's prefix is ​​not added to the code.

html, body, .page {   
  width: 100%;   
  height: 100%;   
  margin: 0;   
  padding: 0;   
  transition: all .6s cubic-bezier(.5, .2, .2, 1.1);   
  color: #fff;   
  overflow: hidden;    
}   

* {   
  font-family: &#39;open sans&#39;, &#39;lato&#39;, &#39;helvetica&#39;, sans-serif;   
}   

.page {   
  position: absolute;   
}   

#p1 {   
  left: 0;   
}   

#p2, #p3, #p4, #p5 {   
  left: 200%;   
}   

#p1 { background: darkslateblue; }   
#p2 { background: tomato; }   
#p3 { background: gold; }   
#p4 { background: deeppink; }   
#p5 { background: #9b59b6; }   

#t2:target #p2,   
#t3:target #p3,   
#t4:target #p4,   
#t5:target #p5 {   
  transform: translateX(-190%);   
  transition-delay: .4s !important;   
}   

#t2:target #p1,    
#t3:target #p1,   
#t4:target #p1,   
#t5:target #p1{   
  background: black;   
}   

#t2:target #p1 .icon,    
#t3:target #p1 .icon,   
#t4:target #p1 .icon,   
#t5:target #p1 .icon {   
  -webkit-filter: blur(3px);   
  filter: blur(3px);   
}   

.icon {   
  color: #fff;   
  font-size: 32px;   
  display: block;   
}   

ul .icon:hover {   
  opacity: 0.5;   
}   

.page .icon .title {   
  line-height: 2;   
}   

#t2:target ul .icon,   
#t3:target ul .icon,   
#t4:target ul .icon,   
#t5:target ul .icon{   
  transform: scale(.6);   
  transition-delay: .25s;   
}   

#t2:target #dos,   
#t3:target #tres,   
#t4:target #cuatro,   
#t4:target #cinco {   
  transform: scale(1.2) !important;   
}   

ul {   
  position: fixed;   
  z-index: 1;   
  top: 0;   
  bottombottom: 0;   
  left: 0;   
  margin: auto;   
  height: 280px;   
  width: 10%;   
  padding: 0;   
  text-align: center;   
 }   

#menu .icon {   
  margin: 30px 0;   
  transition: all .5s ease-out !important;   
}   

a {   
  text-decoration: none;   
}   

.title, .hint {   
  display: block;   
}   

.title {   
  font-size: 38px;   
}   

.hint {   
  font-size: 13px;   
}   

#p4 .hint {   
  display: inherit !important;   
}   

.hint a {   
  color: yellow;   
  transition: all 250ms ease-out;   
}   

.hint a:hover {   
  color: #FFF;   
}   

.line-trough {   
  text-decoration: line-through;   
}   

.page .icon {   
  position: absolute;   
  top: 0;   
  bottombottom: 0;   
  rightright: 10%;   
  left: 0;   
  width: 270px;   
  height: 170px;   
  margin: auto;   
  text-align: center;   
  font-size: 80px;   
  line-height: 1.3;   
  transform: translateX(360%);   
  transition: all .5s cubic-bezier(.25, 1, .5, 1.25);   
}   

.page#p1 .icon {   
  height: 220px;   
}   

.page#p1 .icon {   
  transform: translateX(10%) !important;   
}   

#t2:target .page#p2 .icon,   
#t3:target .page#p3 .icon,   
#t4:target .page#p4 .icon,   
#t5:target .page#p5 .icon {   
  transform: translateX(0) !important;   
  transition-delay: 1s;   
}


The above simple implementation of pure CSS3 single-page switching navigation menu interface design is all the content shared by the editor. I hope it can To give you a reference, I also hope that everyone will support the PHP Chinese website.

For more detailed implementation of CSS3 single-page switching navigation menu interface design and related articles, please pay attention to the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Weekly Platform News: Web Apps in Galaxy Store, Tappable Stories, CSS SubgridWeekly Platform News: Web Apps in Galaxy Store, Tappable Stories, CSS SubgridApr 14, 2025 am 11:20 AM

In this week's roundup: Firefox gains locksmith-like powers, Samsung's Galaxy Store starts supporting Progressive Web Apps, CSS Subgrid is shipping in Firefox

Weekly Platform News: Internet Explorer Mode, Speed Report in Search Console, Restricting Notification PromptsWeekly Platform News: Internet Explorer Mode, Speed Report in Search Console, Restricting Notification PromptsApr 14, 2025 am 11:15 AM

In this week's roundup: Internet Explorer finds its way into Edge, Google Search Console touts a new speed report, and Firefox gives Facebook's notification

The Power (and Fun) of Scope with CSS Custom PropertiesThe Power (and Fun) of Scope with CSS Custom PropertiesApr 14, 2025 am 11:11 AM

You’re probably already at least a little familiar with CSS variables. If not, here’s a two-second overview: they are really called custom properties, you set

We Are ProgrammersWe Are ProgrammersApr 14, 2025 am 11:04 AM

Building websites is programming. Writing HTML and CSS is programming. I am a programmer, and if you're here, reading CSS-Tricks, chances are you're a

How Do You Remove Unused CSS From a Site?How Do You Remove Unused CSS From a Site?Apr 14, 2025 am 10:59 AM

Here's what I'd like you to know upfront: this is a hard problem. If you've landed here because you're hoping to be pointed at a tool you can run that tells

An Introduction to the Picture-in-Picture Web APIAn Introduction to the Picture-in-Picture Web APIApr 14, 2025 am 10:57 AM

Picture-in-Picture made its first appearance on the web in the Safari browser with the release of macOS Sierra in 2016. It made it possible for a user to pop

Ways to Organize and Prepare Images for a Blur-Up Effect Using GatsbyWays to Organize and Prepare Images for a Blur-Up Effect Using GatsbyApr 14, 2025 am 10:56 AM

Gatsby does a great job processing and handling images. For example, it helps you save time with image optimization because you don’t have to manually

Oh Hey, Padding Percentage is Based on the Parent Element's WidthOh Hey, Padding Percentage is Based on the Parent Element's WidthApr 14, 2025 am 10:55 AM

I learned something about percentage-based (%) padding today that I had totally wrong in my head! I always thought that percentage padding was based on the

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software