Basic Requirement
- CSS I have provided below is not minified yet, you can minify online for better performance or if you are using Visual Studio Code, you can install Minify extension and minify the code or Install any of the plugins I listed on my remove unused CSS tutorials
- You have to write your own media Queries if needed. Watch the video below to learn more.
- For browser compatibility, head over to Autoprefixer CSS.
- Learn how to how to add CSS classes to an elementor's widget.
If you're following any of these tutorials, you will need Elementor advanced plan, if you haven't upgraded it yet, please use my Affiliate link, this commission comes at no additional cost to you but it will keep the website a little help and write more compressive tutorials for you.
Using ::before and ::after pseudo-elements is an excellent way to enhance the style of elements without the need for additional markup. If you’ve come across a visually appealing design, chances are it utilizes these pseudo-elements.
Now, you might be wondering if you can leverage these elements with the free version of the Elementor plugin.
The answer is yes, you can certainly use the free version without encountering any problems. However, for enhanced convenience and dealing with more complex tasks, upgrading to the Elementor Advanced plan is recommended. This is because the Advanced plan allows you to view the CSS, and also unlock custom CSS and code functionalities you’re writing in real-time, directly within the editor. This feature significantly streamlines the process, making it more efficient and productive.
In contrast, using the free version may take more time, and it might not be as productive compared to the Advanced plan. While there’s no pressure to opt for the Elementor Advanced plan, it’s essential to acknowledge the factual benefits it offers. Ultimately, the choice between the free and Advanced/ Pro plan depends on your individual needs and preferences.
The “Inline Font Icons” will render the icons as inline SVG without loading the Font-Awsome and the eicons libraries and its related CSS files and fonts. Learn More about the Inline Font Icons Experiment in details.
Elementor Nav Menu Broken: 6 Ways To Identify & Troubleshoot
Here are the 5 ways to troubleshoot and Fix the Nav Menu bug in Elementor
Change the color & Increase the width and height of the icon
But can you change the color,size of the icon itself?
Not out-of-the-box though but you can with little bit of css.Follow this guide to learn more -
- Click the Elementor button handle
- Then Go to Button's Advanced tab
- Under Advanced tab - Choose CSS Classes and provide a unique class name for styling. (btn-color-icon) this is the CSS class I choose.
/* Remove comments when you copy and paste*/
// The .btn-color-icon class is added to Elementor's button CSS classes.
// The .fa class represents font-awesome icons.
// The ::before or :before pseudo-elements are used to insert CSS or other content before and after elements.
// You can use custom properties for color instead of hex color.
.btn-color-icon .fa:before {
color: purple;
}
// If you have enabled the inline font icons experiment
.btn-color-icon .elementor-button {
fill: purple !important;
}
// Free tips: Adjust the width and height of the icon or SVG.
// Increasing the width and height may cause alignment issues, which can be fixed by adding align-items: center.
.btn-color-icon .elementor-button-content-wrapper {
align-items: center;
}
.btn-color-icon .elementor-button-icon svg {
// The default is 1em for width and height.To overwrite, we use the !important CSS rule.
height: 2em !important;
width: 2em !important;
}
Change the font family from Font-Awesome to Elementor icons
font-family
CSS property in the syntax.This is how it looks when you add Font-Awesome icon directly from icon libraries in the frontend editors.
/* Remove comments when you copy and paste*/
// This is the Code, Font-Awesome use it
// .btn-color-fa is the CSS class, we have added to Elementor's button CSS classes
// .fa-long-arrow-alt-right is the CSS class for calling font-awesome icons for font-awesome libraries.
// ::before or :before is the before and after pseudo-elements to insert CSS or anything to the elements.
.bt-color-fa .fa-long-arrow-alt-right:before {
content: "\f30b";
font-family: "Font Awesome 5 Free";
font-weight: 900;
color:#000;
}
Now to change the FA font family to Eicons, we have to change the syntax from font-family: "Font Awesome 5 Free";
to font-family: "Eicons";
/* Remove comments when you copy and paste*/
// This is the Code, Font-Awesome use it
// .btn-color-fa is the CSS class, we have added to Elementor's button CSS classes
// .fa-long-arrow-alt-right is the CSS class for calling font-awesome icons for font-awesome libraries.
// ::before or :before is the before and after pseudo-elements to insert CSS or anything to the elements.
.bt-color-fa .fa-long-arrow-alt-right:before {
content: '\e837';
font-family: Eicons;
font-weight: 400;
font-style: normal;
padding-left: 4px
}
Before
After
Hover effects on background-image
This CSS is inspired by Kevin Powell: YouTube Channel and from this post, I will demonstrate how to use it with the help of the Elementor Advanced plan.
This design can be useful for small touches, decoration, etc and you can see the demo and video below.
I highly recommend watching Kevin Powell’s video to fully understand the code.
To see the hover effects, you have to hover upon an image below.
The demo below is built with an Elementor HTML widget and you can copy and paste the HTML and CSS to your project, just make sure you change the path of the images
Nature
This design has missing elements on the live site, to get the full experience I highly recommend visiting the demo.
Container’s settings
Create a container
Create a container and give a custom CSS variable name as var(--_height).
We will cover this later.
Under items,
- Change the
direction from row-horizontal to column-vertical.
justify-content & align-items to center.
Container’s style
Provide a background-image
I use two brown deer beside trees and mountain from Unsplash as my background image.
Provide a variable name for the width
To scale the image when hovering we provide a custom variable to the width by clicking the pencil icon and provide a name as var(--_bg-size)
.
Provide custom CSS name to container, heading, and button
Layout
Provide CSS classes to the container, heading, and button under the advanced tab as:
- Container-
container-global container
. - Heading-
container-heading
- Button –
conainer-button
Custom CSS
Adjust the value, and style if needed.
/* Remove comments when you copy and paste*/
/* Global container styles and variables */
.container-global {
/* Sets a default transition duration and easing for animations */
--_transition: 350ms linear;
/* Sets a default background color */
--_bg: #fff;
/* Sets a default border value */
--_border-value: 5px;
/* Sets a default container width */
--_width: 450px;
/* Sets a default container height */
--_height: 640px;
}
/* Main container styles */
.container {
/* Positions the container and sets z-index for layering */
position: relative;
z-index: 1000;
/* Applies the transition to background size */
transition: background-size var(--_transition);
/* Hides overflow content */
overflow: hidden;
/* Sets max width and height using custom properties */
max-width: var(--_width);
height: var(--_height);
}
/* Creates pseudo-elements for the container's border effect */
.container::after,
.container::before {
/* Sets content, positioning, and dimensions for pseudo-elements */
content: '';
position: absolute;
height: 95%;
top: 2%;
width: 95%;
left: 2%;
right: 2%;
opacity: 1;
z-index: -1;
transition: transform var(--_transition);
z-index: 1;
/* Sets a custom property for border color */
--_border: var(--_bg);
}
/* Styles the 'before' pseudo-element */
.container::before {
/* Creates top and bottom borders */
border-top: var(--_border-value) solid var(--_border);
border-bottom: var(--_border-value) solid var(--_border);
/* Initially scales the element to zero width */
transform: scale(0, 1);
}
/* Styles the 'after' pseudo-element */
.container::after {
/* Creates left and right borders */
border-left: var(--_border-value) solid var(--_border);
border-right: var(--_border-value) solid var(--_border);
/* Initially scales the element to zero height */
transform: scale(1, 0);
}
/* Hover state for the container */
.container:hover::before {
/* Scales the 'before' pseudo-element on hover */
transform: scale(1.015, 1);
}
.container:hover::after {
/* Scales the 'after' pseudo-element on hover */
transform: scale(1, 1.015);
}
/* Styles for the container heading */
.container-heading .elementor-heading-title {
/* Positions the heading */
transform: translateY(calc(var(--_height) - 460px));
transition: transform var(--_transition);
}
.container:hover .elementor-heading-title {
/* Adjusts the heading position on hover */
transform: translateY(calc(var(--_height) - 520px));
}
/* Styles for the container button */
.container-button .elementor-button {
/* Initially hides the button */
opacity: 0;
pointer-events: none;
transform: translateY(calc(var(--_height) - 460px));
transition: transform var(--_transition), opacity var(--_transition) 80ms;
}
.container:hover .container-button .elementor-button {
/* Shows the button on hover */
pointer-events: auto;
transform: translateY(calc(var(--_height) - 520px));
z-index: 1000;
opacity: 1;
}
/* Sets a default background size */
.container {
--_bg-size: 100%;
}
/* Increases background size on hover */
.container:hover {
--_bg-size: 110%;
}
Elementor Pro: Portfolio - Custom label
- Head over to the Portfolio widget.
- Then click the Portfolio widget Advanced tab
- Under Advanced tab – Choose CSS id/ Classes (You prefer).
- You know the step after that
/* Remove comments when you copy and paste*/
.portfolio .elementor-portfolio__filters{
justify-content: end!Important;
position: relative;
align-items: center;
}
.portfolio .elementor-portfolio__filters::before{
content:'Category';
font-size: 1rem;
left:0;
position: absolute;
font-weight: 600;
}
- All
- Elementor Page Builder
- WordPress
10 Free and Pro Elementor templates that are easy to import on projects
Create an Elementor Sticky Header: A Comprehensive Guide Works in 2024
2 Easy ways to host and implement Google Noto Fonts locally
13 examples of Pseudo-Elements With Custom CSS with the help of Elementor Pro
5 Easiest Steps To Create Elementor Fixed Sidebar Header
3 Easy Steps to Fix The Horizontal Scroll On Mobile
As CSS Tooltip
A tooltip is often used to specify extra information about something when the user moves the mouse pointer over an element:
/* Remove comments when you copy and paste*/
.top .elementor-button {
position: relative;
}
.top .elementor-button:hover::after {
content: 'Surprise';
position: absolute;
display: inline-block;
background-color: Blue;
color: #000;
padding: 20px 60px;
/* Adjust as per your requirements */
margin: -108px -100px;
font-size: 1rem;
}
Sub-menu Triangle when hovering
When your mouse pointer hovers over to Official Elementor’s navigation menu on the official Elementor’s website we see a small triangle with white color.
If you want to achieve the same things, you can use the code below.
/* Remove comments when you copy and paste*/
.top .elementor-button:hover::before {
content: "";
position: absolute;
top: -15px;
left: 50%;
margin-left: -5px;
border-width: 8px;
border-style: solid;
border-color:
currentcolor transparent transparent transparent;
}
Animated Hover effect on Links
When you hover any link on my website or the menu after you click the Hamburger menu. You get nice hover effects or animated underline effects. You can experience the same thing on all my links too.
This can be done with simple CSS and you will get tutorials from specky boy.
I reuse the Kinsta hover effects on all my links
/* Remove comments when you copy and paste*/
// Your CSS class may vary but the process is all the same
// In this example, I am targeting only my single post template
// single-post-link is the parent container that wraps around all the content
// Change the Color Hex code to any color
:root {
--site-transition: 300ms ease-in-out;
--color: red;
}
.single-post-links a {
background-image:
linear-gradient(transparent calc(100% - 1px), var(--color) 1px);
color: var(--color);
background-position: 100%;
background-repeat: no-repeat;
position: relative;
text-decoration: none;
transition: background-size var(--site-transition);
background-size: 100% 100%;
}
// when hover
.single-post-links a:hover {
background-size: 0 100%;
}
Added Icons to Headings
Display Font-Awesome icons before & after the heading widget
Do you know you can add font awesome icons before and after using FontAwesome?
This example you’re seeing in the video is not entirely done with before and after pseudo-elements but you can achieve it pretty easily.
See the video below for the demonstration-
/* Remove comments when you copy and paste*/
// Before heading
// It will not work if you enabled inline font icons
// See the subheading for demo
.fa-icon .elementor-heading-title {
position: relative;
}
.fa-icon .elementor-heading-title::before {
content: '\f641';
font-family: "Font Awesome 5 Free";
font-weight: 900;
padding-right: 20px;
}
// After heading
.fa-icon .elementor-heading-title::after {
content: '\f641';
font-family: "Font Awesome 5 Free";
font-weight: 900;
padding-right: 20px;
}
Elementor icons or eicons to display before or after
Have fun with Elementor icons (eicons) too if you know the CSS.
/* Remove comments when you copy and paste*/
/* Before heading */
.icons .elementor-heading-title{
position: relative;
}
.icons .elementor-heading-title::before{
content:'\e801';
font-family: 'eicons';
padding-right:5px;
}
/* After heading*/
.icons .elementor-heading-title::after{
content:'\e801';
font-family: 'eicons';
padding-left:5px;
}
Added Icons to Post Title in WordPress
I wrote an article on Quora on how to add an icon to post a title in WordPress, it is well documented in my opinion. Go check the page on how to implement your projects.
As a Badge
Have you ever thought of using it as a badge like if there is a notification?
This is the question asked on Facebook today on how to do it, most of the answers were straight on the point. For starters, this can overwhelm you but if you follow this process you can do it but you will still need to adjust it though.
Follow the 4 steps to apply CSS classes and style to WordPress menu items
Now select the navigation menu items you want to add the badge and add CSS class (shown in the picture below).
Add a span class of “nav” or any preferred.
if you don’t want a screen reader to read like “Our Mission New” you can add “aria-hidden=”true” ” to the span itself to skip “New“.
Our Mission <span aria-hidden="true" class="nav">New</span>
Step 1: Select the Menu
When you choose the Nav Menu widget, you will see the unstyled version (in the picture below) first because we haven’t styled it yet but we will.
Step 2: Click the WordPress menu's handle and add the CSS class
We added this CSS class not to get conflict with other CSS classes or rules so it doesn’t get overwritten.
Step 3: Add Custom CSS to the WordPress menu custom CSS area
/* Remove comments when you copy & paste the code*/
// nav-menu is the CSS class we defined in Elementor CSS classes
// Nav is the CSS we define in Appearance - Menu
.nav-menu .elementor-item{
position: relative;
}
.nav-menu .elementor-item .nav{
position: absolute;
right:0;
top: -5px;
background-color: #000;
border-radius: 30px;
width: 45px;
font-size: .8rem;
text-transform: capitalize;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
Result
Step 4: Live badge
By using before and after pseudo-elements CSS we can add the live badge features and then we can animate with @keyframes CSS.
.live-badge::before{
content:'';
color: red;
position: absolute;
left:5px;
top:5px;
background: red;
border-radius: 50%;
width: 10px;
height: 10px;
}
To animate the red dot, we need to add keyframes. So we had over to Animista – CSS animations on Demand this is my favorite CSS animation site.
.live-badge::before{
content:'';
color: red;
position: absolute;
left:5px;
top:5px;
background: red;
border-radius: 50%;
width: 10px;
height: 10px;
/* We define the animation name as heart heartbeat*/
-webkit-animation: heartbeat 1.5s ease-in-out infinite both;
animation: heartbeat 1.5s ease-in-out infinite both;
}
/* ----------------------------------------------
* Generated by Animista on 2021-10-22 22:8:1
* Licensed under FreeBSD License.
* See https://animista.net/license for more info.
* Website: https://animista.net, t: @cssanimista
* ---------------------------------------------- */
/**
* ----------------------------------------
* animation heartbeat
* ----------------------------------------
*/
@-webkit-keyframes heartbeat {
from {
-webkit-transform: scale(1);
transform: scale(1);
-webkit-transform-origin: center center;
transform-origin: center center;
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
10% {
-webkit-transform: scale(0.91);
transform: scale(0.91);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
17% {
-webkit-transform: scale(0.98);
transform: scale(0.98);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
33% {
-webkit-transform: scale(0.87);
transform: scale(0.87);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
45% {
-webkit-transform: scale(1);
transform: scale(1);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
}
@keyframes heartbeat {
from {
-webkit-transform: scale(1);
transform: scale(1);
-webkit-transform-origin: center center;
transform-origin: center center;
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
10% {
-webkit-transform: scale(0.91);
transform: scale(0.91);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
17% {
-webkit-transform: scale(0.98);
transform: scale(0.98);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
33% {
-webkit-transform: scale(0.87);
transform: scale(0.87);
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
45% {
-webkit-transform: scale(1);
transform: scale(1);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
}
- If you’re facing a Layout shift issue on your navigation Sub-menu icon when you load the page. Follow my How to Fix the Submenu icon indicator delay? article.
- Navigation is broken when you update Elementor! Here is how to troubleshoot and fix the nav menu bug.
Hover effects
You can achieve amazing hover effects with before and after pseudo-elements. Here is the Codepen you can check out and it is created by me.
Partial Underline color effects to the heading tag
If you want to do the same thing to your headings, you can achieve the same things with before and after pseudo-elements or by using a linear gradient.
Step 1: Give A CSS class to heading widget
Step 2: Add CSS to the Custom CSS area
/* Remove comments when you copy & paste*/
/* Global Style */
:root {
--heading-color: #fbfbfb;
--underline-clr-bg: blue;
--font-weight: 800;
}
// Heading Style
// This CSS can look weird if you have long text
.partial_bg_heading .elementor-heading-title{
color: var(--heading-color);
font-weight: var(--font-weight);
background: linear-gradient(
to bottom,
transparent 60%,
var(--underline-clr-bg) 60%);
background-repeat: no-repeat;
}
If you’re using Unlimited Elements (UE) for Elementor, you can download and import my UE widgets file from my store for free.
If you have other examples and want to contribute, please consider using comments.
Thank you
Reference :