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

Global

< 1 min read

Hide Browser Scrollbar

To hide scrollbar globally, go to Dashboard > Appearance > Customize > Custom CSS. To hide scrollbar on a spesific

Read more

Container

< 1 min read

Make Container Scrollable

Add this on the column’s custom CSS panel. Adjust the ‘max-height’ to your needs.

Read more

Troubleshoot

< 1 min read

How to Fix Custom Fields Not Showing in WordPress (Crash with ACF Plugin)

If custom field is not showing when ACF plugin is activated, go to Dashboard > Themes > Themes File Editor,

Read more

Popup

< 1 min read

How to Limit Popup Height

Use this CSS to limit the height of your popups. It also works on containers.

Read more

See How It Works

Create better websites, faster.

Download the Entire Library

Adaptative, neutrally designed components.

Customer Service

Focus Website

Today, December 7

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.