I’m using bootstrap 2.0 from twitter and unsure how to make it responsive.
- How can I remove elements when in mobile/small screen mode?
- How can I replace elements (i.e replace a big picture with a smaller one)?
- Change a
<h2>to be<h5>? etc.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Hiding Elements
You can hide elements with:
Hopefully you’re using LESS or SASS so you can just specify:
And then easily mix it in when necessary:
Just apply them to any selector in the relevant media query. Also, understand that media queries cascade onto smaller media queries. If you hide an element in a wide media query (tablet sized), then the element will remain hidden as the website shrinks.
Replacing Images
Bootstrap doesn’t offer image resizing as the screen shrinks, but you can manually change the dimensions of images with CSS in media queries.
But a particular solution I like is from this blog post: http://unstoppablerobotninja.com/entry/fluid-images/
Now images will only appear in their full dimensions if they don’t exceed their parent container, but they’ll shrink fluidly as their parent element (like the
<div>they’re in) shrinks.Here’s a demo: http://unstoppablerobotninja.com/demos/resize/
To actually replace images, you could swap the background image with CSS. If
.logohasbackground: url("logo.png");, then you can just specify a new background image in a media query with.logo { background: url("small-logo.png");Change h2 to h5
If this is because you want to change the size of the heading, don’t do this. H2 has semantic value: It’s not as important as H1 and more important than H3.
Instead, just specify new sizes for your h1-h6 elements in media queries as your website gets smaller.