Webpage featuring tabs aligned horizontally

Can anyone guide me on setting up horizontal tabs similar to the design in this image: https://i.sstatic.net/ewXO4.png?

Below is the code snippet:

<label class="formlabel">Title 1:</label>
<div id="radio_form">
    <label><input type="radio" value="1" name="status">Activated</label>
    <br>
    <label><input type="radio" value="0" name="status">Deactivated</label>
    <br><br>
</div>
<label class="formlabel">Title 2:</label>
<input name="input2" type="text" class="forminput" />
<label class="formlabel">Title 3:</label>
<input name="input3" type="text" class="forminput" />  

<input class="formsubmit" type="submit" name ='submit' value="Save">

I am looking to place title/input 3 on tab 2, is it possible through CSS by manipulating divs and styles?

If there's a solution incorporating jQuery or JavaScript, please feel free to share.

Any assistance will be greatly appreciated. Thank you in advance.

Answer №1

For complete details, please visit https://jqueryui.com/tabs/

<script>
  $(function() {
    $( "#tabs" ).tabs();
  });
</script>

<div id="tabs">
  <ul>
    <li><a href="#tabs-1">Lorem Ipsum</a></li>
    <li><a href="#tabs-2">Dolor Sit Amet</a></li>
    <li><a href="#tabs-3">Consectetur Adipiscing</a></li>
  </ul>
  <div id="tabs-1">
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquam turpis non dignissim accumsan. Vestibulum auctor ultricies nulla, in tristique mauris laoreet vel. Phasellus eget massa suscipit nisi rutrum mattis eu nec tortor.</p>
  </div>
  <div id="tabs-2">
    <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut volutpat varius libero at condimentum. Mauris ut interdum velit. Sed sit amet urna vitae mi rhoncus feugiat eget non sem.</p>
  </div>
  <div id="tabs-3">
    <p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin quis purus lectus. Donec commodo sapien nec placerat pulvinar. Pellentesque lobortis lorem sed nunc ullamcorper porttitor. Aenean consequat eleifend justo, eu hendrerit lectus vulputate vitae.</p>
    <p>Curabitur fringilla gravida bibendum. Fusce sagittis elementum risus. Aliquam erat volutpat. Integer pharetra metus id tincidunt molestie. Morbi tempus enim vel felis facilisis laoreet. Duis imperdiet, elit nec vestibulum pellentesque, justo neque blandit quam, varius cursus est lacus quis ex.</p>
  </div>
</div>

Answer №2

U have the option to utilize:

<div class="container">
  <h3>Tabs</h3>
  <ul class="nav nav-tabs">
    <li class="active"><a href="#">Home</a></li>
    <li><a href="#">Menu 1</a></li>
    <li><a href="#">Menu 2</a></li>
    <li><a href="#">Menu 3</a></li>
  </ul></div>

Answer №3

Implementing Jquery UI tabs can greatly enhance user experience on your website. It provides a straightforward method for organizing content and offers the flexibility to customize the appearance using either prebuilt styles or your own CSS.

Answer №4

You should definitely check out the MetroUI for a fresh experience.

For an example of its usage, take a look here!

<div class="tabcontrol" data-role="tabControl" data-open-target="#frame_3_2">
    <ul class="tabs">
        <li class="active"><a href="#frame_3_1">Tab 1</a>
        </li>
        <li class=""><a href="#frame_3_2">Tab 2</a>
        </li>
        <li class=""><a href="#frame_3_3">Tab 3</a>
        </li>
    </ul>
    <div class="frames bg-grayLight">
        <div class="frame" id="frame_3_1" style="display: block;">1</div>
        <div class="frame" id="frame_3_2" style="display: none;">2</div>
        <div class="frame" id="frame_3_3" style="display: none;">3</div>
    </div>
</div>

Answer №5

Please take a look at this example on JSFiddle: FIDDLE

Custom Tabs in HTML

<!--custom tab-->
<div class="tab"> <a target="1" class="active">HOME</a>
 <a target="2">PERSONAL</a>
 <a target="3">EDUCATIONAL</a>

</div>
<div class="details" id="link1">Home details goes here</div>
<div class="details" id="link2" style="display:none;">Personal details goes here</div>
<div class="details" id="link3" style="display:none;">Educational details goes here</div>

Jquery Code

$(".tab a").click(function () {
        $(".tab a").removeClass('active');
        $(this).addClass('active');
        $(".details").hide();
        var target = $(this).attr('target');
        $("#link" + target).show();
    });

Answer №6

Here is the solution I devised:

    $('#tabs li a').click(function() {
       $('#tabs li a').removeClass("selected_tab");
       $(this).addClass("selected_tab"); 
    });
#tabs {
    list-style:none;
    display:block;
    overflow:hidden;
    margin:0;
}

#tabs li {
    float:left;
    margin-right:0.5em;
    border: 1px solid black;
    border-bottom:0;
}

#tabs li a {
    display:block;
    padding:0.3em;
    color:#000;
    text-decoration:none;
    border-bottom: 1px solid #000;
}

.selected_tab {
    border-bottom: 1px solid #fff !important;
}

#tab_content {
    width:100%;
    border-top:1px solid #000;
    margin-top:-1px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul id="tabs">
    <li><a class="selected_tab" href="#tab1">Tab 1</a></li>
    <li><a href="#tab2">Tab 2</a></li>
</ul>
<div id="tab_content">asdsda</div>

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

A PHP drop-down menu maintains a fixed position

I have set up a database called pogoda with a city table containing columns for city and cityid. Using PHP, I am creating a dynamic list and submitting the chosen value into subsequent code. To ensure that the drop-down list has a default starting positio ...

What could be the reason for the counter not being incremented when the button is clicked

While attempting to increase the counter in my test, I encountered an issue where pressing the button did not change the value. I tried using both fireEvent from React testing library and React test utils, but the value remained at 10. My project is using ...

The webpage does not display the updated information from the controller after the Ajax call

Learning the ropes of MVC, I delved into creating a post method for showcasing fresh data post a datepicker selection in jquery. The jquery functionality is up and running smoothly, allowing me to iterate through the new data in the view. However, when i ...

What is the best way to initiate a local Node.js server specifically when launching a desktop Electron application?

I am looking to ensure that my node js server runs while my electron app is open. One method I have attempted is using the child_process module to execute a shell command as shown below: const {exec} = require('child_process') const startDBServ ...

Tips for transferring input field values through the href attribute in HTML?

How can I pass an integer value from a link to an input field's value? Imagine example.com is a webpage with one input field. I would like to achieve something like this: Click here 1 Click here 2 If the user clicks on click here 1, then ...

What causes Spyscroll to be impacted by Collapse in Bootstrap 5?

I'm utilizing bootstrap 5 as my CSS framework and currently working on a significant section. Therefore, I chose to structure it with one row containing four columns, hiding the others using Bootstrap's collapse feature. However, because this is ...

Utilize Google Chrome Developer Tools to interact with the "Follow" buttons on the webpage by clicking on them

https://i.stack.imgur.com/W32te.png Here is the script I am currently using: document.querySelectorAll('.components-button components-button-size-mini components-button-type-orange desktop components-button-inline').forEach(btn => btn.click() ...

Is it possible to send array data in a jQuery AJAX call using the GET method?

Is there a way to pass a JavaScript array as a parameter in an AJAX GET request? I am currently dealing with an API call and have a method that requires three parameters, with the third one being an array. ...

What if we started using PT as the standard unit for measuring fonts and element size?

Currently, I am in the process of creating a mobile app that will work across different platforms using jQueryMobile and PhoneGap. My initial focus is on developing for Android. When it comes to Android app development, it is recommended that developers u ...

Tips for creating multiple diagonal lines with CSS and HTML

Is there a way to create multiple diagonal lines within a rectangle using CSS and HTML from the start? I am interested in incorporating diagonal lines at the onset of the rectangle. Here is an example code that displays the rectangle: <div className={ ...

Customizing a toggle checkbox in Bootstrap 5: A guide to personalization

I am attempting to modify a toggle switch in Bootstrap 5.2. <!DOCTYPE html> <html lang="en> <head> <meta charset="UTF-8> <meta http-equiv="X-UA-Compatible" content="IE=edge> <meta name="viewport" content="wid ...

Preserve data across all pages using sessions

On my website, I have a pagination system where each page displays 10 data entries. Whenever a user clicks on the pagination buttons, it triggers a request to the database to fetch the corresponding records. Each data entry also includes a button that can ...

Arrange a cluster of CSS table cells onto a fresh line

Currently, I am exploring CSS properties to create the visual appearance of a table using two levels of DOM elements. The highest-level element wraps around its child elements, which are styled to resemble a flat list. For example: <div class="t"> ...

Jquery and prototype are at odds with each other

Currently utilizing prototype and jQuery in addition to implementing a slide with another plugin that also requires jQuery. I've attempted using jQuery.noConflict(), but unfortunately, it still isn't functioning properly. var $j = jQuery.noConf ...

Attempting to collapse the offcanvas menu in React Bootstrap by clicking on a link

Currently, I am utilizing a mix of React Bootstrap and React to develop a single-page application. In an attempt to make the Offcanvas menu close when clicking a link, I have experimented with various approaches. One method involved creating an inline scri ...

What is the default method for automatically disabling drop down fields?

I've created a script that will gray out a drop-down field if a prior selection wasn't made. Once the appropriate choice is selected, the grayed-out field will become active. My query is, how can I set the drop-down field to be initially grayed ...

Activate an action only upon closing the page

I am looking for a solution in my vue.js app to execute a function only when the user closes the application. I have tried registering an event listener for beforeunload, but it causes the function to also trigger on page reloads, which is not ideal. Is t ...

Using VBA and Selenium to access iframes within HTML with the #document tag

I am currently facing a challenge in accessing the HTML content within two iframes using Selenium Basic in VBA. Due to restrictions on our machines, we are unable to use IE and other tools like Python are not available to us. In the past, I was able to ac ...

Blurry font rendering occurs when an element is scaled using CSS

I want to add a scale animation to a bootstrap button, but the text appears blurry. I've tried all the solutions mentioned here. How can I resolve this issue? Below is the code snippet (text is slightly less blurry in the snippet compared to my pr ...

Tips for creating visually appealing tables in ReactJS

For my school project, I need to create a table using ReactJs. I have already created the table but it needs improvement in terms of design. However, I am unsure how to modify my code to achieve the desired look. I tried looking on YouTube for tutorials, b ...