html +CSS 静态长方体 绘制,不带旋转 正方体绘制时把宽设置为250即可

<!DOCTYPE html>
<html>

<head>

  <meta charset="UTF-8">
  <title>三D长方体</title>
 
<style>

html {
    font-family: sans-serif; /* 1 */
    -ms-text-size-adjust: 100%; /* 2 */
    -webkit-text-size-adjust: 100%; /* 2 */
}

body {
    margin: 0;
}

figure {
    margin: 0;
}

fieldset {
    border: 1px solid #c0c0c0;
    margin: 0 2px;
    padding: 0.35em 0.625em 0.75em;
}

</style>

    <style>
body {
  color: #333;
  padding: 20px;
  text-align: center;
  font-family: Arial;
}

.separator {
  margin-top: 40px;
}

.twitter {
  color: #FFF;
  text-decoration: none;
  border-radius: 4px;
  background: #00ACED;
  display: inline-block;
  padding: 10px 8px;
  margin-bottom: 15px;
  font-weight: bold;
}

/* 3D Cube */
.space3d {
  perspective: 1000px;
  width: 250px;
  height: 150px;
  text-align: center;
  display: inline-block;
}

._3dbox {
  display: inline-block;
  transition: all 0.85s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-align: center;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(-15deg) rotateY(15deg);
}

._3dface {
    
  overflow: hidden;
  position: absolute;
  border: 1px solid #888;
  background: #FFF;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.1), 0 0 50px rgba(0, 0, 0, 0.3);
  color: #333;
  line-height: 150px;
  opacity: 0.8;
}

._3dface--front {
  width: 250px;
  height: 150px;
  transform: translate3d(0, 0, 125px);
}

._3dface--top {
  width: 250px;
  height: 250px;
  transform: rotateX(90deg) translate3d(0, 0, 125px);
}

._3dface--bottom {
  width: 250px;
  height: 250px;
  transform: rotateX(-90deg) translate3d(0, 0, 26px);
}

._3dface--left {
  width: 250px;
  height: 150px;
  left: 50%;
  margin-left: -125px;
  transform: rotateY(-90deg) translate3d(0, 0, 125px);
}

._3dface--right {
  width: 250px;
  height: 150px;
  left: 50%;
  margin-left: -125px;
  transform: rotateY(90deg) translate3d(0, 0, 125px);
}

._3dface--back {
  width: 250px;
  height: 150px;
  transform: rotateY(180deg) translate3d(0, 0, 125px);
}
._3dface--front {
  background-color: #888888;
  background-size: 100%;
}

._3dface--left {
  background-color: #888888;
  background-size: auto 100%;
}

._3dface--right {
  background-color: #888888;
  background-size: auto 100%;
}

._3dface--top {
 background-color: #888888;
  background-size: auto 100%;
}

._3dface--bottom {
  background-color: #888888;
  background-size: auto 100%;
}

._3dface--back {
 background-color: #888888;
  background-size: auto 100%;
}

.fontStyle{
        font-size: 39px;
    color: #FFFF;
}
</style>
</head>

<body>


<div class="separator"></div>
<div style="width: 60%;margin: 0 auto;">
<div class="space3d" style="float: left;">

    <div class="_3dbox">
      <div class="_3dface _3dface--front fontStyle">hx0001 </div>
      <div class="_3dface _3dface--top"></div>
      <div class="_3dface _3dface--bottom"></div>
      <div class="_3dface _3dface--left"></div>
      <div class="_3dface _3dface--right"></div>
      <div class="_3dface _3dface--back"></div>
    </div>

</div>
<div class="space3d" style="float: right;">

    <div class="_3dbox">
      <div class="_3dface _3dface--front fontStyle">hx0002</div>
      <div class="_3dface _3dface--top"></div>
      <div class="_3dface _3dface--bottom"></div>
      <div class="_3dface _3dface--left"></div>
      <div class="_3dface _3dface--right"></div>
      <div class="_3dface _3dface--back"></div>
    </div>
</div>
<div class="separator"></div>
<br><br>
<div style="text-align:center;clear:both">
</div>
</div>

</body>

</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值