黑匣子位置练习

时间:2017-05-15 23:35:49

标签: html css position box

我有这张图片,我需要回复。 我已经完成了大部分代码,但是我在使用黑盒子时遇到了一些麻烦。 它需要是:   - 在“redbox”之上   - 在“蓝盒子”后面   - 在“blueinbox”之上

enter image description here

body {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin:0 !important;
    width: 100% !important;
    -webkit-text-size-adjust: 100% !important;
    -ms-text-size-adjust: 100% !important;
    -webkit-font-smoothing: antialiased !important;
}
.container {
    background-color: #e1e1e1;
    height: 200px;
    width: 400px;
    border: 0;
    margin: auto;
    display: table;
    margin-top: 20px;
    position: relative;
}
.redbox {
    background-color: #fff;
    height: 120px;
    width: 120px;
    margin: 20px 20px 0 0;
    display: table;
    right: 0;
    border-style: solid;
    border-width: 1px;
    border-color: red;
    border-radius: 5px;
    position: absolute;
}
.bluebox {
    background-color: #fff;
    height: 120px;
    width: 120px;
    margin: 60px 60px 0 0;
    display: table;
    right: 0;
    border-style: solid;
    border-width: 1px;
    border-color: blue;
    position: absolute;
    border-left-style: dashed;
}
.blueinbox {
    background-color: #00aeef;
    height: 80px;
    width: 80px;
    margin: 20px 20px 0 0;
    float: right;
}
.ninja {
    color: #fff;
    font-family: "Open Sans", Arial, sans-serif;
    letter-spacing: 2px;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-right: -50%;
    transform: translate(-50%, -50%)
}
<body>
    <div class="container">
        <div class="redbox">
        </div>
        <div class="bluebox">
            <div class="blueinbox">
                <div class="ninja">
                    <p>NINJA!</p>
                </div>
            </div>
        </div>
    </div>
          
</body>

2 个答案:

答案 0 :(得分:1)

完成。

#use from_dict and set orient to index and then transpose in the end.
pd.DataFrame.from_dict(dictio,orient='index').T
Out[263]: 
     a    c    b
0  abc  prq  zyx
body {
	font: 500 16px 'Open Sans', Arial, sans-serif;
	color: #fff;
}

.container {
	position: relative;
	max-width: 400px;
	height: 200px;
	margin: 2rem auto;
	border: 1px solid #000;
	background-color: #eee;
}

.box-red, .box-blue-light, .box-blue-dark, .box-black {
	position: absolute;
}

.box-red {
	top: 20px;
	right: 20px;
	width: 120px;
	height: 120px;
	border: 1px solid red;
	border-radius: 5px;
}

.box-black {
	top: 40px;
	right: 40px;
	width: 60px;
	height: 60px;
	background-color: #000;
}

.box-blue-light {
	top: 80px;
	right: 80px;
	width: 80px;
	height: 80px;
	background-color: #05adeb;
}
.box-blue-light::before {
	content: "";
	position: absolute;
	right: 0;
	width: 20px;
	height: 20px;
	background-color: #000;
}
.box-blue-light h5 {
	margin-top: 2rem;
	font: 500 1rem 'Open Sans';
	letter-spacing: 2px;
	text-align: center;
}

.box-blue-dark {
	top: 60px;
	right: 60px;
	width: 120px;
	height: 120px;
	border: 1px solid blue;
	border-left-style: dashed;
	background: #fff url("https://media1.giphy.com/media/fLg3MEWdgH5Ti/200.gif");
}
.box-blue-dark::after {
	content: "";
	position: absolute;
	width: 100%;
	height: 100%;
	background-color: rgba(170,50,90,.25)
}

答案 1 :(得分:-1)

添加z-index:1;到.bluebox。

body {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin:0 !important;
    width: 100% !important;
    -webkit-text-size-adjust: 100% !important;
    -ms-text-size-adjust: 100% !important;
    -webkit-font-smoothing: antialiased !important;
}
.container {
    background-color: #e1e1e1;
    height: 200px;
    width: 400px;
    border: 0;
    margin: auto;
    display: table;
    margin-top: 20px;
    position: relative;
}
.redbox {
    background-color: #fff;
    height: 120px;
    width: 120px;
    margin: 20px 20px 0 0;
    display: table;
    right: 0;
    border-style: solid;
    border-width: 1px;
    border-color: red;
    border-radius: 5px;
    position: absolute;
}
.bluebox {
    background-color: #fff;
    height: 120px;
    width: 120px;
    margin: 60px 60px 0 0;
    display: table;
    right: 0;
    border-style: solid;
    border-width: 1px;
    border-color: blue;
    position: absolute;
    border-left-style: dashed;
}
.blueinbox {
    background-color: #00aeef;
    height: 80px;
    width: 80px;
    margin: 20px 20px 0 0;
    float: right;
}
.blackbox {
    background-color: #000;
    height: 80px;
    width: 80px;
    margin: 20px 20px 0 0;
    float: right;
}
.ninja {
    color: #fff;
    font-family: "Open Sans", Arial, sans-serif;
    letter-spacing: 2px;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-right: -50%;
    transform: translate(-50%, -50%)
}
<body>
    <div class="container">
        <div class="redbox">
            <div class="blackbox"></div>
        </div>
        <div class="bluebox">
            <div class="blueinbox">
                <div class="ninja">
                    <p>NINJA!</p>
                </div>
            </div>
        </div>
    </div>
</body>