What do I need to target to change the opacity for Bootstrap 4? I found that I need to target this to affect its background, but when I add opacity:1 to tooltip-inner or tooltip, it does nothing:
.tooltip .tooltip-inner {
background-color: #014379;
}
.tooltip .arrow:before {
border-top-color: #014379;
}
What do I need to do to change it?
Thanks!
You can change the opacity of tooltip like this
.tooltip.show {
opacity: 0.5;
}
If you've tried tried this code
.tooltip.show /* The CSS classes that the tooltip has */ {
opacity: 0.5; /* or whatever */
}
Then try to add !important, so that you can be sure that your style will be applied
opacity: 0.5 !important;
If it still doesn't work, feel free to tell me.
Opacity has a value between 0 and 1. 1 being nothing changed at all and 0 being invicible.
.tooltip .tooltip-inner {
background-color: #014379;
opacity: 0.5;
}
.tooltip .arrow:before {
border-top-color: #014379;
}
<html lang="en">
<head>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">
Tooltip on bottom
</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
</body>
</html>
If you want to change the background color opacity, you could use rgba()
though it will not work with HEX colors unless you use SCSS
that means if you want this solution you will need to find a color that looks like #014379 but with rgb()
RGBA Example:
/*Instead of
background-color: #014379;
*/
background-color:rgba(XXX,XXX,XXX,0.5)
SCSS Example:
SCSS Variable:
$color-tertiary: #607D8B;
Change Opacity:
background-color: rgba($color-tertiary, 0.5);
How can I add styling to the Kendo UI Alert, like the background of the title and button? I can set the content's background color by adding a background-color style to the div. Just not sure how to go about doing that with the Title and the button
$(document).ready(function() {
$('#btn').on('click', function() {
myalert("I'm an Alert");
})
});
function myalert(content) {
$("<div></div>").kendoAlert({
title: "My Title",
content: content
}).data("kendoAlert").open();
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.117/styles/kendo.common.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.117/styles/kendo.rtl.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.117/styles/kendo.default.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.117/styles/kendo.mobile.all.min.css">
<script src="https://kendo.cdn.telerik.com/2018.1.117/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.1.117/js/kendo.all.min.js"></script>
<div class="container">
<div class="form-horizontal">
<div class="row">
<div class="col-md-12">
<button id="btn" class="btn btn-primary">Click Me</button>
</div>
</div>
</div>
</div>
If you inspect the alert dialog in your browser developer tools, you can see the classes used and then override the css.
e.g.
.k-dialog.k-alert .k-dialog-titlebar {
background-color: #333;
color: #eee;
}
.k-dialog.k-alert .k-button {
background-color: #333;
color: #eee;
}
DEMO
/*This is for the overall look of the page, what font and the repeated background image*/
body {
background-image: url("../Assets/crossword.png");
font-family: Rockwell, "Courier New", Georgia, 'Times New Roman', serif;
}
/*This is just to get the main content of the page centered*/
#mainBody {
width: 80%;
margin: auto;
margin-top: 10px;
}
.navbar-custom {
background-color: none;
}
<!DOCTYPE html>
<html>
<head>
<!-- This is the title of the first page -->
<title></title>
<meta charset="utf-8" />
<!-- This is the viewport settings for bootstrap -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- These are the javascript, CSS, and jquery file scripts -->
<script src="Scripts/jquery-1.9.1.min.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
<link href="Content/bootstrap.min.css" rel="stylesheet" />
<link href="Content/MyStyleSheet.css" rel="stylesheet" />
</head>
<body>
<div id="mainBody">
<nav class="navbar navbar-inverse navbar-custom">
</nav>
</div>
</body>
</html>
Not sure why I am having so much trouble with this nav bar. Trying bootstrap because its supposed to make things easier..
But I can change the color of navbar background to say blue. But if I give the background color none. it does nothing.
I have tried marking it important, I seen suggestions to make it navbar-default and can't get it to work. I just want to background to be transparent and not have anything in it.
none is not a color, so you can't use it as the background color. You can use transparent instead.
Another problem you have is the navbar-inverse class in your <nav> element, and it will get higher precedence.
You can use .navbar-custom.navbar-inverse to fix this:
/*This is for the overall look of the page, what font and the repeated background image*/
body {
background-image: url("../Assets/crossword.png");
font-family: Rockwell, "Courier New", Georgia, 'Times New Roman', serif;
}
/*This is just to get the main content of the page centered*/
#mainBody {
width: 80%;
margin: auto;
margin-top: 10px;
}
.navbar-custom.navbar-inverse {
background-color: transparent;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div id="mainBody">
<nav class="navbar navbar-inverse navbar-custom">
</nav>
</div>
For transparent background you need:
.navbar-custom {
background-color: transparent;
}
This question already has answers here:
Styling a tooltip (popper.js / bootstrap v4 beta)
(2 answers)
Closed 5 years ago.
Am using Bootstrap '4.0.0-alpha.6' and Im trying to update tooltip styles to customize it. Right now, Im using Bootstrap 4 and also, I added some custom css class also. But it is not responding as per my custom style while mouse hover.
HTML
<span data-toggle="tooltip" data-placement="top" title="Testing tooltip with custom style" class="red-tooltip" (click)="nodeion(node)">
some text
</span>
CSS
.red-tooltip + .tooltip-top > .tooltip-inner {
background-color: #f00;
padding: 10px;
font-size: 14px;
}
but, after this update, it is reflected as per the change, it is stil showing default style of bootstrap.
Any help, please?
// Initialize tooltip component
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
// Initialize popover component
$(function () {
$('[data-toggle="popover"]').popover()
})
.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;background-color:#f2f2f2 !important;border-radius:.25rem}
<title>My Example</title>
<!-- Latest compiled and minified Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<style>
body {
padding-top: 1em;
}
</style> <div class="container-fluid">
<p style="margin:40px;">Check out my <a target="_blank" href="https://www.quackit.com/css/grid/tutorial/" data-toggle="tooltip" data-placement="top" title="Build advanced layouts easily with CSS!">Grid tutorial</a>, as you never know when you might need it!</p>
</div>
<span data-toggle="tooltip" class="red-tooltip" data-placement="top" title="Testing tooltip with custom style" class="red-tooltip" (click)="nodeion(node)">some text</span>
<!-- jQuery library -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<!-- Popper -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<!-- Latest compiled and minified Bootstrap JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
You need the general sibling ~ selector here, since the generated tooltip element isn't a direct sibling + of your .red-tooltip:
.red-tooltip ~ .tooltip > .tooltip-inner
In SCSS it would be:
.red-tooltip {
&~.tooltip {
&>.tooltip-inner {
/* your custom styles */
}
}
}
See this working example:
$(function() {
$('[data-toggle="tooltip"]').tooltip()
})
body {
padding: 5em;
}
.red-tooltip ~ .tooltip > .tooltip-inner {
background-color: #f00;
padding: 10px;
font-size: 14px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<span data-toggle="tooltip" data-placement="top" title="Testing tooltip with custom style" class="red-tooltip" (click)="nodeion(node)">some text</span>
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I am really stuck on a small issue im having on my website.
Whenever i add a viewport to my HTML , it creates a scroll bar even though theres no content that is overflowing.
I am using Bootstrap as the CSS framework.
body {
/* Location of the image */
background-image: url(http://www.haristechnology.com/images/footer_lodyas.png);
/* Background image is centered vertically and horizontally at all times */
background-position: center center;
/* Background image doesn't tile */
background-repeat: no-repeat;
/* Background image is fixed in the viewport so that it doesn't move when
the content's height is greater than the image's height */
background-attachment: fixed;
/* This is what makes the background image rescale based
on the container's size */
background-size: cover;
/* Set a background color that will be displayed
while the background image is loading */
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
.navbar-default .navbar-brand {
color: rgba(255, 255, 255, 1);
}
.navbar-default {
font-size: 26px;
background-color: rgba(0, 0, 0, 1);
border-width: 0px;
border-radius: 0px;
}
.navbar-default .navbar-nav>li>a {
color: rgba(255, 255, 255, 1);
background-color: rgba(0, 0, 0, 1);
}
.navbar-default .navbar-nav>li>a:hover,
.navbar-default .navbar-nav>li>a:focus {
color: rgba(255, 255, 255, 1);
background-color: rgba(12, 245, 229, 0.59);
}
.navbar-default .navbar-nav>.active>a,
.navbar-default .navbar-nav>.active>a:hover,
.navbar-default .navbar-nav>.active>a:focus {
color: rgba(20, 250, 39, 1);
background-color: rgba(0, 0, 0, 1);
}
.navbar-default .navbar-toggle {
border-color: #000000;
}
.navbar-default .navbar-toggle:hover,
#nav.navbar-default .navbar-toggle:focus {
background-color: #000000;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #000000;
}
.navbar-default .navbar-toggle:hover .icon-bar,
.navbar-default .navbar-toggle:focus .icon-bar {
background-color: #000000;
}
.custom{
margin-top:15%;
}
this is the HTML
<head>
<meta charset="UTF-8">
<title> HarisTechnology</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/animate.css">
<link href='http://fonts.googleapis.com/css?family=Muli' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link href="//www.google-analytics.com" rel="dns-prefetch">
<link href="http://haristechnology.com/wp-content/themes/html5blank-stable/img/icons/favicon.ico" rel="shortcut icon">
<link href="http://haristechnology.com/wp-content/themes/html5blank-stable/img/icons/touch.png" rel="apple-touch-icon-precomposed">
<meta name="description" content="HarisTechnology – Website">
<script type="text/javascript">
window._wpemojiSettings = {"baseUrl":"http:\/\/s.w.org\/images\/core\/emoji\/72x72\/","ext":".png","source":{"concatemoji":"http:\/\/haristechnology.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.2.2"}};
!function(a,b,c){function d(a){var c=b.createElement("canvas"),d=c.getContext&&c.getContext("2d");return d&&d.fillText?(d.textBaseline="top",d.font="600 32px Arial","flag"===a?(d.fillText(String.fromCharCode(55356,56812,55356,56807),0,0),c.toDataURL().length>3e3):(d.fillText(String.fromCharCode(55357,56835),0,0),0!==d.getImageData(16,16,1,1).data[0])):!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g;c.supports={simple:d("simple"),flag:d("flag")},c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.simple&&c.supports.flag||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
</script>
<style type="text/css">
img.wp-smiley,
img.emoji {
display: inline !important;
border: none !important;
box-shadow: none !important;
height: 1em !important;
width: 1em !important;
margin: 0 .07em !important;
vertical-align: -0.1em !important;
background: none !important;
padding: 0 !important;
}
</style>
<link rel='stylesheet' id='mcafeesecure_css-css' href='http://haristechnology.com/wp-content/plugins/mcafee-secure/assets/common.css?ver=1.0' media='' />
<link rel='stylesheet' id='normalize-css' href='http://haristechnology.com/wp-content/themes/html5blank-stable/normalize.css?ver=1.0' media='all' />
<link rel='stylesheet' id='html5blank-css' href='http://haristechnology.com/wp-content/themes/html5blank-stable/style.css?ver=1.0' media='all' />
<script type='text/javascript' src='http://haristechnology.com/wp-includes/js/jquery/jquery.js?ver=1.11.2'></script>
<script type='text/javascript' src='http://haristechnology.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
<script type='text/javascript' src='http://haristechnology.com/wp-content/plugins/mcafee-secure/assets/common.js?ver=1.0'></script>
<script type='text/javascript' src='http://haristechnology.com/wp-content/themes/html5blank-stable/js/lib/conditionizr-4.3.0.min.js?ver=4.3.0'></script>
<script type='text/javascript' src='http://haristechnology.com/wp-content/themes/html5blank-stable/js/lib/modernizr-2.7.1.min.js?ver=2.7.1'></script>
<script type='text/javascript' src='http://haristechnology.com/wp-content/themes/html5blank-stable/js/scripts.js?ver=1.0.0'></script>
<link rel="shortcut icon" href="http://haristechnology.com/wp-content/uploads/2015/05/favicon.ico"/>
<style type="text/css">
.screen-reader-response {
display: none;
}
</style>
<script>
conditionizr.config({
assets: 'http://haristechnology.com/wp-content/themes/html5blank-stable',
tests: {}
});
</script>
</head>
<body class="home page page-id-34 page-template-default logged-in index">
<div class="container">
<div class="col-md-12">
<div class="row">
<div style="background-color:transparent;border:0px;border-radius:0;margin-top:-1%;width:100%; height:25%;"class="well">
<!--Navigation Starts -->
<div style="margin-top:1%;"id='nav'>
<img class="animated bounceInUp" src="images/banner.png" style="width:100%;" />
<br>
<br>
<nav class="navbar navbar-default animated fadeIn" role="navigation">
<div class="navbar-header">
<button type="button" style="background-color:#FF1919 !important;" class="navbar-toggle" data-toggle="collapse"
data-target="#example-navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://www.haristechnology.com/">HarisTechnology</a>
</div>
<div class="collapse navbar-collapse" id="example-navbar-collapse">
<ul id="menu-default" class="nav navbar-nav"><li id="menu-item-36" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-34 current_page_item menu-item-36 active"><a title="Home" href="http://haristechnology.com/">Home</a></li>
<li id="menu-item-41" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-41"><a title="Products" href="http://haristechnology.com/productspage">Products</a></li>
<li id="menu-item-42" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-42"><a title="Contact" href="http://haristechnology.com/contact-2">Contact</a></li>
</ul> </div>
</div>
</nav>
<!--Navigation ENDS -->
<!--Content Starts -->
<!-- /header -->
<div class="jumbotron" style="margin-left: 0%; border-radius: 0; margin-top: 0%; width: 100%;">
<h1>Hello</h1>
</div>
<div style="background-color:#AAF200;margin-left:0%;border-radius:0;margin-top:0%;width:100%"class="jumbotron">
<center>
<h2>
Website under construction.
</h2>
</center>
</div>
<h3 class="pull-right" style="color:#cde2bd;">Developed by HarisTechnology.</h3>
<!--Footer ENDS -->
</div>
</div>
</div>
</div>
</body>
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="scripts/bootstrap.min.js"></script>
<script type="text/javascript">
(function() {
var sa = document.createElement('script'); sa.type = 'text/javascript'; sa.async = true;
sa.src = ('https:' == document.location.protocol ? 'https://cdn' : 'http://cdn') + '.ywxi.net/js/1.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sa, s);
})();
</script>
<script type='text/javascript' src='http://haristechnology.com/wp-content/plugins/contact-form-7/includes/js/jquery.form.min.js?ver=3.51.0-2014.06.20'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var _wpcf7 = {"loaderUrl":"http:\/\/haristechnology.com\/wp-content\/plugins\/contact-form-7\/images\/ajax-loader.gif","sending":"Sending ..."};
/* ]]> */
</script>
<script type='text/javascript' src='http://haristechnology.com/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=4.1.2'></script>
<script type='text/javascript' src='http://haristechnology.com/wp-content/plugins/bootstrap-for-contact-form-7/assets/scripts.min.js?ver=1.1.0'></script>
<!-- analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62813338-1', 'auto');
ga('send', 'pageview');
</script>
<script type="text/javascript">
(function() {
var sa = document.createElement('script'); sa.type = 'text/javascript'; sa.async = true;
sa.src = ('https:' == document.location.protocol ? 'https://cdn' : 'http://cdn') + '.ywxi.net/js/1.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sa, s);
})();
</script>
</html>
Any help would be greatly appreciated.
NOTE: This problem is only happening in Chrome so far and not Internet Explorer?
It's your div#nav. When you animate the logo up from the bottom, Chrome isn't calculating the height properly and you're getting a ton of overflow at the bottom of the document.
In your css for div#nav, add overflow: hidden; and your problem will go away.
I believe there is no viewport for the body and that is most likely causing the issue. Typically, a cover image is set for a div. I am not 100% sure thats it, but have you tried it without the background?
It's hard to guess based on what you've said, and without a fiddle; but it sounds like an issue with overflow. Have you tried just adding overflow:hidden, or overflow:visible, to your CSS?