tabs using CSS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • listaction

    #1

    tabs using CSS

    Folks,
    I'm trying to implement a tabbed effect with CSS and HTML - no
    graphics.


    for some reason, i'm unable to control the width of the tabs. I've
    pasted the code below.


    Any help / pointers to resources that explain how to implement tabs
    with CSS would be great.
    Thanks,
    LP


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"

    />
    <title>Untitl ed Document</title>
    <style>
    ..box1{
    display:inline;
    z-index:1;
    width:2em;
    position:relati ve;
    white-space:nowrap;
    border-left: solid #000000 1px;
    border-right: solid #000000 1px;
    border-top: solid #000000 1px;
    border-bottom: solid #FFFFFF 1px;
    text-align:center
    bottom: -1px;
    padding-left: 2px;



    }


    ..box4{
    position: relative;
    background-color: none;
    width: 5em;
    border:none;
    border-bottom: solid #000000 1px;
    float: left;
    z-index:1;
    text-align: right;

    }


    ..box5{
    width: 3px;
    border: none;
    float: left;
    display:inline;
    z-index:1;


    }


    ..box6{
    position:relati ve;
    width:100%;
    z-index: -2;
    border: solid #000000 1px;
    height: 100px;
    top: -1px;


    }


    </style>
    </head>
    <body>
    <div class="box4">
    <li class="box1">te st</li>
    </div>
    <div class="box5"></div>
    <div class="box4">

    <li class="box1">te st2</li>


    </div>
    <div class="box5"></div>
    <div class="box4">
    <li class="box1">te st3</li>
    </div>
    <div class="box6"></div>
    </body>
    </html>

  • VK

    #2
    Re: tabs using CSS


    listaction wrote:[color=blue]
    > Folks,
    > I'm trying to implement a tabbed effect with CSS and HTML - no
    > graphics.
    > for some reason, i'm unable to control the width of the tabs. I've
    > pasted the code below.
    > .box1{
    > display:inline;[/color]

    Just crossed with my own question...

    .box1{
    display: -moz-inline-box;
    display: inline-block;

    (you need block or inline-block for width / height to apply)

    Comment

    • listaction

      #3
      Re: tabs using CSS

      that worked! VK thanks a lot for such a quick response.

      Comment

      • Spartanicus

        #4
        Re: tabs using CSS

        "VK" <schools_ring@y ahoo.com> wrote:
        [color=blue][color=green]
        >> Folks,
        >> I'm trying to implement a tabbed effect with CSS and HTML - no
        >> graphics.
        >> for some reason, i'm unable to control the width of the tabs. I've
        >> pasted the code below.
        >> .box1{
        >> display:inline;[/color]
        >
        >Just crossed with my own question...
        >
        > .box1{
        > display: -moz-inline-box;
        > display: inline-block;
        >
        >(you need block or inline-block for width / height to apply)[/color]

        Not smart, inline-block is poorly supported in most slightly older
        browsers.

        --
        Spartanicus

        Comment

        • Spartanicus

          #5
          Re: tabs using CSS

          "listaction " <listaction@gma il.com> wrote:
          [color=blue]
          >I'm trying to implement a tabbed effect with CSS and HTML - no
          >graphics.[/color]

          Try Googling before reinventing the wheel for the umpteenth time.

          --
          Spartanicus

          Comment

          • VK

            #6
            Re: tabs using CSS


            Spartanicus wrote:[color=blue]
            > "VK" <schools_ring@y ahoo.com> wrote:
            >[color=green][color=darkred]
            > >> Folks,
            > >> I'm trying to implement a tabbed effect with CSS and HTML - no
            > >> graphics.
            > >> for some reason, i'm unable to control the width of the tabs. I've
            > >> pasted the code below.
            > >> .box1{
            > >> display:inline;[/color]
            > >
            > >Just crossed with my own question...
            > >
            > > .box1{
            > > display: -moz-inline-box;
            > > display: inline-block;
            > >
            > >(you need block or inline-block for width / height to apply)[/color]
            >
            > Not smart, inline-block is poorly supported in most slightly older
            > browsers.[/color]

            Yup... That was a part of my question at:
            <http://groups.google.c om/group/comp.infosystem s.www.authoring .stylesheets/browse_frm/thread/c674a6548469179 b/ad75d12650a1d2e d#ad75d12650a1d 2ed>
            (I was actually checking for replies when encountered this question).

            IE 5.x (?), IE 6.x for sure, FF 1.0.4 or higher, Opera 8.x for sure.

            If Safary 2.x or higher supports inline-block then I can live with it
            in my particular solutions. But does it?

            Comment

            • Spartanicus

              #7
              Re: tabs using CSS

              "VK" <schools_ring@y ahoo.com> wrote:
              [color=blue][color=green]
              >> Not smart, inline-block is poorly supported in most slightly older
              >> browsers.[/color]
              >
              >Yup... That was a part of my question at:
              ><http://groups.google.c om/group/comp.infosystem s.www.authoring .stylesheets/browse_frm/thread/c674a6548469179 b/ad75d12650a1d2e d#ad75d12650a1d 2ed>
              >(I was actually checking for replies when encountered this question).[/color]

              Had you checked the archive there would have been no need to ask your
              question, luckily for you the archive hasn't closed yet for the day, so
              you can still use it.

              --
              Spartanicus

              Comment

              • VK

                #8
                Re: tabs using CSS


                Spartanicus wrote:[color=blue]
                > Had you checked the archive there would have been no need to ask your
                > question, luckily for you the archive hasn't closed yet for the day, so
                > you can still use it.[/color]

                Indeed:
                <http://homepage.ntlwor ld.com/spartanicus/ie_block_level_ element_inline-block_hack.htm>
                etc.

                Everyone wants to be lazy sometimes... ;-)

                Sorry.

                Comment

                • Joe Attardi

                  #9
                  Re: tabs using CSS

                  > Try Googling before reinventing the wheel for the umpteenth time.

                  Perhaps he is doing it as a learning exercise, or he has valid reasons
                  for doing it... he's asking for help not for a critique of what he
                  wants to do.

                  Comment

                  • F.N.

                    #10
                    Re: tabs using CSS







                    Comment

                    • Spartanicus

                      #11
                      Re: tabs using CSS

                      "Joe Attardi" <jattardi@gmail .com> wrote:

                      [about CSS "tabs"]
                      [color=blue][color=green]
                      >> Try Googling before reinventing the wheel for the umpteenth time.[/color]
                      >
                      >Perhaps he is doing it as a learning exercise,[/color]

                      Looking at existing proven solutions is the best way to learn, most
                      examples contain a verbose explanation of the methods used.
                      [color=blue]
                      >or he has valid reasons
                      >for doing it... he's asking for help not for a critique of what he
                      >wants to do.[/color]

                      Welcome to usenet, it's not a helpdesk as you seem to think

                      --
                      Spartanicus

                      Comment

                      • Joe Attardi

                        #12
                        Re: tabs using CSS

                        Spartanicus wrote:[color=blue]
                        > Welcome to usenet, it's not a helpdesk as you seem to think[/color]

                        Yeah, I've been using Usenet since '97 or so so I realize that. But for
                        just as long I've always been opposed to simply giving someone a hard
                        time if they think their question is dumb, instead of just ignoring
                        it...

                        Comment

                        • metoikos

                          #13
                          Re: tabs using CSS

                          There is a very good tutorial on A List Apart (a very good resource, I
                          will add) for creating graphical tabs which are still legible to screen
                          readers without alting. Its by the guy who I think did one of the Wired
                          site redesigns. Not that that's the only way, but its a pretty way. I'm
                          sure it has its flaws.

                          Anyhoo, here it is:

                          Sliding Doors of CSS
                          http://www.alistapart.com/articles/slidingdoors/

                          Comment

                          • listaction

                            #14
                            Re: tabs using CSS

                            Folks,
                            thanks for discussing the topic and pointing out available resources.
                            I did look at the sliding doors example and a few other places prior to
                            asking.

                            After looking at all resources, I was able to achieve the same effect
                            across ie and firefox using the code below. Might be sort of
                            reinventing the wheel, but its been a while since I did CSS / Xhtml
                            presentation & I thought I'd take an approach of defining classes vs.
                            redefining elements.

                            Pros and cons of doing something like this?

                            Thx.


                            <html xmlns="http://www.w3.org/1999/xhtml">
                            <head>
                            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
                            />
                            <title>Untitl ed Document</title>
                            <style>
                            .font1{
                            font-family:tahoma;
                            font-size:12pt;
                            }
                            .class1{
                            width:100%;
                            text-align:center;
                            top: 0px;
                            border-top: solid #666 1px;
                            z-index:1;
                            position:relati ve;
                            padding:0px;
                            float:left;
                            display:block;
                            }
                            .class2{
                            bottom: -0.05em;
                            height: 25px;
                            text-align:center;
                            vertical-align:middle;
                            border-bottom: solid #FFFFFF 1px;
                            border-top: solid #666 1px;
                            border-left: solid #666 1px;
                            border-right: solid #666 1px;
                            float: left;
                            display:block;
                            width: 75px;
                            z-index:2;
                            position:relati ve;
                            }
                            .class3{
                            bottom: -0.05em;
                            height: 25px;
                            text-align:center;
                            border-bottom: solid #666 1px;
                            border-top: solid #666 1px;
                            border-left: solid #666 1px;
                            border-right: solid #666 1px;
                            float: left;
                            display:block;
                            width: 75px;
                            z-index:2;
                            position:relati ve;
                            }
                            .class4{
                            bottom: -0.05em;
                            height: 25px;
                            text-align:center;
                            border: none;
                            float: left;
                            display:block;
                            width: 15px;
                            z-index:2;
                            position:relati ve;
                            }
                            .fontbold{
                            font-weight:bold;
                            }
                            </style>
                            </head>
                            <body bgcolor="#FFFFF F">
                            <div class="class4"> </div>
                            <div id="d1"class="c lass2 font1 fontbold" >test1</div>
                            <div class="class4"> </div>
                            <div id="d2" class="class3 font1" >test2</div>
                            <div class="class1"> </div>
                            </body>
                            </html>


                            metoikos wrote:[color=blue]
                            > There is a very good tutorial on A List Apart (a very good resource, I
                            > will add) for creating graphical tabs which are still legible to screen
                            > readers without alting. Its by the guy who I think did one of the Wired
                            > site redesigns. Not that that's the only way, but its a pretty way. I'm
                            > sure it has its flaws.
                            >
                            > Anyhoo, here it is:
                            >
                            > Sliding Doors of CSS
                            > http://www.alistapart.com/articles/slidingdoors/[/color]

                            Comment

                            • Spartanicus

                              #15
                              Re: tabs using CSS

                              "listaction " <listaction@gma il.com> wrote:
                              [color=blue]
                              >Pros and cons of doing something like this?[/color]

                              [snip code]

                              Don't post code to the group, upload it, post the url.
                              [color=blue]
                              ><div class="class4"> </div>
                              ><div id="d1"class="c lass2 font1 fontbold" >test1</div>
                              ><div class="class4"> </div>
                              ><div id="d2" class="class3 font1" >test2</div>
                              ><div class="class1"> </div>[/color]

                              Had you paid attention whilst looking at the existing proven solutions
                              you would have noticed that they were based on correct markup, unlike
                              the div soup you created.



                              --
                              Spartanicus

                              Comment

                              Working...