Typography matters. While there are many ways to implement Drop Caps, it is possible to use Drop Caps in WordPress without using any plugin. Drop Caps is the larger initial letter effect at the beginning of a word, a chapter, or a paragraph. Without HTML markup, we can add Drop Caps effect in WordPress and even without touching the main CSS file. You can read our Typography related guides like How To Use Any Web Font From Own Hosted Library and Resources and Types of Fonts According to License, the last one has lot of linked articles which are quite helpful.
Drop Caps in WordPress Without Plugin?
Yes, with inline CSS using
::first-letter selector. First we should know about this first! We can use the following properties with ::first-letter, it actually works even with WebFont as we are creating kind of virtual
DOM in HTML5 as if we have wrapped; anyway here are what you can add :
- Font properties
- Font color properties
- Font background properties
- Margin properties
- Padding properties
- Border properties
- Font Text-decoration
So, 10 in one without any Plugin, huge chance of doing experiments without any compromise in page speed. What we will use actually falls inside the chapter of structural Pseudo Class and Pseudo Element Selector. Structural pseudo-class is a way to target elements based on the information in the CSS file (read css3). In CSS3 pseudo-classes works with the above to redefine. We are giving you one working example, which we are using right now :
This is what we have only used on our webpage with current design. Its a pain to edit the main CSS again, re-upload to CDN, auto-minification might fail, so, not bad to inject it in the comments field as script from backend. There are Themes, Theme Specific Plugins, Header and Footer Plugin in WordPress to help you to insert scripts. It is not that, you have to install a new Plugin, practically most of us uses such Plugin. If you do not use such Plugin, add/edit on main CSS or inject with
if_single WordPress conditional function.
This is Drop Caps in WordPress Without Plugin? F***king Easy!
Yeah, its easy, you can play a lot. If you do not change that
.entry-content matching with your theme’s div name, obviously it will not work. This code for Drop Caps in WordPress Without Plugin will work with Genesis Child Themes by default. You only need to adjust according to your Typography. That
:nth-of-type(1) ” matches an element
that is the 1st sibling of it’s type – means > First Letter of the First Paragraph of the Webpage. As we will change it to include inside our main CSS to force
Proxima Nova‘s a specific sleek style, checking our source code might not work in future. We provided the screenshot of an Article for you.