Is there a way to create a chrome-like tab using CSS?

后端 未结 8 646
北海茫月
北海茫月 2020-12-05 14:59

I have been looking for a Google Chrome-like tab written using CSS but cannot find one.

I am trying to replicate the look in order to use it in a web application or

相关标签:
8条回答
  • 2020-12-05 15:41

    What about this : http://codepen.io/justd/pen/dPeKEG/

    Find tuto here .

    @import "compass/css3";
    
    @import "compass";
    
    .tab-container {
      background: #8dc8fb;
      margin: 0;
      padding: 0;
      max-height: 40px;
    
      ul {
        &.nav-tabs {
          margin: 0;
          list-style-type: none;
          line-height: 40px;
          max-height: 40px;
          overflow: hidden;
          display: inline-block;
          @include display-flex;
          padding-right: 20px;
          border-bottom: 5px solid #f7f7f7;
    
          $color: #c3d5e6;
    
          > li {
            $raduis: 28px 145px;
    
            margin: 5px -14px 0;
            @include border-top-left-radius($raduis);
            @include border-top-right-radius($raduis);
            padding: 0 30px 0 25px;
            height: 170px;
            background: $color;
            position: relative;
            @include box-shadow(0 4px 6px rgba(0,0,0,.5));
            width: 200px;
            max-width: 200px;
            min-width: 20px;
            border:1px solid #aaa;
    
            &:first-child {
              margin-left: 0;
            }
    
            &:last-of-type {
              margin-right: 0;
            }
    
            > a {
              display: block;
              max-width:100%;
              text-decoration: none;
              color: #222;
              padding: 3px 7px;
    
              span {
                overflow: hidden;
                white-space: nowrap;
                display: block;
              }
    
              &:focus,
              &:hover {
                background-color: transparent;
                border-color: transparent;
              }
    
              .glyphicon-remove {
                color: #777;
                display: inline-block;
                padding:3px;
                font-size: 10px;
                position:absolute;
                z-index: 10;
                top:7px;
                right: -10px;
                @include border-radius(50%);
    
                &:hover {
                  background: #d39ea3;
                  color: white;
                  @include box-shadow(inset 0 1px 1px rgba(0,0,0,.25));
                  @include text-shadow(0 1px 1px rgba(0,0,0,.25));
                }
              }
            }
    
            &.active {
              z-index: 2;
              @include background-image(linear-gradient(white, #f7f7f7 30px));
    
              > a {
                background-color: transparent;
                border-color: transparent;
                border-bottom-color: transparent;
    
                &:focus,
                &:hover {
                  background-color: transparent;
                  border-color: transparent;
                  border-bottom-color: transparent;
                }
              }
            }
          }
    
          .btn {
            float: left;
            height: 20px;
            width: 35px;
            min-width: 35px;
            max-width: 35px;
            margin: 10px 0 0 0;
            border-color: #71a0c9;
            outline: none;
    
            @include transform(skew(30deg));
    
            &.btn-default {
              background: $color;
    
              &:hover {
                background: #d2deeb;
              }
    
              &:active {
                background: #9cb5cc;
              }
            }
          }
        }
      }
    
      .tab-pane {
        padding: 60px 40px;
        text-align: center;
    
        &.active {
          border-top:1px solid #ffffd;
        }
      }
    }
    
    0 讨论(0)
  • 2020-12-05 15:41

    I created here tabs like google chrome stylish UI, you can find the light and dark themes in the attached pen.

    <div grid class="group-tabs">
    
        <!-- START GRID TAB 001 -->
        <input hide="hide" type="radio" tab id="rTab-1" name="tab" checked="checked">
        <label class='grid-label' for='rTab-1'><span>Tab 1</span></label>
        <div flex class="tab-content">
            <div dark grid class="group-tabs">
    
                <!-- START GRID TAB 0015 -->
                <input hide="hide" type="radio" tab id="rTab-15" name="tab2" checked="checked">
                <label class='grid-label' for='rTab-15'>
                    <div icon icon-only>
                        <svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="adobe" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-adobe fa-w-16 fa-7x">
                            <path fill="currentColor" d="M315.5 64h170.9v384L315.5 64zm-119 0H25.6v384L196.5 64zM256 206.1L363.5 448h-73l-30.7-76.8h-78.7L256 206.1z" class=""></path>
                        </svg>
                    </div>
    
                </label>
                <div flex class="tab-content">
                    Icon on tab
                </div>
                <!-- END GRID TAB 0015 -->
    
                <!-- START GRID TAB 0016 -->
                <input hide="hide" type="radio" tab id="rTab-16" name="tab2">
                <label class='grid-label' for='rTab-16'><span>Tab 16</span></label>
                <div flex class="tab-content">
                    What is Lorem Ipsum? Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Why do we use it? It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). Where does it come from? Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. Where can I get some? There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
                </div>
                <!-- END GRID TAB 0016 -->
            </div>
        </div>
        <!-- END GRID TAB 001 -->
    
        <!-- START GRID TAB 002 -->
        <input hide="hide" type="radio" tab id="rTab-2" name="tab">
        <label class='grid-label' for='rTab-2'><span>Tab 2</span></label>
        <div flex class="tab-content">
            content 02
        </div>
        <!-- END GRID TAB 002 -->
        enter code here
    </div>
    
    
    0 讨论(0)
提交回复
热议问题