0

I'm using bootstrap and if I use a fixed width and auto margins on container-fluid to center the content it looses the responsiveness.

Is there a way to avoid this? Or the responsive design means there is no fixed width?

HTML

<div class="container-fluid"></div>

CSS

.container-fluid {
    width: 960px;
    margin: 0px auto;
}

3 Answers 3

1

Twitter Bootstrap already have a class to do what you want and his name is "container" he uses fixed widths, but that width is different using media queries rules so it became smaller as the screen get smaller, and when less then 767px that container is 100% of screen size.

Sign up to request clarification or add additional context in comments.

Comments

1

Basically, "fluid" and a fixed width are contradictory terms. But there are lots of options. For example, you could set a max-width and min-width instead of just a width. Or your could set a width in ems which still gives the layout some flexibility (especially when combined with % width columns).

Another option is to set your 960px width, but to change that width at different screen sizes with @media queries.

Comments

0

Try to add an id in the div and apply the changes there in order to respect the pre-configured container-fluid class

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.