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

Website glitch encountered on Flash when using Firefox and IE9, though surprisingly functions perfectly on IE6!

My website isn't functioning properly on Firefox versions 4 and 7. Nothing is appearing, not even the alternative content. In IE9, the issue is that the content is condensed at the top of the page... although it works fine on IE6! Here is the HTML c ...

the styling gets disrupted by the addition of grid columns

Looking for help with aligning and spacing three sets of strings in a single line while maintaining grid columns intact, even when window size is reduced. Currently experiencing alignment issues like this: https://i.stack.imgur.com/iqlam.png Tried removi ...

Experiencing difficulties with setting the width of owl carousel

Here is the HTML code snippet: <div class="row"> <div class="col-lg-7 col-sm-6"> <div class="owl-carousel" id="homeCarousel"> <div class="item"> <img src="images/brela.jpg" alt="brela makarska"> </d ...

Can an input element be used to showcase a chosen image on the screen?

I would like to display the selected image from an input element. Can this be done with a local file, accessing the image on the client side, or do I need to upload it to a server? Here is my React code attempt: I can retrieve the correct file name from t ...

Can you identify the programming language used in this code snippet? - {"html":"<section class="page">

I've been approached to assist with a friend's company website since the original developer seems to have disappeared. Apologies if this question is too basic for this forum, and please forgive me if I am not in the right place to ask it. The m ...

Column-count can result in the flex div dividing the element into two parts

Whenever I utilize column-count with nested divs that have display: flex set, I encounter a problem where elements are cut in half. The suggestion from this answer is to use display: inline-block to prevent this issue. However, when I implement that soluti ...

Understanding the structure of html elements

Within my downloaded HTML files, I consistently have key executives mentioned at the beginning of each file (like "Dror Ben Asher" in the code snippet below): <DIV id=article_participants class="content_part hid"> <P>Redhill Biopharma Ltd. (NA ...

Navigate back to the previous page upon form submission to a PHP file, with a div dynamically populated with targeted content

I'm facing a logic dilemma: I have a webpage with a div called #content, where I've embedded another page containing a form for submitting data* (there are other pages loaded into #content as well, but they are not active at the same time, one o ...

Zoom in and Zoom out functions in ngPdf with centered view

I have incorporated the pdf canvas to showcase PDFs on my AngularJS/Bootstrap application, and I must say, the preview feature is working exceptionally well. However, one thing that I would like to achieve is centering either my modal or the canvas itself ...

What could be causing my page width to only expand to 100% when using "fit-content"?

After searching extensively, I'm unable to find a solution that fits my current issue. My goal is to construct a practice ecommerce website using React. One of the components I have is a header which I'd like to occupy 100% of the screen width, c ...

What could be causing the extra space at the top of my div element?

My goal is to accomplish the following: However, there appears to be an unnecessary gap above the Social icons div. You can view the live page at This is my current markup:- <header> <img src="images/home-layout_02.jpg" alt="Salem Al Hajri Logo ...

Differences between Next.js Image and regular img tag regarding image quality

I am currently using Next.js and have noticed that my images appear slightly blurry when utilizing Next/Image. Below is a snippet of my code: <img src={url} width={articleWidth} /> <Image className="text-center" src={url} ...

Revamp the md-select Container

Hello there! I'm looking for a stylish way to revamp the design of the md-select Window. Specifically, I aim to customize the background and hover effects. Despite my attempts to modify the .md-select-menu-container in CSS, it proved unsuccessful. I ...

Utilizing the .fadeToggle() function to create a fading effect for text, which fades in and out

I am on the verge of achieving my goal, but I could use a little more assistance with this. $('.change').hover(function() { $(this).fadeToggle('slow', 'linear', function() { $(this).text('wanna be CodeNinja' ...

Choosing a specific column in an HTML table using jQuery based on the text within it

I have a table with a similar structure as shown below: <table> <c:forEach ...> <tr> <td>test</td> // this is the initial value <td>random value</td> <td>random value</td&g ...

Passing both the event and a local Vue variable to a bound function in a idiomatic manner

I had been grappling with the problem of accessing both a v-for member and the original event data within a bound function on an event in vue.js. Despite my efforts, I couldn't seem to find a solution in the documentation. Here is what I was aiming f ...

Blog entries alternating between a pair of distinct hues

I want to create a design where each post container has a different color from the one next to it. Essentially, I would like the containers to alternate between two distinct colors. The left side shows how it currently appears, while the right side depict ...

The dropdown menu is not able to retrieve information from the secondary database

I have been encountering multiple challenges while working on a web-based dynamic form that I am developing. My current major issue is with populating the second #bodytype dropdown based on the selection made in the first, #bodyman, dropdown. Subsequently ...

Using a diverse class for enhancing the PrimeVue dialog's maximizable feature

I'm currently working with the PrimeVue Dialog component. My goal now is to apply different styles depending on whether the dialog is maximized or not. Let's keep it simple by saying I want to change the text to bold or red when the dialog is max ...

Running a series of functions consecutively with JQUERY

Currently, I am facing an issue with using an ajax method .load to replace the content of a div. The library I am working with does not allow me to replace the content of a div as some functions continue to run in the background. To overcome this challeng ...