Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-15-2012, 02:04 PM   PM User | #1
joliett89
Regular Coder

 
Join Date: Jul 2011
Posts: 172
Thanks: 64
Thanked 2 Times in 2 Posts
joliett89 has a little shameless behaviour in the past
@media queries

Does something like this is suppose to work?

Code:
@media screen and (max-width: 1225px)

body {
	width: 980px; 
	margin: 0 auto;
}

@media screen and (min-width: 1226px)

body {
	
	width: 1226px; 
	margin: 0 auto; 
}
Two fixed website sizes depending on the screen size... It looks like it doesnt work...

Thank you.

Last edited by joliett89; 12-15-2012 at 02:12 PM..
joliett89 is offline   Reply With Quote
Old 12-15-2012, 03:22 PM   PM User | #2
tracknut
Regular Coder

 
Join Date: Aug 2006
Posts: 892
Thanks: 4
Thanked 206 Times in 205 Posts
tracknut is an unknown quantity at this point
You can, though your syntax is off:
Code:
@media only screen and (max-width: 1225px)
	{
	body {width:980px;margin:0 auto}
	}
@media screen and (min-width: 1226px)
	{
	body {width:1226px;margin:0 auto}
	}
I would do it slightly differently though:
Code:
body {width:1226px;margin:0 auto}
@media only screen and (max-width: 1225px)
	{
	body {width:980px}
	}
@media only screen and (max-width: 980px)
	{
	body {width:800px}
	}
I.e, set the body with in css for your largest view, then incrementally apply changes to the style(s) as the page gets smaller.

Dave
tracknut is offline   Reply With Quote
Users who have thanked tracknut for this post:
joliett89 (12-15-2012)
Old 12-15-2012, 04:24 PM   PM User | #3
joliett89
Regular Coder

 
Join Date: Jul 2011
Posts: 172
Thanks: 64
Thanked 2 Times in 2 Posts
joliett89 has a little shameless behaviour in the past
I figured out why it was not working. I forgot media query brackets { }.
joliett89 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:32 AM.


Advertisement
Log in to turn off these ads.