Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

media query for min-height

I want to write media query based on screen resolution. My screen resolution height is 768. I wrote media query for this as:

@media(min-height:768px) and (max-height:850px) {
   .video-contain{
     margin-top:110px;  
    }
}

My above media query is not working.margin-top is not set before. I wrote media query based for screen resolution but not browser height.

like image 738
user3386779 Avatar asked Feb 23 '17 05:02

user3386779


People also ask

Is there a media query for height?

The height media query's value is usually the width media query value divided by the screen's aspect ratio. The height media query is always equal to document. documentElement. clientHeight.

How do you write a height in media query?

Use a comma to specify two (or more) different rules: @media screen and (max-width: 995px), screen and (max-height: 700px) { ... } Commas are used to combine multiple media queries into a single rule.

How do I set media query between min and max?

Combining media query expressions Max-width and min-width can be used together to target a specific range of screen sizes. @media only screen and (max-width: 600px) and (min-width: 400px) {...} The query above will trigger only for screens that are 600-400px wide.

How do I remove height in media query?

Use height: auto in the media query. That's the default setting. It will overwrite the fixed height in your standard CSS. Save this answer.


1 Answers

Use:

@media screen and ( min-width: 850px ) and ( max-height: 768px )
{
   .video-contain{
     margin-top:110px;  
    }
}

NOTE: Always use max-width media queries to great effect.

like image 184
Aditya Male Avatar answered Sep 30 '22 05:09

Aditya Male