Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

page works but doesn't when using media query

I have a page that works with percentages by it self  using css. When I put that same css in the media query the 3rd colum drops down. I don't understand what's wrong. It's just an exercise.
index-02.html
index-04.html
0
designaire
Asked:
designaire
1 Solution
 
LZ1Commented:
In the media query, you'll have to specify margin-right:0 for your .col2.  It's still applying it from the css above.

Try this:
<!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>
<style>

body{font-family:Arial, Helvetica, sans-serif;font-size: 1em;}
#wrapper{width: 1024px;margin: 0 auto;background:#fff;}
.photo{width: 1024px;height: 187px;}
h1{padding: 25px;font-size: 2em;text-align: center}
#header{width: 1024px;background:#F93;height: 100px;}
.col1{width: 308px;padding: 10px;float: left;margin-right: 20px;background:#fff;height: 400px;}
.col2{width: 308px;padding: 10px;float: left;margin-right: 20px;background: #fff;height: 400px;}
.col3{width: 308px;padding: 10px;float: left;height: 400px;background:#fff;}
.footer{width: 1024px;background:#400000;clear:both;height: 20px;text-align: center;padding: 12px;display: block;color: #FFF;}

@media only screen and (max-width: 750px) and (min-width: 180px) {
	#wrapper{width: 85%;margin: 0 auto;}
	h1{padding: 25px;font-size: 2em;text-align: center}
	#header{width: 100%;background:#F93;height: 100px;}
	.photo{width: 100%;}
	.col1{width: 30%;padding: 1.02%;float: left;margin-right: 2%;background:#FFF;height: 100%;}
	.col2{width: 30%;padding: 1.02%;float: left;background: #FFF;height: 100%;margin-right:0;}
	.col3{width: 30%;padding: 1.02%;float: right;height: 100%;background:#fff;}
	.footer{width: 100%;background:#400000;clear:both;height: 20px;text-align: center;padding: 12px;display: block;color: #FFF;}
}

</style>
</head>

<body>
<div id="wrapper">
<div id="header" >
<h1>Header</h1>

</div>
<div class="photo"><img src="images/photo.jpg" width="100%"  alt="gf" /></div>


<div class="col1">
  <p>about how to handle their share of the $656 million prize.</p>
  <p>Tickets sold in Kansas, Illinois and Maryland matched all six numbers in   Friday's Mega Millions drawing. None of the winners had come forward as of   Sunday evening.</p>
  <p>Advisers say jackpot winners should take a &quot;cooling off&quot; period of three to   six months. During that time, they should avoid making any big decisions about   their investments or spending.</p>
  <p>&quot;People need time to adjust to this huge change in their lives,&quot; said Michael   Garrison, of Garrison Financial Inc., in Chatham, Mass. &quot;The fear is that people   get this lump sum and go crazy,&quot; he said.</p>
</div>
<div class="col2">
  <p>MILWAUKEE (AP) — President Barack Obama's administration launched a multi-pronged assault on Mitt Romney's values and foreign policy credentials Sunday, while a fresh set of prominent Republicans rallied behind the GOP front-runner as the odds-on nominee, further signs the general election is overtaking the primary season.</p>
  <p>A defiant Rick Santorum outlined plans to leave Wisconsin the day before the state's contest Tuesday, an indication that the conservative favorite may be in retreat, his chances to stop Romney rapidly dwindling.</p>
  <p>A defiant Rick Santorum outlined plans to leave Wisconsin the day before the state's contest Tuesday, an indication that the conservative favorite may be in retreat, his </p>
</div><div class="col3">
  <p>&quot;I think the chances are overwhelming that (Romney) will be our nominee,&quot; Senate Minority Leader Mitch McConnell said Sunday on CNN's &quot;State of the Union.&quot; ''It seems to me we're in the final phases of wrapping up this nomination. And most of the members of the Senate Republican conference are either supporting him, or they have the view that I do, that it's time to turn our attention to the fall campaign and begin to make the case against the president of the United States.&quot;</p>
  <p>Both Secretary of State Hillary Clinton and Vice President Joe Biden went after Romney Sunday, underscoring the belief inside Obama's Chicago re-election headquarters that Romney will — sooner than later — secure the right to face Obama </p>
</div>
<div class="footer"> footer
</div>
</div>
</body>
</html>

Open in new window

0
 
designaireAuthor Commented:
You're right, I forgot I didn't take that out. When you're learning something new you never know if you're making a stupid little mistake or totally off base. You're lucky, I wasn't going to give so many points but somehow in IE9 I couldn't change the slider! Thanks for your help
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now