How to Justify Text using text-align & text-justify CSS Properties
In a webpage, justification of text can be done with the text-align property. Spaces can further be adjusted with text-justify property.
Adding Hyphens to Text with the CSS hyphens Property
It is a common practice to break lines by introducing a hyphen character between a word. In web pages this is done with the CSS hyphens property.
Checking Element has Specific CSS Class with Vanilla Javascript
Similar to the jQuery's hasClass method, there exists a native Javascript alternative that tells whether the DOM element contains the specified CSS class or not.
Indent Text with CSS text-indent Property
Many times you would like to leave empty spaces before the starting line of a paragraph. This can be done with the text-indent CSS property which defines the length of the white space appearing before the first line.
Adding & Removing CSS Classes With Vanilla Javascript
jQuery's addClass & removeClass makes it very simple to add and remove CSS classes. But it is equally straightforward with native Javascript also.
Golden Rules for Typography on the Web (VIDEO)
Good typography does not improve speed or understanding, but leads to greater engagement in reading. This video presented at CSS Day brings out some general guidelines for typography on websites.
jQuery append() in Pure Javascript
jQuery's append() method can add a DOM element or a HTML string into a given DOM element. But the same can be done with natively available methods also.
Maintaining Aspect Ratios for HTML Videos with CSS
When rendering an image browers maintains its aspect ratio. But this does not happen in this case of video element. This can be done with a bit of CSS.
Understanding Event-Loop, Asynchronous, Single-Threaded in Javascript (VIDEO)
The Javascript event loop is the key to understanding terms such as "Asynchronous", "Single-Threaded", "Non-Blocking" etc. This is explained through a video presented at JSConf.
Types of Buttons in HTML Forms
Many times clicking on a simple button in a form will automatically submit the form. This is because of the "type" attribute of the button which works only inside a form.
Setting Spaces between Letters with CSS letter-spacing Property
The letter-spacing CSS property can be used to set spacing between individual characters or letters in words.
Adding Event Handlers on Dynamically Created Elements with Vanilla Javascript
In jQuery adding event handlers to dynamic elements is quite simple. But when you try to do the same thing with vanilla Javascript, it is not very direct.
Getting the 〈html〉Tag with Javascript
Although it may rarely happen, but sometimes you may need to access the 〈html〉element with Javascript. This can be done using 3 ways.
Smooth Scrolling with CSS
For modern browsers it is now possible to set smooth scrolling for a webpage with the CSS "scroll-behavior" property. No Javascript is required for smooth scrolling.
Showing Relative Time (1 day ago, 1 min ago, Yesterday etc) with Native Javascript
Showing relative time such as "1 day ago", "5 days ago" etc previously required external Javascript libraries such as Moment.js. But now browsers have added native support for this — you may not need external libraries.
Managing Spacing Between Words with CSS word-spacing Property
The CSS word-spacing property defines the width of white space between words in a block of text.
Styling First-Letters with CSS ::first-letter
Styling first letter in a block of text is a good way of increasing user attention span. It can be done with the ::first-letter CSS pseudo-element.
Creating Attractive First Lines with CSS ::first-line
When your copy content goes long, it is a good idea to make it visually attractive. The CSS pseudo-element ::first-line can be used to style the first line appearing within an element.
Selecting Sibling Elements with CSS
CSS provides the adjacent sibling combinator (+ character) and general sibling combinator (~ character), to select siblings of an element.
Selecting Child Elements with CSS
The child combinator represented by the greater-than character (>) select direct children of the parent element. The descendant combinator represented by a single-space character can be used to select children, grand-children, grand-grand-children also.