How do I vertically align text in a div?

The correct way to do this in modern browsers is to use Flexbox. See this answer for details. See below for some older ways that work in older browsers. Vertical Centering in CSShttp://www.jakpsatweb.cz/css/css-vertical-center-solution.html Article summary: For a CSS 2 browser, one can use display:table/display:table-cell to center content. A sample is also available at JSFiddle: Expand snippet … 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

Can I force a page break in HTML printing?

Add a CSS class called “pagebreak” (or “pb”), like so: Then add an empty DIV tag (or any block element that generates a box) where you want the page break. It won’t show up on the page, but will break up the page when printing. P.S. Perhaps this only applies when using -after (and also … Read more

Customize icon for “Add to home screen”

I want to specify the icon that shows in the home screen. How can i do that? You can use <link rel=”apple-touch-icon” sizes=”128×128″ href=”niceicon.png”> (yes, even for Android device). Please check iOS document for detail information on Apple devices. Please note you can even define icon for the entire website. Please check Android document for … Read more