简体   繁体   English

CSS3工具提示背景

[英]CSS3 tooltip background

I have bootstrap on my website but I don't like the css on the tooltip, so I override him with Menu-cool CSS3 Tootips. 我的网站上有引导程序,但我不喜欢工具提示中的CSS,因此我使用菜单酷CSS3 Tootips覆盖了他。

The thing is in the background of the tooltip, I get a gray/transparent background that I don't want. 事情在工具提示的背景中,我得到了我不想要的灰色/透明背景。 I Have tried remove padding or some of the background properties within bootstrap and the override of my css with no success. 我曾尝试删除引导程序中的填充或某些背景属性以及对CSS的覆盖,但均未成功。

.tooltip
{
    width:200px;
    padding: 10px 20px;
    margin-top: 20px;
    margin-left: -85px;
    opacity: 0;
    visibility: hidden;
    z-index: 10;
    position: absolute;

    font-family: Arial;
    font-size: 12px;
    font-style: normal;

    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    -o-border-radius: 3px;
    border-radius: 3px;

    -webkit-box-shadow: 2px 2px 2px #999;
    -moz-box-shadow: 2px 2px 2px #999;
    box-shadow: 2px 2px 2px #999;

    -webkit-transition-property:opacity, margin-top, visibility, margin-left;
    -webkit-transition-duration:0.4s, 0.3s, 0.4s, 0.3s;
    -webkit-transition-timing-function: ease-in-out, ease-in-out, ease-in-out, ease-in-out;

    -moz-transition-property:opacity, margin-top, visibility, margin-left;
    -moz-transition-duration:0.4s, 0.3s, 0.4s, 0.3s;
    -moz-transition-timing-function: ease-in-out, ease-in-out, ease-in-out, ease-in-out;

    -o-transition-property:opacity, margin-top, visibility, margin-left;
    -o-transition-duration:0.4s, 0.3s, 0.4s, 0.3s;
    -o-transition-timing-function: ease-in-out, ease-in-out, ease-in-out, ease-in-out;

    transition-property:opacity, margin-top, visibility, margin-left;
    transition-duration:0.4s, 0.3s, 0.4s, 0.3s;
    transition-timing-function: ease-in-out, ease-in-out, ease-in-out, ease-in-out;
}
/*a.tooltip > span:hover,*/
.tooltip.in
{
    opacity: 1;
    text-decoration:none;
    visibility: visible;
    overflow: visible;
    margin-top:20px;
    display: inline;
    margin-left: -60px;
}

tooltip.top{

    width: 15px;
    height: 15px;
    margin-left: 20px;
    margin-top: -19px;

    display: block;
    position: absolute;

    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);

    -webkit-box-shadow: inset -1px 1px 0 #fff;
    -moz-box-shadow: inset 0 1px 0 #fff;
    -o-box-shadow: inset 0 1px 0 #fff;
    box-shadow: inset 0 1px 0 #fff;

    display: none;
}

.tooltip-inner  {
    color: #FFFFFF;

    background: #0033CC;
    background: -moz-linear-gradient(top, #0033CC 0%, #0099FF 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0033CC), color-stop(100%,#0099FF));
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0033CC', endColorstr='#0099FF',GradientType=0 );

    border: 1px solid #000000;
}

.tooltip-top {
    background: #0033CC;
    border-top: 1px solid #000000;
    border-right: 1px solid #000000;
}

Here is a Working Jsfiddle link . 这是一个有效的Jsfiddle链接 Notice that in the css, the tooltip properties are at the end, bootstrap.js and css are linked. 请注意,在CSS中,工具提示属性位于末尾,bootstrap.js和CSS链接在一起。

This is because box-shadow property in bootstrap is making this issue. 这是因为引导程序box-shadow属性导致了此问题。 You can override it by adding the below code to your custom CSS. 您可以通过将以下代码添加到自定义CSS中来覆盖它。

Working Demo 工作演示

CSS CSS

.tooltip {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}

You can override the bootstrap css with yours like this 您可以像这样用您的引导CSS覆盖

instead of bootstrap css write this 而不是引导CSS写这个

.tooltip
 {
  box-shadow:none;
  border:none;
  background-color:transparent;
 }

for complete tutorial custom tooltip tutorial visit here http://talkerscode.com/webtricks/create-simple-tooltip-using-css3.php 有关完整的教程自定义工具提示教程,请访问此处http://talkerscode.com/webtricks/create-simple-tooltip-using-css3.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM