Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: CSS Tabs too wide

  1. #1
    Join Date
    Nov 2008
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default CSS Tabs too wide

    Hello:

    I am losing my mind here and I could really use some help. I am trying to created a simple tabbed login form and I am having problems with the tab portion. If I have a tab that has lots of text, for some reason it takes that width and applies it to my tab, which is not what I want. I actually want a fixed width of the tab, like the first one, across the other tabs that automatically increases or decreases the height of the content, the yellow box. Can anyone help me please.

    Also, what I am not understanding is why labels for the div "nuffin" taking on the same properties as the tabs label when I have a separate name for it?

    Any help would be greatly appreciated.

    HTML Code:
    <div class="main">
       <ul class="tabs">
    
          <li>
             <input type="radio" checked name="tabs" id="tab1">
             <label for="tab1">Register</label>
             <div id="tab-content1" class="tab-content animated fadeIn">
                <div id="nuffin">
                   <form action="" method="post">
    
                      <label>UserName  :</label><input type="text" name="username" class="box"/><br /><br />
                      <label>Password1  :</label><input type="password1" name="password1" class="box" /><br/><br />
                      <label>Password2  :</label><input type="password2" name="password2" class="box" /><br/><br />
    
                      <input type="submit" value=" Submit "/><br />
    
                   </form>
    
                </div>
    
             </div>
          </li>
    
          <li>
             <input type="radio" name="tabs" id="tab2" checked="checked">
             <label for="tab2">Login</label>
             <div id="tab-content2" class="tab-content animated fadeIn">
                If I write a lot of text here, it somehow changes the look of the tabs.  Not sure what is happening.
             </div>
          </li>
    
          <li>
             <input type="radio" name="tabs" id="tab3">
             <label for="tab3">Forgot</label>
             <div id="tab-content3" class="tab-content animated fadeIn">
                Lorem ipsum dolor ...
             </div>
          </li>
    
       </ul>
    </div>

  2. #2
    Join Date
    Nov 2008
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Opps, sorry, I forgot to add the css file ...
    Code:
    <style>
    
    /* This is just a dummy box, DELETE for production. */
    .main
    {
       border: 1px solid red;
       padding: 5px;
    }
    
    /* This is the entire tabs for the area with content. */
    .tabs
    {
       xwidth: 650px;
       xfloat: none;
       list-style: none;
       position: relative;
       padding: 0;
       xmargin: 75px auto;
    
       width: 100%;
       xoverflow: auto;
       border: 1px solid yellow;
       xheight: 350px;
    
       display: inline-block;
    }
    
    /* This is the individual tabs. */
    .tabs li
    {
       float: left;
    }
    
    /* Radio buttons area that is NOT visible. */
    .tabs input[type=radio]
    {
       position: absolute;
       top: -9999px;
       left: -9999px;
    }
    
    /* This is the current tab selected. */
    [id^=tab]:checked + label
    {
       background: #08C;
       color: white;
       top: 0;
    }
    
    /* This is the individual tab label areas. */
    .tabs label
    {
       display: block;
       padding: 10px 20px;
       border-radius: 2px 2px 0 0;
       color: #08C;
       font-size: 24px;
       font-weight: normal;
       font-family: 'Roboto', helveti;
       background: rgba(255,255,255,0.2);
       cursor: pointer;
       position: relative;
       top: 3px;
       -webkit-transition: all 0.2s ease-in-out;
       -moz-transition: all 0.2s ease-in-out;
       -o-transition: all 0.2s ease-in-out;
       transition: all 0.2s ease-in-out;
    }
    
    /* This is the individual tab hover. */
    .tabs label:hover
    {
       background: rgba(255,255,255,0.5);
       top: 0;
    }
    
    /* This is the checked tab content area. */
    [id^=tab]:checked ~ [id^=tab-content]
    {
       display: block;
    }
    
    /* Same as above. */
    .tab-content
    {
       z-index: 2;
       display: none;
       text-align: left;
       width: 100%;
       font-size: 20px;
       line-height: 140%;
       padding-top: 10px;
       background: #08C;
       padding: 15px;
       color: white;
       xposition: absolute;
       top: 53px;
       left: 0;
       box-sizing: border-box;
       -webkit-animation-duration: 0.5s;
       -o-animation-duration: 0.5s;
       -moz-animation-duration: 0.5s;
       animation-duration: 0.5s;
    
       z-index: 2;
       display: none;
       float: left;
       padding: 1em;
       left: 0;
       border: 1px solid #ddd;
       margin-top: 8px;
       min-width: 90%;
    }
    
    #nuffin label
    {
       background: pink;
    }
    
    </style>
    Last edited by Beverleyh; 01-15-2015 at 06:29 AM. Reason: formatting

  3. #3
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    512
    Thanks
    9
    Thanked 61 Times in 59 Posts

    Default

    Do you have an example of what you are wanting? This is kinda confusing. Are you wanting the 'Login' Tab just around the log in part?
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

  4. #4
    Join Date
    Nov 2008
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hello:

    What I want is 1 login screen with 3 tabs for Register, Login, and Forgot. The problem is that the tab headers takes the size of the tab content, so if I have a tab with lots of text, for some reason, that tab header takes it's width. I want something uniform and clean. I know I have errors with some of the elements. When I try out things and am not sure Iif I want to use them, I put an "x" in front of it so that it does not get used. Too lazy to comment it out properly.

  5. #5
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    512
    Thanks
    9
    Thanked 61 Times in 59 Posts

    Default

    Can I use JavaScript or do you want me to just keep it as CSS/html?
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

  6. #6
    Join Date
    Nov 2008
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I didn't know beggers could be choosers, haha. I would prefer pure CSS. I have this under jsfiddle:

    http://jsfiddle.net/lepew/hLed8o96/1/

    Currently, when you click the "Register" tab, everything is fine, but everything goes south on the other 2. I know the tabs and colors are ugly. I was going to change that AFTER the basic script works. Not knowing much, but to me, it looks like the content is wrong. It moves up and down correctly for the different heights, but the width of the tabs are fubarred.

  7. #7
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    512
    Thanks
    9
    Thanked 61 Times in 59 Posts

    Default

    Im not finished (Fixing a ton of things) Are you wanting the tabs like this http://jsfiddle.net/x2m7r49b/2/?

    Like always next to each other? Again im not finished. I just want to know if you want it like that xD
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

  8. #8
    Join Date
    Nov 2008
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Dude, I feel so bad asking for all of this, seriously. It sure looks better than what I had. The individual contents seem to still be influenced by the tab because Register is left aligned, Login is centered and Forgot is right aligned. Basically all 3 will be very identical to Login except for a few added fields so I will have all the contents centered within a div. Is it possible to get them to look like normal tabs, they seem like they are spread over the entire top part?

  9. #9
    Join Date
    Nov 2008
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Here is another version:

    http://jsfiddle.net/lepew/hLed8o96/2/

    I want to get the entire tab in the red box. The height of each content box would change depending on the actual content.

  10. #10
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    512
    Thanks
    9
    Thanked 61 Times in 59 Posts

    Default

    Okay so you want only the tabs inside the redbox?
    Last edited by Deadweight; 01-15-2015 at 09:05 PM.
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

Similar Threads

  1. Replies: 1
    Last Post: 12-17-2010, 11:42 AM
  2. Resolved Favicon Site-Wide
    By X96 Web Design in forum Other
    Replies: 5
    Last Post: 06-07-2009, 11:20 PM
  3. SD-Menu for site-wide use
    By end80 in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 05-05-2009, 01:23 PM
  4. AnyLink Vertical Menu in wide table
    By dcwebman in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 01-12-2008, 12:14 AM
  5. Uncontrollably Wide Div
    By dog in forum HTML
    Replies: 2
    Last Post: 06-12-2006, 06:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •