CSS Media Rule Based on Screen Sizes

1 year ago

< 1 min read

Posted by:

Focus

Subscribe to newsletter

By subscribing you agree to with our Privacy Policy.

Share

This is very helpful for limiting custom CSS to certain breakpoints. Usage examples are Scrollbar, Offset Slides and Offset Carousel Posts. Modify the breakpoints (the ones in px) to your needs.

Desktop & Tablet Only

@media only screen
and (min-device-width: 767px)
{

}



Mobile Only

@media only screen
and (max-device-width: 767px)
{

}



Example

/* WordPress Default Code Block Styling */
@media only screen
and (min-device-width: 767px)
{
.wp-block-code code {
	font-size: 17px}
}

@media only screen
and (max-device-width: 767px)
{
.wp-block-code code {
	font-size: 15px}
}

Read more

Video

< 1 min read

Elementor Custom Video Lightbox CSS

Add this code on Appearance Customize > Additional CSS :

Read more

Text Widget

2 min read

Perfecting WordPress Text Content Formatting

If you want to have slightly better but very satisfying content formatting for those who understand content formatting, use the

Read more

Media Carousel

< 1 min read

Media Carousel Random Order

Add this code in HTML widget to randomize the ‘Media Carousel’ order.

Read more

Effect

< 1 min read

Blur Effect CSS

Learn how this simple blur effect addition can transform your website’s visual appeal, creating a sleek and modern look that

Read more

See How It Works

Create better websites, faster.

Download the Entire Library

Adaptative, neutrally designed components.

Customer Service

Focus Website

Today, February 20

Hi, there 👋

How can I help you?

Start Chat with:

We use cookie to improve your experience on our site. By using our site you consent cookies.