Link to home
Start Free TrialLog in
Avatar of FreddyBass
FreddyBass

asked on

Responsive web design code for mobile devices

I have a webpage that I am creating and am trying to find the proper code for having it display properly on any device.  So that the page will be responsive based on what the screen size it is trying to display on.  Any direction would be greatly appreciated
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of FreddyBass
FreddyBass

ASKER

Thank you for your input Scott, it was not exactly what I was looking for but it gave me some info to get going in the right direction.  Thank you for taking the time to give me your suggestions.
What is it you are looking for?  The core of making a responsive site will be using media queries where you define a class for multiple screens.  You can spend a lot of time doing this from scratch.... or you can use bootstrap or foundation or even 960.gs.  These libraries are not meant to be your template, they just make it easier by not having to reinvent the wheel.


https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries
<!-- CSS media query within a style sheet -->
.container{width:100%;}
@media (max-width: 700px) {
  .left_side {
    width: 100%;
  }
  .right_side {
    width: 100%;
  }
}

@media (min-width: 701px) {
  .left_side {
    width: 30%;
  }
  .right_side {
    width: 70%;
  }
}
<div class="container"
<div class="left_side">I will be full width if the viewport is 700px or below and 30% width if the viewport is 701px or more</div>
</div class="right_side">I will be full width if the viewport is 700px or below and 70% width if the viewport is 701px or more</div>
</div>

Open in new window