How do you keep parents of floated elements from collapsing? [duplicate]

Solution 1: The most reliable and unobtrusive method appears to be this: Demo: http://jsfiddle.net/SO_AMK/wXaEH/ HTML: <div class=”clearfix”> <div style=”float: left;”>Div 1</div> <div style=”float: left;”>Div 2</div> </div>​ CSS: .clearfix::after { content: ” “; display: block; height: 0; clear: both; } ​With a little CSS targeting, you don’t even need to add a class to the parent … Read more

What is a clearfix?

If you don’t need to support IE9 or lower, you can use flexbox freely, and don’t need to use floated layouts. It’s worth noting that today, the use of floated elements for layout is getting more and more discouraged with the use of better alternatives. display: inline-block – Better Flexbox – Best (but limited browser … Read more

Selecting and manipulating CSS pseudo-elements such as ::before and ::after using javascript (or jQuery)

You could also pass the content to the pseudo element with a data attribute and then use jQuery to manipulate that: In HTML: <span>foo</span> In jQuery: $(‘span’).hover(function(){ $(this).attr(‘data-content’,’bar’); }); In CSS: span:after { content: attr(data-content) ‘ any other text you may want’; } If you want to prevent the ‘other text’ from showing up, you … Read more

How can I make Bootstrap columns all the same height?

LATEST SOLUTION (2022) Solution 4 using Bootstrap 4 or 5 Bootstrap 4 and 5 use Flexbox by default, so there is no need for extra CSS. Demo <div class=”container”> <div class=”row “> <div class=”col-md-4″ style=”background-color: red”> some content </div> <div class=”col-md-4″ style=”background-color: yellow”> catz <img width=”100″ height=”100″ src=”https://placekitten.com/100/100/”> </div> <div class=”col-md-4″ style=”background-color: green”> some more … Read more

How to force the browser to reload cached CSS and JavaScript files

This solution is written in PHP, but it should be easily adapted to other languages. The original .htaccess regex can cause problems with files like json-1.3.js. The solution is to only rewrite if there are exactly 10 digits at the end. (Because 10 digits covers all timestamps from 9/9/2001 to 11/20/2286.) First, we use the … Read more

How to apply CSS to iframe?

Edit: This does not work cross domain unless the appropriate CORS header is set. There are two different things here: the style of the iframe block and the style of the page embedded in the iframe. You can set the style of the iframe block the usual way: <iframe name=”iframe1″ id=”iframe1″ src=”https://stackoverflow.com/questions/217776/empty.htm” frameborder=”0″ border=”0″ cellspacing=”0″ … Read more

What is the best way to conditionally apply a class?

If you don’t want to put CSS class names into Controller like I do, here is an old trick that I use since pre-v1 days. We can write an expression that evaluates directly to a class name selected, no custom directives are necessary: ng:class=”{true:’selected’, false:”}[$index==selectedIndex]” Please note the old syntax with colon. There is also … Read more

Can I hide the HTML5 number input’s spin box?

This CSS effectively hides the spin-button for webkit browsers (have tested it in Chrome 7.0.517.44 and Safari Version 5.0.2 (6533.18.5)): input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { /* display: none; <- Crashes Chrome on hover */ -webkit-appearance: none; margin: 0; /* <– Apparently some margin are still there even though it’s hidden */ } input[type=number] { -moz-appearance:textfield; /* Firefox … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)