【问题标题】:css box with arrow and shadow带箭头和阴影的 css 框
【发布时间】:2014-04-15 08:32:12
【问题描述】:

我已经搜索了这个网站并尝试使用在其他帖子中找到的示例,但我仍然无法弄清楚如何让弹出框上的箭头产生阴影......

我在这里做了一个 jsfiddle:http://jsfiddle.net/4z9uV/3/

我的 CSS:

.notesdisplay3 {
  margin-top: 100px;
  margin-left: 100px;
  height: 50px;
  width: 175px;
  padding: 19px;
  margin-bottom: 20px;
  background-color: #f5f5f5;
  border: 1px solid #e3e3e3;
  -webkit-border-radius: 4px;
  border-radius: 4px;
  box-shadow: 0px 0px 5px #CCC;
  text-align: center;
  font-size: 16px; 
  font-weight: bold;
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);

}

.notesdisplay3:before { 
bottom: 100%; 
left: 50%; 
border: solid transparent; 
content: ""; 
height: 0; 
width: 0; 
position: absolute; 
border-color: rgba(255, 255, 255, 0); 
border-bottom-color: #f5f5f5; 
border-width: 20px; 
margin-left: -20px;
box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.05);

}

【问题讨论】:

    标签: html css


    【解决方案1】:

    嗯,实际上这是不可能的,因为你的三角形是一个阴影。

    但是!

    由于您的三角形有 90 度角,您可以使用带阴影的旋转正方形 :)

    我将带有阴影的旋转正方形放在:after 部分中,并将该部分隐藏在弹出框的顶部阴影中,我在:before 中使用了一个没有阴影的三角形(就像你在开始)。


    Fiddle

    .notesdisplay3:before {
      content: "";
      position: absolute;
      bottom: 100%;
      left: 50%;
      height: 0;
      width: 0;
      border: 28px solid transparent;
      border-bottom-color: #f5f5f5;
      margin-left: -28px;
    }
    
    .notesdisplay3:after {
      content: "";
      position: absolute;
      bottom: 100%;
      left: 50%;
      height: 40px;
      width: 40px;
      background-color: #f5f5f5;
      margin-left: -20px;
      margin-bottom: -20px;
      z-index: -1;
      box-shadow: 0 0 5px #CCC;
      -moz-transform: rotate(45deg);
      -webkit-transform: rotate(45deg);
      -o-transform: rotate(45deg);
      -ms-transform: rotate(45deg);
      transform: rotate(45deg);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-10
      • 1970-01-01
      相关资源
      最近更新 更多