gpt4 book ai didi

CSS - 垂直方向的标签

转载 作者:行者123 更新时间:2023-11-28 09:21:33 25 4
gpt4 key购买 nike

晚上好!
目前我有一个水平方向的选项卡。此外,我希望在同一选项卡内容的右侧有一些垂直方向的选项卡。

我可以转动

  • 方向,但无法在选项卡内容的右侧将新选项卡彼此对齐。

    到目前为止,这是我的代码:

    HTML:

    <div class="tabs">
    <ul class="tab-links">
    <li class="active"><a href="#About">About</a></li>
    <li><a href="#Video">Video</a></li>
    <li><a href="#Media">Media</a></li>
    <li><a href="#Contact">Contact</a></li>
    <li id="rotate"><a href="#CV">CV</a></li>
    <li id="rotate"><a href="#Pro">Prosjekter</a></li>
    </ul>
    <div class="tab-content">
    <div id="About" class="tab active">
    <p>Tab #1 content goes here!</p>
    <p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum risus ornare mollis.</p>
    </div>

    <div id="Video" class="tab">
    <p>Tab #2 content goes here!</p>
    <p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum risus ornare mollis. In hac habitasse platea dictumst. Ut euismod tempus hendrerit. Morbi ut adipiscing nisi. Etiam rutrum sodales gravida! Aliquam tellus orci, iaculis vel.</p>
    </div>

    <div id="Media" class="tab">
    <p>Tab #3 content goes here!</p>
    <p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum ri.</p>
    </div>

    <div id="Contact" class="tab">
    <p>Tab #4 content goes here!</p>
    <p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum risus ornare mollis. In hac habitasse platea dictumst. Ut euismod tempus hendrerit. Morbi ut adipiscing nisi. Etiam rutrum sodales gravida! Aliquam tellus orci, iaculis vel.</p>
    </div>

    <div id="CV" class="tab">
    <p>Tab #5 content goes here!</p>
    <p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum risus ornare mollis. In hac habitasse platea dictumst. Ut euismod tempus hendrerit. Morbi ut adipiscing nisi. Etiam rutrum sodales gravida! Aliquam tellus orci, iaculis vel.</p>
    </div>

    <div id="Pro" class="tab">
    <p>Tab #6 content goes here!</p>
    <p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum risus ornare mollis. In hac habitasse platea dictumst. Ut euismod tempus hendrerit. Morbi ut adipiscing nisi. Etiam rutrum sodales gravida! Aliquam tellus orci, iaculis vel.</p>
    </div>



    </div> <!-- End content-body -->

    CSS:

    /*----- Tabs -----*/
    .tabs {
    display:inline-block;
    position: absolute;
    width:475px;
    margin-left: 20px;
    float:right;

    }

    /*----- Tab Links -----*/
    /* Clearfix */
    .tab-links:after {
    display:inline-block;
    content:'';
    }

    .tab-links li {
    margin:-5px 7px;
    float:left;
    list-style:none;

    }

    .tab-links a {
    padding:9px 15px;
    margin-top: -15px;
    display:inline-block;
    border-radius:3px 3px 0px 0px;
    background:#df8b67;
    font-size:18px;
    font-weight:bold;
    color:#fff;
    text-decoration: none;
    /*font-family: MoviePoster;*/
    }

    .tab-links a:hover {
    background:#d25a26;
    text-decoration:none;
    text-decoration: none;
    }

    li.active a, li.active a:hover {
    background:#d25a26;
    color:#fff;
    }

    /*----- Tab right -----*/
    /* Clearfix */
    .tab-link-right:after {
    display:inline-block;
    content:'';
    }



    .tab-links-right li {
    margin:-5px 7px;
    float:left;
    list-style:none;
    display: inline;
    }

    .tab-links-right a {
    padding:9px 15px;
    margin-top: -15px;
    display:inline-block;
    border-radius:3px 3px 0px 0px;
    background:#df8b67;
    font-size:18px;
    font-weight:bold;
    color:#fff;
    text-decoration: none;
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    /*font-family: MoviePoster;*/
    }

    .tab-links-right a:hover {
    background:#d25a26;
    text-decoration:none;
    text-decoration: none;
    }

    li.active a, li.active a:hover {
    background:#d25a26;
    color:#fff;
    }

    /*----- Content of Tabs -----*/
    .tab-content {
    margin-top: -14px;
    padding:20px;
    border-radius:3px;
    background:#fff;
    border-style: solid;
    border-color: #d25a26;
    height:447px;

    -moz-box-shadow: 5px 5px 2.5px #888;
    -webkit-box-shadow: 5px 5px 2.5px #888;
    box-shadow: 5px 5px 2.5px #888;
    }

    .tab {
    display:none;
    }

    .tab.active {
    display:block;
    }

    #rotate {

    /* Safari */
    -webkit-transform: rotate(90deg);

    /* Firefox */
    -moz-transform: rotate(90deg);

    /* IE */
    -ms-transform: rotate(90deg);

    /* Opera */
    -o-transform: rotate(90deg);

    /* Internet Explorer */
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);

    }

  • 最佳答案

    根据 OP 的评论更新

    首先,您缺少 tabs div 的结束标记。其次,您不能为两个元素分配相同的 id rotate。我为旋转元素提供了单独的 Id,他们为它们提供了以下 CSS 替换您的 rotate 类。并且没有更改 CSS 中的任何其他内容

    像这样分配 Ids:

    <li id="verOne"><a href="#CV">CV</a></li>
    <li id="verTwo"><a href="#Pro">Prosjekter</a></li>

    CSS:

    li#verTwo {
    position: absolute;
    left: 450px;
    top: 80px;
    /* Safari */
    -webkit-transform: rotate(90deg);

    /* Firefox */
    -moz-transform: rotate(90deg);

    /* IE */
    -ms-transform: rotate(90deg);

    /* Opera */
    -o-transform: rotate(90deg);

    /* Internet Explorer */
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
    }

    li#verOne {
    position: absolute;
    left: 478px;
    top: 185px;
    /* Safari */
    -webkit-transform: rotate(90deg);

    /* Firefox */
    -moz-transform: rotate(90deg);

    /* IE */
    -ms-transform: rotate(90deg);

    /* Opera */
    -o-transform: rotate(90deg);

    /* Internet Explorer */
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
    }

    下面是带有完整代码的工作演示。

    /*----- Tabs -----*/
    .tabs {
    display:inline-block;
    position: absolute;
    width:475px;
    margin-left: 20px;
    float:right;

    }

    /*----- Tab Links -----*/
    /* Clearfix */
    .tab-links:after {
    display:inline-block;
    content:'';
    }

    .tab-links li {
    margin:-5px 7px;
    float:left;
    list-style:none;

    }

    .tab-links a {
    padding:9px 15px;
    margin-top: -15px;
    display:inline-block;
    border-radius:3px 3px 0px 0px;
    background:#df8b67;
    font-size:18px;
    font-weight:bold;
    color:#fff;
    text-decoration: none;
    /*font-family: MoviePoster;*/
    }

    .tab-links a:hover {
    background:#d25a26;
    text-decoration:none;
    text-decoration: none;
    }

    li.active a, li.active a:hover {
    background:#d25a26;
    color:#fff;
    }

    /*----- Tab right -----*/
    /* Clearfix */
    .tab-link-right:after {
    display:inline-block;
    content:'';
    }



    .tab-links-right li {
    margin:-5px 7px;
    float:left;
    list-style:none;
    display: inline;
    }

    .tab-links-right a {
    padding:9px 15px;
    margin-top: -15px;
    display:inline-block;
    border-radius:3px 3px 0px 0px;
    background:#df8b67;
    font-size:18px;
    font-weight:bold;
    color:#fff;
    text-decoration: none;
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    /*font-family: MoviePoster;*/
    }

    .tab-links-right a:hover {
    background:#d25a26;
    text-decoration:none;
    text-decoration: none;
    }

    li.active a, li.active a:hover {
    background:#d25a26;
    color:#fff;
    }

    /*----- Content of Tabs -----*/
    .tab-content {
    margin-top: -14px;
    padding:20px;
    border-radius:3px;
    background:#fff;
    border-style: solid;
    border-color: #d25a26;
    height:447px;

    -moz-box-shadow: 5px 5px 2.5px #888;
    -webkit-box-shadow: 5px 5px 2.5px #888;
    box-shadow: 5px 5px 2.5px #888;
    }

    .tab {
    display:none;
    }

    .tab.active {
    display:block;
    }

    li#verTwo {
    position: absolute;
    left: 450px;
    top: 80px;
    /* Safari */
    -webkit-transform: rotate(90deg);

    /* Firefox */
    -moz-transform: rotate(90deg);

    /* IE */
    -ms-transform: rotate(90deg);

    /* Opera */
    -o-transform: rotate(90deg);

    /* Internet Explorer */
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
    }

    li#verOne {
    position: absolute;
    left: 478px;
    top: 185px;
    /* Safari */
    -webkit-transform: rotate(90deg);

    /* Firefox */
    -moz-transform: rotate(90deg);

    /* IE */
    -ms-transform: rotate(90deg);

    /* Opera */
    -o-transform: rotate(90deg);

    /* Internet Explorer */
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
    }
    <div class="tabs">
    <ul class="tab-links">
    <li class="active"><a href="#About">About</a></li>
    <li><a href="#Video">Video</a></li>
    <li><a href="#Media">Media</a></li>
    <li><a href="#Contact">Contact</a></li>
    <li id="verOne"><a href="#CV">CV</a></li>
    <li id="verTwo"><a href="#Pro">Prosjekter</a></li>
    </ul>
    <div class="tab-content">
    <div id="About" class="tab active">
    <p>Tab #1 content goes here!</p>
    <p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum risus ornare mollis.</p>
    </div>

    <div id="Video" class="tab">
    <p>Tab #2 content goes here!</p>
    <p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum risus ornare mollis. In hac habitasse platea dictumst. Ut euismod tempus hendrerit. Morbi ut adipiscing nisi. Etiam rutrum sodales gravida! Aliquam tellus orci, iaculis vel.</p>
    </div>

    <div id="Media" class="tab">
    <p>Tab #3 content goes here!</p>
    <p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum ri.</p>
    </div>

    <div id="Contact" class="tab">
    <p>Tab #4 content goes here!</p>
    <p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum risus ornare mollis. In hac habitasse platea dictumst. Ut euismod tempus hendrerit. Morbi ut adipiscing nisi. Etiam rutrum sodales gravida! Aliquam tellus orci, iaculis vel.</p>
    </div>

    <div id="CV" class="tab">
    <p>Tab #5 content goes here!</p>
    <p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum risus ornare mollis. In hac habitasse platea dictumst. Ut euismod tempus hendrerit. Morbi ut adipiscing nisi. Etiam rutrum sodales gravida! Aliquam tellus orci, iaculis vel.</p>
    </div>

    <div id="Pro" class="tab">
    <p>Tab #6 content goes here!</p>
    <p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum risus ornare mollis. In hac habitasse platea dictumst. Ut euismod tempus hendrerit. Morbi ut adipiscing nisi. Etiam rutrum sodales gravida! Aliquam tellus orci, iaculis vel.</p>
    </div>



    </div> <!-- End content-body -->
    </div>

    关于CSS - 垂直方向的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26077704/

    25 4 0