讨论题

作者: cooore | 来源:发表于2016-07-03 16:26 被阅读0次

定宽+自适应宽

/*方法一:弹性布局*/

.parent1{

display: flex;

height:300px;

}

.side1{

width:200px;

height:100%;

background-color:#c00000;

margin-right:10px;

}

.main1{

flex:1;

background-color:#4f81bd;

}

/*方法二:浮动*/

.side2{

width:200px;

height:300px;

background-color:#c00000;

float:left;

}

.main2{

height:300px;

margin-left:210px;

background-color:#4f81bd;

}

/*方法三:绝对定位*/

.parent3{

height:300px;

position:relative;

}

.side3{

width:200px;

height:100%;

background-color:#c00000;

}

.main3{

position:absolute;

height:100%;

width:100%;

left:210px;

top:0;

background-color:#4f81bd;

}

<div class="tab">

    <ul class="lesson">

        <li class="active">课程</li>

        <li>学习计划</li>

        <li>技能图谱</li>

    </ul>

    <div class="con">

        <p class="con_1">课程内容</p>

        <p class="con_2">学习计划内容</p>

        <p class="con_3">技能图谱内容</p>

    </div>

</div>

弹性布局

body{ margin: 0; }

li{ list-style: none; }

ul, p{ padding: 0; margin: 0; }

/* css reset */

body{ font-size: 14px; font-family: '微软雅黑'; }

.tab{ width: 572px; border: 1px solid #999; margin: 10px auto; }

.lesson{ display: flex; }

li{ flex-grow: 1; flex-basis: 0; text-align: center; border-left: 1px solid #cecece; border-bottom: 1px solid #cecece;

line-height: 30px;background: #f1f1f1; }

.con{ height: 40px; background: #fff; padding: 20px; }

.con_1, .con_2, .con_3{ display: none; }

.con_1{ display: block; }

.active{ background: #ffffff; border: none; }

一般版本--兼容IE6

body{ font-size: 14px; font-family: '微软雅黑'; }

ul, p{

margin: 0;

padding: 0;

}

li {

list-style: none;

}

/* css reset */

.clear { zoom: 1 }

.clear:after { content: ''; display: block; clear: both  }

.tab {

margin: 10px auto;

width: 572px;

border: 1px solid #999;

}

.lesson li {

float: left;

width: 190px;

line-height: 30px;

text-align: center;

border: 1px solid #cecece;

border-top: none;

border-right: none;

background: #f1f1f1;

}

.lesson .active { border: 0; background: #ffffff; }

.con{ height: 40px; background: #fff; padding: 20px; }

.con_1, .con_2, .con_3{ display: none; }

.con_1{ display: block; }

.active{ background: #ffffff; border: none; }

<div class="pop">

    <div class="head">

        <p class="title">标题栏</p>

        <button class="close></button>

</div>

    <div class="content">

        <p class="text">内容区段落</p>

        <buttonclass="button">确定</button>

    </div>

</div>

/*整个弹出窗口设置,弹性布局*/

.pop{

position: fixed;

top: 50%;

right: 50%;

transform: translate(50%, -50%);

width: 300px;

border: 1px solid #cccccc;

border-radius: 5px;

}

/*head作为关闭按钮的参考物*/

.head{

position: relative;

height: 40px;

background-color: #eeeeee;

}

/*设置行高和元素同高来使文字居中,分别设置隐藏、不换行和...*/

.title{

height: 100%;

margin: 0 20px;

font: 14px/40px "微软雅黑";

overflow: hidden;

white-space: nowrap;

text-overflow: ellipsis;

}

/*考虑到关闭按钮位置已确定,采用绝对定位,去除按钮默认边框,以背景图方式引入图片,失败则用红色标记*/

.close{

position: absolute;

border: 0;

padding: 0;

top: 10px;

right: 10px;

width: 10px;

height: 10px;

background: url('../x.png') red;

cursor: pointer;

}

/*把段落和按钮都放入内容区padding内*/

.content{

padding: 20px;

background-color: white;

font: 12px/1.5 "宋体";

}

/*段落距按钮20px*/

.text{

margin: 0 0 20px 0;

}

/*左右margin为auto使按钮居中,前提是button设为块级;去除按钮默认边框*/

.button{

display: block;

margin: 0 auto;

padding: 0;

width: 80px;

height: 30px;

border: none;

border-radius: 5px;

background-color: blue;

color: white;

text-align: center;

}

相关文章

  • 可以考虑

    讨论题,

  • 讨论题

    有没有觉得自己找的老公,是自己瞎了眼,现在看都不要看他的那种瞧不起和厌烦?

  • 讨论题

    定宽+自适应宽 /*方法一:弹性布局*/ .parent1{display:flex;height:300px;}...

  • 讨论题

    /*flex布局*/display: flex;align-items: flex-end;优点:只在父元素上设置...

  • 03.26 讨论题

    假如你是一位高级餐厅的经理,管理着100名各种岗位人员,餐厅经营状况在你兢兢业业的管理下非常好,现在你要在目前的情...

  • 设计思维:小题目折射大问题

    2021-09-24课程的首次讨论题目是这样的。当天下雨造成行走不变,我就势出了个讨论题目: 雨天时的校园道路治理...

  • 现当代讨论题

    高加林跟孙少平我更认同孙少平。 高加林跟孙少平分别是余华笔下《人生》跟《平凡的世界》里的人物,作为处于城乡交叉地带...

  • 2020寒假讨论题

    成绩的好坏已过去,我们开启快乐寒假生活模式。 寒假讨论第一题 阅读2.春天的雨点,围绕“发现爱,传递爱”进行大讨论...

  • 当你喜欢一个人应该是什么样子呢

    这是一个讨论题,希望经历过感情的你,把秘密写在评论区里

  • 讨论题引发的思考

    1963年3月5日 《人民日报》发表毛主席题词:“向雷锋同志学习” 一位教师在书上看到一道分析题,觉得它很适合训练...

网友评论

      本文标题:讨论题

      本文链接:https://www.haomeiwen.com/subject/clccjttx.html