Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

css @media doesnt work as needed

Posted on 2014-07-20
3
Medium Priority
?
240 Views
Last Modified: 2014-07-20
.slider-container{
	 height:760px;
	 background-image:url(../imgs/slider.jpg); 
	 position:relative;
}

@media (min-width: 1629px) {
	.slider-container{
	height:100px;
	background-image:none;
	background-color: #ff0000;
	position:relative;
	}
}

Open in new window



Im using this css to change the div content on smaller screens (from an image to a solid bg color)
The website always looks the same on both the mac and the iphone.

If I go above min-width: 1300px I get the red solid background color anything below that displays the image.
The issue is the same thing happens on all size devices just the same...
0
Comment
Question by:zahimezher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 29

Accepted Solution

by:
chilternPC earned 2000 total points
ID: 40207376
I would put the word screen after media.
also try a max-width instead of a min-width .

and try this version....


.slider-container{
       height:760px;
       background-image:url(../imgs/slider.jpg);
       position:relative;
}

@media  screen and (max-device-width: 800px)

 {
      
      .slider-container{
      height:100px;
      background-image:none;
      background-color: #ff0000;
      position:relative;
      }
}
0
 
LVL 58

Expert Comment

by:Gary
ID: 40207403
Are you sure you don't have any other css in there.
Can you link to the page or make a test page at jsfiddle.net
0
 
LVL 1

Author Closing Comment

by:zahimezher
ID: 40207412
Brilliant! :D Thank you so much.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question