Skip to content

Instantly share code, notes, and snippets.

@leechy
Created June 14, 2012 15:17
Show Gist options
  • Save leechy/2930927 to your computer and use it in GitHub Desktop.
Save leechy/2930927 to your computer and use it in GitHub Desktop.
Блок по центру экрана, с максимальной шириной и ограничением
/**
* Блок по центру экрана, с максимальной шириной и ограничением
*/
body {
margin: 0;
}
.b-content-with-limit {
max-width: 1600px;
margin: 0 auto;
}
.b-content-with-limit__margin {
padding-left: 200px;
}
.b-content-with-limit__content {
margin-right: -500px;
padding-right: 50%;
max-width: 100%;
}
/* вспомагательные стили */
.b-layout {
overflow: hidden;
min-width: 800px;
}
.b-content {
max-width: 1200px;
height: 100px;
margin: 0 auto 1em;
background: rgb(255, 200, 200);
}
.b-limit {
position: absolute;
top: 0;
left: 0;
width: 197px;
height: 300px;
border-right: 3px dashed red;
}
<div class="b-layout">
<div class="b-content">
<div style="float: left; color: black;">&laquo;</div>
<div style="float: right; color: black;">&raquo;</div>
</div>
<div class="b-content-with-limit">
<div class="b-content-with-limit__margin">
<div class="b-content-with-limit__content">
<div style="height: 100px; background: rgb(0, 127, 255);">
<div style="float: left; color: white;">&laquo;</div>
<div style="float: right; color: white;">&raquo;</div>
</div>
</div>
</div>
</div>
<div class="b-limit"></div>
</div>
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment