Solved

css @media doesnt work as needed

Posted on 2014-07-20
3
218 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
3 Comments
 
LVL 28

Accepted Solution

by:
chilternPC earned 500 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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

803 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