Embedding a picture logo within a CSS-designed content box

I am trying to create a unique layout for my website that reveals content using labelled radio buttons, without the use of scripts.

Instead of using <a href='#'>, I want to achieve a specific layout like the one shown in this example. When using the hash link method, pressing tabs leaves a hash at the end of the URL and causes issues when navigating back through the browser history.

How can I make the tab 'Logo' appear centered above 'Tab 1', 'Tab 2', and 'Tab 3'? Clicking on it should trigger the appearance of the first content box (tab 0) while maintaining the transitions and styles of the overlaying content boxes (<divs>). Any attempt I've made so far has disrupted the layout.

Thank you in advance!

html {
    background-color: #444;
    text-align: center;
    width: 100%;
    height: 100%;
}
body {
    color: #fff;
    font: 16px'Open Sans', Helvetica, sans-serif;
    line-height: 26px;
}
.tabs input[type=radio] {
    display:none;
}
.tabs {
    padding: 0px;
}
.tabs li {
    display: inline-block;
}
.tabs label {
    color: #8C8C8C;
    display: block;
    padding: 10px 10px;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0px 4px 8px rgba(0, 0, 0, 0.65), 4px 0px 8px rgba(0, 0, 0, 0.65), -4px 0px 8px rgba(0, 0, 0, 0.65), 0px -4px 8px rgba(0, 0, 0, 0.65);
    transition: all 0.55s ease;
    cursor: pointer;
    position: relative;
}
.tabs label:hover {
    color: white;
    text-shadow: 0px 4px 8px rgba(255, 255, 255, 0.65), 4px 0px 8px rgba(255, 255, 255, 0.65), -4px 0px 8px rgba(255, 255, 255, 0.65), 0px -4px 8px rgba(255, 255, 255, 0.65);
}
.tab-content {
    z-index: 2;
    opacity: 0;
    left: 0;
    width: 100%;
    min-height: 400px;
    padding: 15px;
    position: absolute;
    box-sizing: border-box;
    background:linear-gradient(transparent, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55), transparent);
    transition: all 0.8s ease;
}
[id^=tab]:checked + label {
    text-shadow: 0px 4px 8px rgba(255, 255, 255, 0.65), 4px 0px 8px rgba(255, 255, 255, 0.65), -4px 0px 8px rgba(255, 255, 255, 0.65), 0px -4px 8px rgba(255, 255, 255, 0.65);
    color: white;
    top: 0;
}
[id^=tab]:checked ~ [id^=tab-content] {
    opacity: 1;
}

@-webkit-keyframes fadeIn {
    from {
        opacity:0;
    }
    to {
        opacity:1;
    }
}
@-moz-keyframes fadeIn {
    from {
        opacity:0;
    }
    to {
        opacity:1;
    }
}
@keyframes fadeIn {
    from {
        opacity:0;
    }
    to {
        opacity:1;
    }
}
.fade-in {
    opacity:0;
    -webkit-animation:fadeIn ease-in 1;
    -moz-animation:fadeIn ease-in 1;
    animation:fadeIn ease-in 1;
    -webkit-animation-fill-mode:forwards;
    -moz-animation-fill-mode:forwards;
    animation-fill-mode:forwards;
    -webkit-animation-duration:1s;
    -moz-animation-duration:1s;
    animation-duration:1s;
}
.fade-in.zero {
    -webkit-animation-delay: .2s;
    -moz-animation-delay: .2s;
    animation-delay: .2s;
}
.fade-in.one {
    -webkit-animation-delay: .6s;
    -moz-animation-delay: .6s;
    animation-delay: .6s;
}
.fade-in.two {
    -webkit-animation-delay: .9s;
    -moz-animation-delay: .9s;
    animation-delay: .9s;
}

.fade-in.three {
    -webkit-animation-delay: 1.2s;
    -moz-animation-delay: 1.2s;
    animation-delay: 1.2s;
}
<ul class="tabs">
    <li>
        <input type="radio" name="tabs" id="tab0" checked>
        <label for="tab0" class="fade-in zero">Logo</label>
        <div id="tab-content0" class="tab-content">
            <p>Welcome to this page!</p>
        </div>
    </li>
    <li>
        <input type="radio" name="tabs" id="tab1">
        <label for="tab1" class="fade-in one">Tab 1</label>
        <div id="tab-content1" class="tab-content">
            <p>Tab 1 contains images and links!</p>
        </div>
    </li>
    <li>
        <input type="radio" name="tabs" id="tab2">
        <label for="tab2" class="fade-in two">Tab 2</label>
        <div id="tab-content2" class="tab-content">
            <p>Tab 2 contains more images and links!</p>
        </div>
    </li>
    <li>
        <input type="radio" name="tabs" id="tab3">
        <label for="tab3" class="fade-in three">Tab 3</label>
        <div id="tab-content3" class="tab-content">
            <p>Tab 3 has even more images and links!</p>
        </div>
    </li>
</ul>

Fiddle Link

Answer №1

It appears that the solution to your problem may be as simple as placing the logo above the <ul>, considering it is a constant element in your design and does not necessarily have to be within one of the fade-in-animated tabs.

To further understand, you can refer to this fiddle: http://jsfiddle.net/polarbirke/uan89equ/1/

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Removing a session when the client has left

I wanted to simplify what I'm trying to achieve. Imagine two people have PHP sessions on a webpage. One person leaves the page while the other remains. After 60 seconds, the session of the person who left should be terminated automatically (like a ti ...

ToggleButtonGroup in Material UI is a great way to create toggle

I am trying to implement the ToggleButtonGroup feature from Material UI in my React application. I am facing an issue where I am unable to pass values into my state correctly. The code snippet provided below shows that while the Select component works fi ...

Returning draggable elements to their original placement

I'm looking to create a custom function that resets my draggable elements to their original positions when invoked. This is not related to the built-in revert functionality. $('.drag').draggable({ stack: ".drag", snap: ".dro ...

What could be causing my form not to Submit when attempting submission without utilizing the submit button?

Here is the code for my validation: $(function () { function validateForm() { // Code to validate form inputs } $('#myform').submit(validateForm); }); After this, I want to submit the form when a certain action occurs: < ...

The hamburger menu icon is not visible

I recently built a website and aimed to ensure it had a responsive design. Following a tutorial on YouTube, I implemented everything exactly as shown in the video. However, I encountered an issue with the hamburger icon not appearing. Can anyone shed som ...

Div with hidden scrollbars for smooth scrolling experience

Is there a way to create scrollable DIV's without visible scrollbars? While Mac OS 10.7-8 display no visible scrolls, other operating systems like Windows, Mac OS, and Linux show the scrollbars. How can I achieve scrollable divs without the scrollbars ...

Obtain the Class Name Value by Utilizing the "Begins With" Selection Method

Consider the following HTML structure: <a href="#" class="a b nl-3522">First</a> <a href="#" class="a b nl-7352">Second</a> <a href="#" class="a b nl-4874">Third</a> <!-- Note that classes nl-* are being added dynami ...

Move the grid items to their new positions with animation

I have a group of floating elements, all the same size and arranged within a grid layout. I am now adding a new element using jQuery's .after() method, which is larger in size and spans the entire width of the container, necessitating its own row. T ...

The navigation bar fails to display correctly on Internet Explorer 10

Encountering problems with IE 10. View the code here. While on the latest Chrome and Firefox, all text appears in a single line, IE displays it differently. Other modern browsers produce a different result altogether. ...

Utilize the atan2() function to rotate a div so that it follows the movement of the mouse

I am trying to create an effect where the mouse aligns with the top of a div and the div rotates as the mouse moves. The rotation should happen when the top part of the div is in line with the mouse cursor. My goal is to achieve this using the atan2 functi ...

Ways to determine if an element is the initial child

I am currently facing issues while attempting to make my bootstrap carousel dynamic and inject data properly. My aim is to locate the first child of the injected data and apply the "active" class to it. I am utilizing Laravel Blade for rendering my data. B ...

What is the correct way to apply styles universally instead of using "*" as a selector?

With Nextron, I was able to successfully run my code, but upon opening the window, I noticed that the body tag had a margin of 8px. Although I managed to change this using the dev tools, I am unsure how to permanently apply this change in my code. When att ...

Organize objects neatly in a grid formation

I have a .test div with grid-template-columns: auto auto auto;. The column width is set to vary based on the element width, and I also used justify-content: start; to align the columns to the left. I chose to use auto instead of 1fr to prevent the columns ...

Within the mobile view, a button with accompanying description will be discreetly concealed

Working on an ASP.NET Core MVC project, with a FAQ section in the view displayed as follows: <div class="container"> <div class="row "> <div class="col-xl-2 mx-auto d-none d-sm-block"> ...

Enhancing the functionality of localStorage

I am attempting to append a value to a key within the HTML5 localStorage. Take a look at my code below: var splice_string = []; splice_string += "Test value"; var original = JSON.parse(localStorage.getItem('product_1')); origina ...

aligning content that has exceeded the boundaries

I have a list of dynamically created <a> tags without text, to which I apply background images. These icons are displayed within a <div> container using the float: left; style. As the row of icons becomes too long, it overflows and starts a ne ...

Troubleshooting problem with aligning grid items at the center in React using

I've been facing a challenge in centering my elements group using the material ui grid system. Problem: There seems to be excess margin space on the extreme right. Code snippet: const renderProjects = projects.map(project => ( <Grid item ...

Is there a way to send a Python list to Django?

I'm in the process of setting up a website where I can retrieve a JSON list from my PRTG. Currently, I have successfully implemented code in the console that filters out sensors with a status of DOWN. However, I am facing difficulties in posting this ...

Send the image link as a parameter

I've been trying to pass an image link through two child components, but I'm having trouble. I added the link to the state and passed it down, but it doesn't work. Strangely, when I manually input the link in the child component, it works pe ...

embedding an Image onto a webpage without requiring a source

How can I incorporate an image into my HTML page and then send it via fax without using the "src" attribute? Any suggestions on converting the image to a byte array and embedding it in the html document? ...