html - 带有箭头和边框的仅 CSS 工具提示

标签 html css css-shapes

样式

.Tooltip {
    position: absolute;
    z-index:999;
    width:200px;
    height:57px;
    padding:20px;
    font-family: "Comic Sans MS", cursive;
    font-weight:bold;
    font-size:14px;
    color:rgba(21,139,204,1);
    text-align:justify;
    border-radius:10px;
        -webkit-border-radius:10px;
        -moz-border-radius:10px;
    box-shadow: inset 0px 0px 5px 1px rgba(21,139,204,1);
        -webkit-box-shadow: inset 0px 0px 5px 1px rgba(21,139,204,1);
        -moz-box-shadow: inset 0px 0px 5px 1px rgba(21,139,204,1);
    background:#dbf3ff;
}
.Tooltip .ArrowWrap {
    position:absolute;
    margin-top:77px;
    margin-left:81px;
    height:18px;
    width:37px;
    overflow:hidden;
}
.Tooltip .ArrowWrap .ArrowInner {
    width:25px;
    height:25px;
    margin:-13px 0 0 6px;
    transform: rotate(45deg);
        -ms-transform: rotate(45deg); /* IE 9 */
        -webkit-transform: rotate(45deg); /* Chrome, Safari, Opera */
    box-shadow: inset 0px 0px 5px 1px rgba(21,139,204,1);
        -webkit-box-shadow: inset 0px 0px 5px 1px rgba(21,139,204,1);
        -moz-box-shadow: inset 0px 0px 5px 1px rgba(21,139,204,1);
    background:#dbf3ff;

}

JSFiddle Demo

enter image description here

解释

我希望我的工具提示箭头不是由工具提示边界引起的封闭三 Angular 形,而是像右图中显示的我编辑的 Photoshop 版本。

最佳答案

使用框阴影和伪元素的其他方法:

div{
    position:relative;
    width:200px;
    height:57px;
    padding:20px;
    border-radius:10px;
    background:#DBF3FF;
    box-shadow: inset 0px 0px 5px 1px rgba(21,139,204,1);
}
div:after{
    content:'';
    position:absolute;
    left:110px; bottom:-10px;
    width:20px; height:20px;
    background:inherit;
    transform:rotate(45deg);
    box-shadow: inset -5px -5px 5px -4px rgba(21,139,204,1);
}
<div></div>

附带说明:除非您对浏览器支持有非常特殊的需求,否则 box-shadows 不需要使用供应商前缀。和 border-radius .

关于html - 带有箭头和边框的仅 CSS 工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28178202/

相关文章:

css - 我想创建一个这样的翻转按钮

html - 如何在仅使用 css 创建的图像上制作边框

html - 六边形的响应网格

javascript - Iframe页面自动滚动到中间

javascript - 无法正确显示引导年历和日期选择器问题

javascript - 具有固定列和标题的纯 CSS/HTML/Javascript 2D 可滚动表格

jquery - Content Div 在 mobile responsive 中改为 Carousel

html - 用css绘制不规则形状(应该是响应式的)

javascript - Spring 表单标签复选框(表单 :checkbox) hidden field not sent to server?

javascript - 如何在 AngularJS 中以编程方式触发表单提交?