阴影使图像弯曲

时间:2016-07-10 17:38:33

标签: html css css3

请参考图片。 如图所示,我想通过给它阴影垂直弯曲图像。 尝试了很多,但无法得到它。

node.js

请参考我想通过阴影垂直弯曲的图像。请解释我的逻辑。image vetically bend through shadow

3 个答案:

答案 0 :(得分:0)

只需使用框阴影上的perspective property

这是附加CSS的一个例子:

.main:after{
    content: '';
    position:absolute;
    z-index:-1;
    bottom:0px;
    width:50%;
    left:50%;
    margin-left:-47%;
    height:30px;
    box-shadow: 0 16px 30px -5px rgba(0, 0, 0, 1);
    -webkit-transform: perspective(800px) rotateY(0deg) rotateX(45deg);
    -moz-transform: perspective(800px) rotateY(0deg) rotateX(45deg);
    -ms-transform: perspective(800px) rotateY(0deg) rotateX(45deg);
    -o-transform: perspective(800px) rotateY(0deg) rotateX(45deg);
    transform: perspective(800px) rotateY(0deg) rotateX(45deg);
    margin-left:-62%;
    -webkit-transform: perspective(300px) rotateY(-40deg) rotateX(50deg);
    -moz-transform: perspective(300px) rotateY(-40deg) rotateX(50deg);
    transform: perspective(300px) rotateY(-40deg) rotateX(50deg);
}

我认为你的工作是适应它。

答案 1 :(得分:0)

div {
	width:400px;
	height:300px;
	background:#fff;
	margin:40px auto;
}
img { 
  display:block;
  width:400px;
  margin:0 auto;
}

.effect{ 
  position: relative;
  transform:rotate(90deg);
  top:-280px;
  left:-50px;
  z-index:-1
}
.effect:before
{
  z-index: -1;
  position: absolute;
  content: "";
  bottom: 15px;
  left: 10px;
  width: 50%;
  top: 80%;
  max-width:300px;
  background: #777;
  box-shadow: 0 15px 10px #777;
  transform: rotate(-3deg);
}
.effect2{ 
  position: relative;
  transform:rotate(90deg) scaleY(-1);;
  top:-620px;
  left:50px;
  z-index:-1;
  
}
.effect2:before
{
  z-index: -1;
  position: absolute;
  content: "";
  bottom: 15px;
  left: 10px;
  width: 50%;
  top: 80%;
  max-width:300px;
  background: #777;
  box-shadow: 0 15px 10px #777;
  transform: rotate(-3deg);
}
<img src="http://politic365.com/wp-content/blogs.dir/1/files/2012/02/laptop_beach_black_man-e1329324187523.jpg">
<div class="effect"></div>
<div class="effect2"></div>

答案 2 :(得分:0)

您需要在 CSS 中使用转换属性 rotate 值。

这是一个有效的JSFiddle供您审核。

&#13;
&#13;
$(document).ready(function() {
  $("p:nth-of-type(2)").css("font-weight", "bold");
});
&#13;
html {
  font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
  padding-top: 10px;
  margin: 20px;
}
h1 {
  color: #003F87;
}
a {
  color: #800000;
  text-decoration: none;
}
label {
  display: block;
  curser: pointer;
}
#button {
  background-color: #939393;
  color: #fff;
  border: 3px solid #003F87;
  border-radius: 5px;
  font-size: 20px;
}
#button:hover,
#button:active {
  background-color: #003F87;
  border-color: #939393;
  color: #fff;
}
.container {
  width: 920px;
  height: 250px;
  background: white;
}
.shadow {
  position: absolute;
}
.shadow:before,
.shadow:after {
  z-index: -1;
  position: absolute;
  content: "";
  bottom: 0;
  left: 15px;
  width: 200px;
  top: 12px;
  background: #939393;
  -webkit-box-shadow: -15px 7px 15px #939393;
  -moz-box-shadow: -15px 7px 15px #939393;
  box-shadow: -15px 7px 15px #939393;
  -webkit-transform: rotate(-3deg);
  -moz-transform: rotate(-3deg);
  transform: rotate(-3deg);
}
.shadow:after {
  -webkit-box-shadow: 15px 7px 15px #939393;
  -moz-box-shadow: 15px 7px 15px #939393;
  box-shadow: 15px 7px 15px #939393;
  -webkit-transform: rotate(3deg);
  -moz-transform: rotate(3deg);
  transform: rotate(3deg);
  right: 15px;
  left: auto;
}
.wrapper {
  position: absolute;
  width: 900px;
  padding: 10px;
  height: 650px;
  z-index: 2;
  background-color: #fff;
  background-image: url('http://www.pd4pic.com/images/business-man-man-tie-suit-business-silhouette-1.png'), url('http://www.detaildesignonline.com/contentimages/sky1285264350.jpg');
  background-size: 30% 90%, 100% 100%;
  background-repeat: no-repeat, no-repeat;
  background-position: bottom right, center;
}
.content {
  width: 800px;
  margin: 0 auto;
  margin-top: 20px;
  padding-top: 10px;
  height: 500px;
}
.top {
  width: 100%;
  height: 200px;
}
.primary,
.secondary {
  width: 350px;
  display: inline;
  height: 300px;
  padding-left: 50px;
  padding-top: 25px;
  line-height: 23px;
}
.primary {
  float: left;
  background-color: rgba(11, 181, 255, .3);
}
.secondary {
  float: right;
  background-color: rgba(255, 255, 255, .4);
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container shadow"></div>
<div class="wrapper">
  <div class="content">
    <div class="top">
      <h1>
        We've got all your Forex needs covered!
      </h1>
      <p>
        Presenting Forex@Click, an easy to use and secure portal that takes care of all
        <br>your Forex requirements, whether its tranferring of funds, buying of a Travel
        <br>Card, Travel Insurace or currency.
      </p>
      <p>
        <a href="#">What's More? </a> Customers having an account in any private or nationalized
        <br>bank are welcomed to enjoy our services.
      </p>
    </div>
    <br>
    <form name="register" method="post" action="/signin" novalidate="">
      <div class="primary">
        <h2>Sign In</h2>
        <div>
          <label for="email">E-Mail Id</label>
          <input name="email" id="email" type="text" required>
        </div>
        <div>
          <label for="password">Password</label>
          <input name="password" id="signin-password" type="text" required>
        </div>
        <div>
          <br>
          <button id="button">LOGIN</button>
        </div>
      </div>
    </form>
    <form name="register" method="post" action="/signup" novalidate="">
      <div class="secondary">
        <h2>Sign Up</h2>
        <div>
          <label for="signup-email">*E-Mail Id</label>
          <input name="signup-email" id="signup-email" type="text" required>
        </div>
        <div>
          <label for="signup-password">*Password</label>
          <input name="signup-password" id="signup-password" type="text" required>
        </div>
        <div>
          <label for="signup-password-confirm">*Re-Enter Password</label>
          <input name="signup-password-confirm" id="signup-password-confirm" type="text" required>
        </div>
        <br>
        <button id="button">SIGN UP</button>
      </div>
    </form>
  </div>
</div>
&#13;
&#13;
&#13;

相关问题