How to add a twitter-bootstrap icon as a CSS background-image?
Tags: css,twitter-bootstrap
Problem :
I have a css for hovering over tables to highlight the current row.
.cb_table-hover tbody tr:hover td,
.cb_table-hover tbody tr:hover th {
background-color: #cfcfcf;
}
Additionally I could like to add another line to the same CSS to show a twitter bootstrap icon within the background of the hovered table row.
<i class="icon-search"></i>
At first I was thinking to utilise a background-image:url('??');
but the icon can't be defined like that.
Any idea if that possible? Thanks
Solution :
Sure ! You cann't set background image with a image sprite
But you can put the icon inside td/th tag and use "display" to show/hide the icon:
.cb_table-hover tbody tr td .icon-search,
.cb_table-hover tbody tr th .icon-search{
display: none;
}
.cb_table-hover tbody tr td:hover .icon-search,
.cb_table-hover tbody tr th:hover .icon-search{
display: inline-block;
}
CSS Howto..
just give an id for that div and use that id in ur stylesheet. for ex. <div id="Test"> ------ -------- </div> <style> #Test .yourclass { ---- ----- } </style> ...
The easiest way would be to create a <div> that uses your image as a background-image property. Then it would just be a matter of writing the number into that...
You would use word-break: break-all to achieve this. EXAMPLE HERE span { word-break: break-all; } ...
So instead of single line less comment // DO NOT EDIT THIS FILE use block css-style less comment /* DO NOT EDIT THIS FILE */ ...
Add class to each (here I use .tabs) divelement, it makes easy to loop over those div. Use use jquery each method to loop over all the div $('.liquid-slider .tabs').each(...
Simplify your content: <div id="container"> <img src="http://placekitten.com/200/50"> <img src="http://placekitten.com/300/100"> <img src="http://placekitten.com/250/75"> </div> Then ensure the container has the same width as the largest contained image, and apply margin:0 auto; to...
That's because you pass to css method an object containing property property. In this case it's better to pass two arguments to css method: function changeProperty(mine , property , value){...
The best answer would probably be: "There are some things about IE6 and IE7 that are pretty broken with no easy fixes. This appears to be one of them." Obviously...
The work you've posted looks really promising! Two things worth mentioning from my cursory look: There's nothing particularly 'wrong' with using pixel measurements. The only time this will potentially become...
For .container:after, change position: relative to position: absolute. Live, working example: .container { background: url("http://msue.anr.msu.edu/uploads/images/forest.jpg"); height: 400px; width: 100%; box-shadow: inset 0px -4px 14px 0px rgba(50, 50, 50, 0.71); background-size:...
col-push-* and col-pull-* can help you <div class="container"> <div class="row"> <div class="col-md-5 text-center animated wow fadeInRight col-md-push-7"> <div class="iphone1"> <img src="http://placehold.it/150x150" alt="" titl=""> </div> </div> <div class="col-md-7 animated wow...
Sounds like you append your popup div to the main html window, hence it behaves like position:fixed. If you want your popup to be, as you said, 'glued' to the...
You can do it http://jsfiddle.net/Mohamed_nabil/2efxE/ Just change the background with yours. .fb_iframe_widget iframe{ opacity: 0; } .fb_iframe_widget{ background: #00D6FF;/*Change this with your custom background*/ } ...
You can use an input tag instead of the prompt. Change the HTML just as in Dinesh's answer; <div id="bubble"></div> <div id="inp" style="display: none;"> <input type="text" id="ans"></input> <button id="subBtn">Submit</button> </div> <div...
Yes, it is possible. Position .box relative and the :after absolute. HTML: <div class="tooltip-wrapper" style="position: relative;"> <a href="https://twitter.com/jcubic" title="" rel="Twitter"> <img src="http://images.jcubic.pl/jcubic/profile-twitter.png" /> </a> <div class="tooltip" style="top:...
Add z-index for this nav icon. Update your CSS like below. #nav { position:absolute; left: 49%; top: 89%; z-index:2; } ...
You can use jQuery as follows <script> $(document).ready(function() { if($('#first').attr("style").indexOf("height") != -1) { alert("height is hardcoded"); } else { alert("height is not hardcoded"); } }); </script> ...
Server Sent Events Tutorial Server-Sent Events - One Way Messaging A server-sent event is when a web page automatically gets updates from a server. This was also possible before, but...
The way you calculate the percentages depends on how exactly want the transition to work. When you set @-webkit-keyframes anim_slides { 0% { opacity:0; } 6% { opacity:1; } 24%...
Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation semantics (the look and formatting) of a document written in a markup language. more info :...
There is an ability to polyfill the requested functionality among browsers not supporting ShadowDOM natively. This is to be achieved by using shim-shadowdom directive within style declaration: <style shim-shadowdom> #mine::shadow...
you have to have the containers on the left be floated and cleared left and the ones on the right be floated and cleared right. You can do this either...
Try putting width: auto; on the button. That should fix it in this case. ...
Your <div> is inheriting a font-size of 0 from .hi-icon. Remove that, and it shows below the circle.
.thumbnail { text-align: center; } That will center all the text in the div. If you want to center JUST the image and leave everything else left aligned, .thumbnail img...
There is an easy way to reach it. Just copy the <figure>...</figure> and append it after </figure>. And remember let the keyframes 0% seems like 100%. Maybe you can use...
I couldn't find a way to do what I wanted to do, so as suggested by @mikael-harsjo I just compile my LESS files server-side, and that's the way it should...
I have made some amendments to Tim4497's method. This method allows for any number of list items, and has the advantage of being a pure Javascript solution (no JQuery required!)...
Step 1: Convert you font to the uni format here. Step 2: Upload your new fonts to the folder of your web. Step 3: Use CSS @font-face. Manual here....
The jQuery UI Documentation has an example of a colorpicker with the slider widget. You should be able to grok it and adapt it for opacity. Here is a working...