Moving the vertical tab panel container div to the center of the main div for Easytabs - adjusting size and positioning

Hey there:

I've been experimenting with the "easytabs" jQuery plugin to create vertical tabs positioned along the right edge of the main div containing all the content of my web page.

My CSS skills are lacking. Although I've made good progress, I'm currently stuck on the final step towards achieving my desired outcome.

For the past few hours, I've been trying to adjust the position and size of the panel-container div that houses the vertical tab content divs - div1/div2/div3/div4, but so far I haven't been successful.

I'm hoping to get some assistance from experienced individuals on this platform to help me identify what I might be missing.

My goal is to have the panel-container div centered on the page. However, whenever I try to specify a width for the panel-container div in pixels, it results in the vertical tabs becoming disarranged.

Additionally, I would appreciate guidance on optimizing the text orientation and transform properties for the vertical tabs defined in the CSS. Adjusting the location of the vertical tabs has been a trial-and-error process for me, but I believe there must be a more efficient method

The vertical tab strip appears to have a 2-pixel offset to the left in Firefox, while it displays correctly in Microsoft Edge. Any suggestions on how to resolve this issue?


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <link rel="stylesheet" type="text/css" href="./easytabs-vert.css" media="all">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
    <script src="../jspkg-archive/vendor/jquery.hashchange.min.js" type="text/javascript"></script>
    <script src="../jspkg-archive/lib/jquery.easytabs.js" type="text/javascript"></script>
    
    <script type="text/javascript">
        $(document).ready(function(){ 
            $('#tab-container').easytabs(); 
        });
    </script>

</head>

<body >
    <div style="width:1320px; height:928px; margin: 0 auto; border: 1px solid green">

        <div id="tab-container" class="tab-container" style="float:right; left:1321px">  

            <ul id="vertitab" class='etabs'  style="width:500px;">
                <li class='tab active'><a href="#div1">Requests</a></li>
                <li class='tab'><a href="#div2">Orders</a></li>
                <li class='tab'><a href="#div3">Payments</a></li>
                <li class='tab'><a href="#div4">Parts Lookup</a></li>          
            </ul>      

            <div class="panel-container" style="border: 1px solid blue"> 
                <div id="div1" > Tab 1 Content</div>
                <div id="div2" > Tab 2 Content</div>
                <div id="div3" > Tab 3 Content</div>
                <div id="div4" > Tab 4 Content</div>                
            </div>  

        </div>

    </div>

</body> 

CSS Styling:

.etabs { margin: 0; padding: 0; }

.tab { 
    display: inline-block; 
    zoom:1; 
    background: #eee; 
    border: solid 1px #999; 
    border-bottom: none; 
    -moz-border-radius: 4px 4px 0 0; 
    -webkit-border-radius: 4px 4px 0 0; 
}

.tab a { 
    font-size: 14px; 
    line-height: 2em; 
    display: block;
    padding: 0 10px; 
    outline: none; 
}

.tab a:hover { 
    text-decoration: underline; 
}

.tab.active { 
    background: #008000; 
    padding-top: 6px; 
    position: relative; 
    top: 1px; 
    border-color: #666; 
}

.tab a.active { 
    text-decoration: none;
    color:#fff;
    font-family: Arial, Helvetica, sans-serif;
}

.tab-container .panel-container { 
    background: #fff; 
    border: solid #666 1px; 
    padding: 10px; 
    -moz-border-radius: 0 4px 4px 4px; 
    -webkit-border-radius: 0 4px 4px 4px; 
}

#vertitab {
   position: absolute;

   -webkit-transform-origin: 10% 271%;
      -moz-transform-origin: 10% 271%;
        -o-transform-origin: 10% 271%;
           transform-origin: 10% 271%;

   -webkit-transform: translate(-50%, 0) rotate(-90deg);
      -moz-transform: translate(-50%, 0) rotate(-90deg);
        -o-transform: translate(-50%, 0) rotate(-90deg);
           transform: translate(-50%, 0) rotate(-90deg);
   filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);

     -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
      -o-transform: rotate(90deg);
}

JSFiddle Link: https://jsfiddle.net/ru03w5Ly/2/

Thank you and warm regards

Answer №1

To achieve the desired centering effect for the panel-container, I made adjustments to the CSS code by including the following lines:

position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);

By implementing these changes, I successfully positioned the panel-container div at the center of the main div, fulfilling my initial query. Huge thanks go out to @SupportExpert and @CSSGuru for their assistance in navigating this issue.

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

Is there a way to extract content from an HTML <span id> using Python, Selenium, and BeautifulSoup?

I've been working on a project to create a web scraping tool using Python, Selenium, beautifulSoup, and pandas to generate a .csv report. Unfortunately, I'm facing an issue with extracting the "data-date" text from the HTML snippet below. Specif ...

How to Remove onFocus Warning in React TypeScript with Clear Input Type="number" and Start without a Default Value

Is there a way to either clear an HTML input field of a previous set number when onFocus is triggered or start with an empty field? When salary: null is set in the constructor, a warning appears on page load: Warning: The value prop on input should not ...

Is it possible to customize the font color of a placeholder in a v-text-field component in Vue?

Recently, I added the following code snippet to my project: <v-text-field hide-details class="search-field" id="name-input" placeholder="Search by name" v-model="search"></v-text-field> I wanted to change the font color of the placeholder tex ...

Insert a concise, condensed form of a Gist into an HTML document

Let's consider a scenario where we want to embed a lengthy gist in our webpage, like so: <script src="https://gist.github.com/benanne/3274371.js"></script> You can access the gist at this link: https://gist.github.com/benanne/3274371 Th ...

Notify of a specific value in an array that is retrieved through an AJAX request

I'm currently facing an issue with trying to display the value obtained from an ajax call. The code snippet below is functional in such a way that it will successfully alert the value of 'row' when grid.onClick is triggered. However, I am st ...

Tips for customizing the appearance of an HTML dropdown menu

Here is the code snippet: <select name="xyz" id="abc"> <option value="x">10/Page</option> <option value="y">20/Page</option> <option value="z">30/Pa ...

Step-by-step guide on incorporating heading and text onto an image carousel

I am facing an issue where, within an image carousel, my heading and text move down below the image instead of staying in the middle. I am utilizing the bootstrap framework. Below is the code snippet: <section> <div id="carouselExampleCo ...

Parsing JSON data returned from ASP.NET in JavaScript is proving to be problematic

After successfully converting a DataSet to JSON using a jQuery AJAX call, everything seems fine. The response I get back is as follows: {"Table":[[2,"BlackBerry Tour","2013-09-10","2013-09-13","Project"],null]} The JSON response looks valid and even pass ...

When scrolling, the element displays a partial background color that extends beyond the width of the window

My website has sections with a background color applied. However, when the browser window width is less than the page width, a strange issue occurs - the background color only covers a portion of the elements equal to the window width starting from the lef ...

Building modals with Bootstrap

Currently, my website is built using Bootstrap, JQuery, HTML, and CSS. I am looking to enhance the user experience by incorporating a modal output feature. The idea is that when a user clicks on a specific hyperlink, a modal window will open displaying t ...

Error: An uncaught exception occurred when trying to access a seekable HTML5 audio element, resulting in an IndexSize

While trying to utilize the HTML5 API along with SoundManager2, I encountered an issue. My goal was to determine the duration of a song in order to create a progress bar that would update as the song played. However, every time I attempted to retrieve the ...

What is the best way to use SQL and Flask to automatically fill out a form based on a selection made from a

Looking for assistance with populating an HTML form by selecting a company from a dropdown menu. The desired result is similar to the example found here, using SQL and Flask. I'm unsure of how to retrieve the selected value from the <option> ta ...

Tips for centering text in a dijitTextBox:

Ensure that the text is centered vertically with left padding and placeholder text included Check out the image link below: https://i.stack.imgur.com/PbHDa.jpg Snippet of my xPage code: <xe:djTextBox id="djTextBoxSearch" style="width:100%;height: ...

Sliding out the existing content and smoothly sliding in a fresh one upon clicking

Thank you for taking the time to read this. I've created a navigation bar and a few DIVs. What I want to achieve is when a button is clicked, the current DIV slides to the left and out of the page, while a new DIV slides in from the right. [http://w ...

Is it possible to prevent the text from appearing in the text box when a button is

I have successfully implemented a feature where clicking on the button (click on me) in HTML displays a textbox along with another button (show) on the screen. The text written in the textbox is visible when the show button is clicked. However, after the i ...

It's a mystery unraveling the source of CSS margins and padding

Could someone please help me analyze this webpage? I am trying to make the center of the page white up to the navigation bar, at the bottom of the page, and horizontally up to the shadows on both sides. I'm not sure where this extra padding is coming ...

Guide to extracting the data from a specific row in an HTML table and converting it into an array

I am trying to extract a specific row content from the features-table and store it in an array. However, I am facing an issue because I have embedded the table within an iframe. The requirement is that this extraction should occur when a user clicks on the ...

Is it possible to utilize the setInterval function twice within one .hover() event?

Is it possible to use setInterval twice in .hover()? If so, how can it be achieved? This is what I have in .hover: var target = evt.target; if (target.timer) { clearTimeout(target.timer); target.timer = null; } targe ...

In an HTML document, you may encounter whitespace that is not present in JSFiddle

Upon running this HTML file in my browser, I noticed that there is an 18px gap at the top of the first div. It's strange because this issue only occurs when I run the HTML locally on my browser, but everything works fine on JSFiddle. I'm puzzled ...

The hover effect is being applied exclusively to the final React component

When using next.js and tailwindCSS for styling, I created a custom component that includes tags. The issue arises when multiple instances of this component are placed on the page, as only the last one is getting the desired hover effect. "index.js" import ...