Categories
Css

Horizontally center a div within a div using CSS style

Sometimes we need to horizontally center a div that is within another div using CSS that make the inner element center horizontally. In that case, you don’t have to set the width to 50%. So, any width which is less than the containing div will work. Let’s see how to horizontally center a div. For […]

Categories
Css3

HTML5 placeholder color with CSS

Want to change the color of a placeholder of your input fields? Here is an example that helps you to change the color of a placeholder. Basically, there are three different implementations i.e. pseudo-elements, pseudo-classes, and nothing. WebKit, Blink (Safari, Google Chrome, Opera 15+) and Microsoft Edge are using a pseudo-element: ::-webkit-input-placeholder. Mozilla Firefox 4 […]

Categories
Css3

Truncate String with Ellipsis

Overflow with text is always a big issue in a website, especially in a programmatic environment. Use Ellipsis to truncate string. We can provide a solution by adding an CSS property overflow: hidden setting to the span, but you can see that the text looked unnaturally cut off. The way to make text overflow elegant […]

Categories
Css

Disable text selection highlighting using CSS rule

There is a CSS standard way by which you can disable the highlighting effect i.e. disable text selection when you select any text. This can be done using JavaScript but using CSS you can achieve this also. <style type=”text/css”> .disableselect { user-select: none; -ms-user-select: none; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; } </style> […]

Categories
Css3

5 CSS tricks for responsive design

Making a website rather than mobile view is easy but now a days you must have to build the view on mobile also. You need to know some CSS tricks. Here are some CSS tricks which will help you to maintain responsive design: Word wrap is necessary to forcefully break the text into new line […]