Yunan
Yunan

Reputation: 43

How to set @media (min-width) and (max-width) for both chrome and firefox

I want to set some CSS rules for tablet devices, to do so i tried so set these rules for screen between 769px and 991px. When i do :

@media (min-width: 769px) and (max-width: 991px) {
    .img-circle {
        width: 50%;
    }
}

It work with chrome but firefox don't and when i tried adding brackets :

@media ((min-width: 769px) and (max-width: 991px)) {
    .img-circle {
        width: 50%;
    }
}

It work with forefox but no more with chrome ! If you have an idea :) i can't figure it out

Regards

Upvotes: 3

Views: 33456

Answers (2)

Deepak Kumar
Deepak Kumar

Reputation: 355

Working all browser

.mm {
    background: cyan;
    width: 200px;
    line-height: 200px;
    font-weight: 700;
    text-align: center;
    font-size: 50px;
}


@media only screen and (min-width:768px) and (max-width:990px){
	.mm{
		background:red;	
	}
	
}
   

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<div class="mm">12</div>
</body>
</html>

Upvotes: 8

M0ns1f
M0ns1f

Reputation: 2725

Try changing your code to

    @media only screen /* adding only query */
    and (min-width: 769px) 
    and (max-width: 991px) {
        .img-circle {
            width: 50%;
        }
    }

and try forking with us in this repo CSS3 Media Queries Template

and for more info see this Responsive Web Design - Media Queries

Upvotes: 0

Related Questions