Center a container horizontally and vertically (with responsive elements) - html

I'm trying to center a logo and menu list in the center of the page (keeping them side by side on desktop view) and stacked in mobile view. My problem is making them neatly stacked in mobile view. For some reason when it goes into mobile, all the items get pushed down. I'm also trying to having the social media links stay right at the bottom of the viewport at across all devices.
Here is my code:
https://jsfiddle.net/bp8epdbx/1/
HTML:
<div class = "container">
<div class="block" style="height: 600px;">
<div class="centered centered-mobile">
<img src="http://allprofitorganization.com/wp-content/uploads/2017/08/home-logo-delete.png" />
</div>
<div class="centered vertical-menu">
EVENTS
STORE
ARTISTS
</div>
</div>
<div id="manu-social" class="manu">
<div id="manu-social" class="manu"></div>
<ul id="manu-social-items" class="manu-items">
<li></li>
<li></li>
<li></li>
</ul>
</div>
</div>
CSS:
body {
background: #fff;
}
img{
width: 270px;
height: 100%;
}
.block {
text-align: center !important;
margin: 80px !important;
HEIGHT: 300px;
}
.block:before {
content: '\200B';
/* content: '';
margin-left: -0.25em; */
display: inline-block;
height: 100%;
vertical-align: middle;
}
.centered {
display: inline-block;
vertical-align: middle;
width: 300px;
margin: 15px;
}
.logo
{
float: left;
vertical-align: middle;
width: 300px;
margin: 15px;
}
.nav
{
float: right;
vertical-align: middle;
width: 300px;
margin: 15px;
}
.vertical-menu {
width: 85px;
}
.vertical-menu a {
font-size: 16px !important;
color: black;
display: block;
padding: 12px;
text-decoration: none;
font-family: "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;
}
.vertical-menu a:hover {
color: red !important;
}
.vertical-menu a.active {
background-color: #4CAF50;
color: white;
}
#manu-social {
padding: 20px 0;
}
#manu-social ul {
list-style: none;
text-align: center;
margin: 0;
padding: 10px 0;
}
#manu-social ul li {
display: inline-block;
position: relative;
}
#manu-social li a {
color: #D3D3D3;
margin: 0 10px;
}
#manu-social li a:hover {
color: red;
}
#manu-social li a::before {
content: "\f135";
display: inline-block;
padding: 0 5px;
font-family: FontAwesome;
font-size: 24px;
vertical-align: middle;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
#manu-social li a[href*="facebook.com/allprofitofficial"]::before {
content: "\f09a";
}
#manu-social li a[href*="twitter.com/realallprofit"]::before {
content: "\f099";
}
#manu-social li a[href*="instagram.com/allprofitofficial"]::before {
content: "\f16d";
}
a {
-webkit-transition: .15s all linear;
-moz-transition: .15s all linear;
-o-transition: .15s all linear;
transition: .15s all linear;
}
#media screen and (max-width: 960px) { /* whatever width you prefer */
.nav, .logo {
float:none;
position: static;
/* width: auto; -- may be helpful */
}
}
#media screen and (max-width: 720px) {
.nav {
/* display: none; —- remove the menu, perhaps */
}
}
#media print, screen and (max-width: 480px) {
.content, .menu {
/* more targetting -- usually margins and padding adjusting */
}
}

You can use flexbox to vertically and horizontally center the logo and nav on desktop and then just change the flex-direction for mobile to get them to stack.
.block {
display: flex;
justify-content: center;
align-items: center;
}
#media screen and (max-width: 480px) {
.block {
flex-direction: column;
}
}

You can create a fixed footer like this,
#footer {
position:fixed;
left:0px;
bottom:0px;
height:30px;
width:100%;
background:#999;
}
so apply this code to your social icons and they will always be at the bottom of the page if you only want them at the bottom of the page on mobile view then wrap it in a media query as for your other content once the footer is fixed just minus margin margin: - //whatever number looks right

Related

Responsive Nav Menu Using Flexbox

I was attempting to build a responsive nav using flexbox. When the screen is smaller than 744px, I wanted a toggle button to appear, the main nav to have a max-height of 0, and then on click, have the nav display in block. Fairly typical stuff.
However, I'm used to doing this just with floats and I'm running into several problems:
I don't understand how to drop the UL below the nav without pushing the nav logo and toggle up;
The UL with the LI doesn't seem to be responding to the max-height trick.
If anyone can provide some assistance or point me in the direction of tutorial that would be great.
* {
margin: 0;
padding: 0;
}
body {
font-family: 'open-sans', 'sans-serif';
font-size: 17px;
color: #444;
}
.navText {
font-size: 14px;
}
nav {
height: 100%;
width: 100%;
background-color: white;
}
.nav-fixedWidth {
//border: 1px solid;
min-height: 120px;
width: 960px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.mainNav {
list-style: none;
display: flex;
}
.mainNav li {
margin-right: 60px;
padding: 10px;
//border: 1px solid;
}
.mainNav li:nth-child(5){
margin-right: 10px;
}
.mainNav li a {
text-decoration: none;
color: #444;
display: block;
}
.mainNav li a:hover {
color: #9d9d9d;
}
.logo {
height: 60px;
width: 60px;
background-color: #ccc;
}
.toggle {
height: 60px;
width: 60px;
background-color: #ccc;
display: none;
}
#media screen and (max-width: 960px) {
.nav-fixedWidth
{
width: 95vw;
}
}
#media screen and (max-width: 744px) {
.nav-fixedWidth
{
flex-wrap:wrap;
}
.toggle
{
display: block;
}
}
<nav>
<div class="nav-fixedWidth">
<div class="logo"></div>
<div class="toggle"></div>
<ul class="mainNav">
<li class="navText">Webinars</li>
<li class="navText">e-Books</li>
<li class="navText">Blog</li>
<li class="navText">e-Course</li>
<li class="navText">Search</li>
</ul>
</div>
</nav>
I know this might be a bit late for your particular need, but you might want to take a look at this solution by Chris Coiyer
https://codepen.io/chriscoyier/pen/GJRXYE
html {
background: #666;
}
body {
width: 60%;
margin: 0 auto;
background: white;
}
.nav {
position: relative;
ul {
display: flex;
height: 3rem;
overflow: hidden;
flex-wrap: wrap;
list-style: none;
padding: 0;
width: 80%;
}
li {
a {
display: block;
padding: 1rem 0.5rem;
text-decoration: none;
white-space: nowrap;
}
}
&.open {
ul {
height: auto;
display: block;
}
}
}
.x {
position: absolute;
top: 0.75rem;
right: 0.75rem;
cursor: pointer;
}
This solution does require a small amount of JavaScript to toggle the menu.
Hope it helps :-)

Ignore parent divs width

I have had issues with modify a navigation bar for mobile. I want the navigation bar to ignore its parent div inner-wrapper width of 80% and use a full width of 100%.
The most logical solution I can think of is to set header: relative, width: 100% and header li to absolute with a width of 100%. However, this doesn't seem to work.
I want each navigation to have a full width of the screen rather than a full width of its parent wrapper.
.header {
background-color: #FFB6C1;
color: black;
overflow: hidden;
position: relative;
}
.inner-wrapper {
width: 80%;
margin: 0 auto;
margin-top: 30px;
margin-bottom: 20px;
}
.header h2 {
float: left;
font-family: 'Pacifico', sans-serif;
font-size: 30px;
}
.header h3 {
padding-top: 5px;
font-family: 'Petit Formal Script';
clear: both;
font-weight: 700;
}
.header span {
font-weight: bolder;
}
.header ul {
float: right;
margin-right: 10%
}
.header ul li {
list-style: none;
display: inline-block;
font-family: 'Podkova', sans-serif;
margin-right: 20px;
font-weight: bold;
}
/* Navigation Menu click for mobile */
.mobile-menu {
padding: 0;
margin: 0;
display: none;
}
/* Smartphones (portrait) ----------- */
#media only screen and (max-width: 414px) {
/* Styles */
/* Display flex to change the ordering of HTML elemtns*/
.inner-wrapper {
display: flex;
flex-direction: column;
margin-bottom: 0px;
}
.header-title {
order: 1;
}
.header-description {
order: 2;
}
.dropdown {
order: 3;
}
.header-li {
display: none;
position: absolute;
width: 100%;
}
.header ul {
float: none;
margin-right: 0%;
}
.mobile-menu {
padding: 0;
margin: 0;
display: initial;
cursor: pointer;
}
.header ul li {
width: 100%;
background-color: green;
padding-top: 20px;
}
.header {
position: relative;
width: 100%;
}
}
<!-- Header and Navigation -->
<div class="header">
<div class="inner-wrapper">
<h2 class="header-title">text</h2>
<div class="dropdown">
<div class="mobile-menu">
<p align="right">Menu</p>
</div>
<ul class="header-li">
<li>About me</li>
<li>Progress</li>
<li>Food</li>
<li>Contact</li>
</ul>
</div>
<h3 class="header-description">text</span></h3>
</div>
</div>
If you want the navigation to have full width of the screen use width: 100vw; on the child. That means 100% of the view width
Using viewport units seems initially like a good idea, though in this case it is not necessary and will be of no use as the header uses overflow: hidden.
Note, if you start using 100vw it can cause unwanted scrollbar and/or make the element behave in an unwanted way when its parent/body has scrollbar
As the header-li relates to the header (closest ancestor having a position other than static), simply use 100% and transform: translate to position it.
.header-li {
position: absolute;
left: 50%;
transform: translateX(-50%);
width: 100%;
background: lime;
}
Note, it below sample I colored it light gray so one see how it positions itself
Stack snippet
.header {
background-color: #FFB6C1;
color: black;
overflow: hidden;
position: relative;
}
.inner-wrapper {
width: 80%;
margin: 0 auto;
margin-top: 30px;
margin-bottom: 20px;
}
.header h2 {
float: left;
font-family: 'Pacifico', sans-serif;
font-size: 30px;
}
.header h3 {
padding-top: 5px;
font-family: 'Petit Formal Script';
clear: both;
font-weight: 700;
}
.header span {
font-weight: bolder;
}
.header ul {
float: right;
margin-right: 10%
}
.header ul li {
list-style: none;
display: inline-block;
font-family: 'Podkova', sans-serif;
margin-right: 20px;
font-weight: bold;
}
.header-li {
position: absolute;
left: 50%;
transform: translateX(-50%);
width: 100%;
background: lightgray;
}
/* Navigation Menu click for mobile */
.mobile-menu {
padding: 0;
margin: 0;
display: none;
}
/* Smartphones (portrait) ----------- */
#media only screen and (max-width: 414px) {
/* Styles */
/* Display flex to change the ordering of HTML elemtns*/
.inner-wrapper {
display: flex;
flex-direction: column;
margin-bottom: 0px;
}
.header-title {
order: 1;
}
.header-description {
order: 2;
}
.dropdown {
order: 3;
}
.header-li {
display: none;
position: absolute;
width: 100%;
}
.header ul {
float: none;
margin-right: 0%;
}
.mobile-menu {
padding: 0;
margin: 0;
display: initial;
cursor: pointer;
}
.header ul li {
width: 100%;
background-color: green;
padding-top: 20px;
}
.header {
position: relative;
width: 100%;
}
}
<!-- Header and Navigation -->
<div class="header">
<div class="inner-wrapper">
<h2 class="header-title">text</h2>
<div class="dropdown">
<div class="mobile-menu">
<p align="right">Menu</p>
</div>
<ul class="header-li">
<li>About me</li>
<li>Progress</li>
<li>Food</li>
<li>Contact</li>
</ul>
</div>
<h3 class="header-description"><span>text</span></h3>
</div>
</div>
If you want the header-li to expand beyond the header as well, you will need to both remove overflow: hidden, use 100vw and remove the padding the ul has as a default (or else you'll get a scroll)
.header {
background-color: #FFB6C1;
color: black;
position: relative;
}
.inner-wrapper {
width: 80%;
margin: 0 auto;
margin-top: 30px;
margin-bottom: 20px;
}
.header h2 {
float: left;
font-family: 'Pacifico', sans-serif;
font-size: 30px;
}
.header h3 {
padding-top: 5px;
font-family: 'Petit Formal Script';
clear: both;
font-weight: 700;
}
.header span {
font-weight: bolder;
}
.header ul {
float: right;
margin-right: 10%
}
.header ul li {
list-style: none;
display: inline-block;
font-family: 'Podkova', sans-serif;
margin-right: 20px;
font-weight: bold;
}
.header-li {
position: absolute;
left: 50%;
transform: translateX(-50%);
width: 100vw;
background: lightgray;
padding: 0;
}
/* Navigation Menu click for mobile */
.mobile-menu {
padding: 0;
margin: 0;
display: none;
}
/* Smartphones (portrait) ----------- */
#media only screen and (max-width: 414px) {
/* Styles */
/* Display flex to change the ordering of HTML elemtns*/
.inner-wrapper {
display: flex;
flex-direction: column;
margin-bottom: 0px;
}
.header-title {
order: 1;
}
.header-description {
order: 2;
}
.dropdown {
order: 3;
}
.header-li {
display: none;
position: absolute;
width: 100%;
}
.header ul {
float: none;
margin-right: 0%;
}
.mobile-menu {
padding: 0;
margin: 0;
display: initial;
cursor: pointer;
}
.header ul li {
width: 100%;
background-color: green;
padding-top: 20px;
}
.header {
position: relative;
width: 100%;
}
}
<!-- Header and Navigation -->
<div class="header">
<div class="inner-wrapper">
<h2 class="header-title">text</h2>
<div class="dropdown">
<div class="mobile-menu">
<p align="right">Menu</p>
</div>
<ul class="header-li">
<li>About me</li>
<li>Progress</li>
<li>Food</li>
<li>Contact</li>
</ul>
</div>
<h3 class="header-description"><span>text</span></h3>
</div>
</div>
How's this James?
.theContainer {
width: 200px;
height: 200px;
background-color: gray;
position: relative;
}
.theParent {
width: 80%;
height: 150px;
background-color: lightgray;
}
.theChild {
width: 100%;
background-color: lightgreen;
position: absolute;
}
<div class="theContainer">
<div class="theParent">
This is the parent trying to restrict the child to 80% width.
<div class="theChild">
This is the child with 100% width ignoring parent.
</div>
</div>
</div>

Vimeo Widget Montage Stacking Vertically

My question is: How do I get the vimeo widget montage to display as an inline-block similar to an image gallery? Right now it is stacking vertically. No matter what class I try to edit, it remains like that.
This is the CSS/HTML that defines the vimeo widget:
<style id="badge-styles">
/* You can modify these CSS styles */
.vimeoBadge { margin: 0; padding: 0; font: normal 11px verdana,sans-serif; }
.vimeoBadge img { display:inline-block; width:500px; height:auto; border: 0; }
.vimeoBadge a, .vimeoBadge a:link, .vimeoBadge a:visited, .vimeoBadge a:active { color: #3A75C4; text-decoration: none; cursor: pointer; }
.vimeoBadge a:hover { color:#00CCFF; }
.vimeoBadge #vimeo_badge_logo { margin-top:8px; width: 57px; height: 16px;}
.vimeoBadge .credit { font: normal 11px verdana,sans-serif; }
.vimeoBadge .clip { padding:0; display:inline-block; line-height:0; }
.vimeoBadge .s200 { width: 100%; }
.vimeoBadge .clip a { display:inline-block;}
.vimeoBadge .vertical { float: none; }
.vimeoBadge .caption { font: normal 11px verdana,sans-serif; overflow:hidden; width: auto; height: 30px; }
.vimeoBadge .clear { display: block; clear: both; visibility: hidden; }
.vimeoBadge .s160 { width: 160px; } .vimeoBadge .s80 { width: 80px; } .vimeoBadge .s100 { width: 100px; }
</style><div id="badge">
<div class="vimeoBadge horizontal">
<script src="https://vimeo.com/pablokozatch/badgeo/?script=1&badge_layout=horizontal&badge_quantity=8&badge_size=200&badge_stream=uploaded&show_titles=no"></script>
</div>
</div>
And this is the CSS that I am using to style the image gallery:
body {
width: 80%;
margin: 30px auto;
font-family: sans-serif;
}
h3 {
text-align: center;
font-size: 1.65em;
margin: 0 0 30px;
}
div {
font-size: 0;
}
a {
font-size: 18px;
overflow: hidden;
display: inline-block;
margin-bottom: 8px;
width: calc(50% - 4px);
margin-right: 8px;
}
a:nth-of-type(2n) {
margin-right: 0;
}
#media screen and (min-width: 50em) {
a {
width: calc(25% - 6px);
}
a:nth-of-type(2n) {
margin-right: 8px;
}
a:nth-of-type(4n) {
margin-right: 0;
}
}
a:hover img {
-webkit-transform: scale(1.15);
}
a.overlaylogo:hover {
background-color:none;
color:#000;
text-decoration:none;
}
figure {
margin: 0;
}
img {
border: none;
max-width: 100%;
height: auto;
display: block;
background: #ccc;
transition: -webkit-transform .2s ease-in-out;
}
.p a {
display: inline;
font-size: 13px;
margin: 0;
}
.p {
text-align: center;
font-size: 13px;
padding-top: 8px;
}
The problem can be seen on the page in its current state here: http://pabloshead.com
The gallery I am trying to mimic is above the vimeo widget in its current state.
Thanks!
Just set .clip to display: inline-block;
.clip {
display: inline-block;
}
<div id="badge">
<div class="vimeoBadge horizontal">
<script src="https://vimeo.com/pablokozatch/badgeo/?script=1&badge_layout=horizontal&badge_quantity=8&badge_size=200&badge_stream=uploaded&show_titles=no"></script>
</div>
</div>
After many hours of trial and error I replicated the css that was controlling the gallery and adapted it to work with the Vimeo montage. It is not exactly the same, but uses the same approach to create an inline-block image gallery with the desired effects.
Anyone who would like to replicate this script to better display their Vimeo montage is welcome to take it as I did not create it in the first place. Keep in mind that your montage must be set up as horizontal and with the highest image size which is 200px.
Here is the script:
body {
margin: 0;
padding: 0;
}
.vimeoBadge img {
min-width:100%;
max-width:100%;
height:auto;
transition: -webkit-transform .2s ease-in-out;
}
.vimeoBadge .clip {
display:inline-block;
width:25%;
}
.vimeoBadge div{
margin-right:0px;
}
.vimeoBadge .clip a {
font-size: 18px;
overflow: hidden;
display: inline-block;
width: 100%;
}
a:hover img {-webkit-transform: scale(1.15)}
#media screen and (max-width: 50em) {
.vimeoBadge .clip {
width:50%;
}
}

CSS Flexbox for a Navigation bar with a logo?

I want my .logo to be in the middle for the small screens, and on the left for all of the other screens. The .logo stays on the left until the screen gets big and then moves a little to the right, but I would like it to stay into the middle until the screen gets to the breakpoint for bigger screens. I don't know a whole lot about flexbox, but I was hoping that y'all would be able to tell me how to do this!
Here is my HTML:
<!DOCTYPE html>
<html>
<head>
<title>Mad Men Software | Sometimes Crazy is Just What We Need</title>
<link rel="stylesheet" href="/main.css">
<link rel="stylesheet" href="css/normalize.min.css">
</head>
<body>
<header class="header">
<h1 class="logo">Logo</h1>
<ul class="nav">
<li>Projects</li>
<li>About</li>
<li>Contact</li>
</ul>
</header>
</body>
</html>
and here is my css:
/******************************
Flexbox Layout
*******************************/
.header, .nav {
display: flex;
flex-direction: column;
}
.header {
justify-content: space-between;
}
.nav {
flex: 1;
justify-content: space-around;
}
#media all and (min-width: 670px) {
.header, .nav {
flex-direction: row;
}
}
#media all and (min-width: 1030px) {
.nav {
flex: none;
}
}
/******************************
Additional Styling
*******************************/
body {
margin: 0;
font-family: Helvetica;
background: #5fcf80;
}
.header {
padding: 10px 0;
margin: 0 auto;
}
.logo {
background: url('/HTML/MadMenTransparent/MadMenOfficialLogo.png') center center no-repeat;
width: 150px;
min-height: 70px;
background-size: contain;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
.nav {
list-style: none;
}
.nav li {
margin: 12px 0 12px 28px;
}
.nav li a {
text-decoration: none;
color: #fff;
font-size: 12px;
text-transform: uppercase;
}
.nav li a:hover {
color: rgba(255,255,255,0.7);
}
.nav li:last-child a {
background: rgba(255,255,255,0.3);
border-radius: 2px;
transition: 200ms ease-in-out;
padding: 8px 16px 7px;
}
.nav li:last-child a:hover {
background: rgba(255,255,255,0.5);
color: #fff;
}
#media all and (min-width: 1030px) {
.header {
width: 1030px;
min-width: 768px;
}
}
/*************************
Clearfix
*************************/
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
You can add a breakpoint at ur css like this:
#media only screen and (min-device-width: 700px) and (max-device-width: 1024px) {
header {
position: relative;
}
header ul.nav {
margin-top: 150px;
}
.logo {
position: absolute;
left: 50%;
margin-left: -75px;
}
}

Unwanted horizontal scroll bar

I'm having a bit of a problem. For some reason a horizontal scroll bar keeps appearing from my code. I've tried everything but I can't seem to remove it. The following link is a live preview of the code.
http://jsfiddle.net/y5x7V/
HTML
<body>
<section class="contain">
<div id="section-nav" class="section-nav">
<div class="top">
<ul>
<li class="logo">Magna Contra</li>
<li class="active">Blog With Us</li>
<li>Compxta</li>
<li>Laurie</li>
<li>SUBTITLESOFLIFE</li>
</ul>
</div>
</div>
</section>
<div class="bg">
<h1>SUBTITLESOFLIFE</h1>
</div>
<ul class="check">
<li class="bold">Hot Trends</li>
<li class="topic">Daft Punk</li>
<li class="topic">#bbcqt</li>
<li class="topic">Petite Noir - Major</li>
<li class="topic">Alt J Album Teaser</li>
<li class="topic">Materialistic Happine$$</li>
<li class="topic">WOLF</li>
</ul>
<div class="contar">
Lorem Dosi
</div>
</body>
</html>
CSS
ul
{
list-style-type:none;
margin:0;
padding:0;
text-align: center;
}
.check{
list-style-type:none;
margin:0;
padding:0;
text-align: center;
padding-top: 10px;
padding-bottom: 10px;
width: 100%;
display: inline-block;
}
::selection{background:red;color:red;}::-moz-selection{background:red;color:red;}
li
{
display: inline;
padding:15px;
text-align: center;
margin:auto 0;
position: relative;
}
li a{
text-decoration: none;
color:#bbbbbb;
font-family: "proxima-nova",sans-serif;
text-transform: uppercase;
text-align: center;
font-size: 0.78em;
letter-spacing: .2em}
hr{
color:#dfe0db;
border: 0;
background-color: #dfe0db;
height: 1px;
}
.bold{
display: inline;
}
.bold a{
color:#e94378;
}
.topic{
display: inline;
padding:8px;
text-align: center;
margin:auto 0;
position: relative;
}
.topic a{
-webkit-transition:400ms;-moz-transition:400ms;-o-transition:400ms;transition:400ms;color:#bbb;font-weight:700;outline:0;text-decoration:none}
.topic a:hover{
color:#e94378;text-decoration:none}
}
.logo a{
color:#bbb;
font-size: 0.78em;
text-decoration: none;
text-transform: uppercase;
}
img#hv {
filter: url(filters.svg#grayscale); /* Firefox 3.5+ */
filter: gray; /* IE6-9 */
-webkit-filter: grayscale(1); /* Google Chrome & Safari 6+ */
}
img#hv:hover {
filter: none;
-webkit-filter: grayscale(0);
}
.image {position: relative; text-align: center;width:100%;height:75%;}
.image span {position: absolute; line-height: 20px; display: block; top: 50%;
margin-top: -10px; width: 100%; color: white;font-family: "proxima-nova";
text-transform: uppercase;
font-size: 1.5em; letter-spacing:;}
#media screen and (max-width:800px) {
.image span {
font-size:0.8em;
}
}
#media screen and (max-width:400px) {
.image span {
font-size:0.7em;
}
}
.bg{
background-color: #e94378;
}
img.ri
{
position: relative;
max-width: 100%;
width:100%;
display: inline-block;
vertical-align: middle;
}
#media screen and (orientation: portrait) {
img.ri { max-width: 100%; }
}
#media screen and (orientation: landscape) {
img.ri { max-height: 100%; }
}
.text{
font-family: "proxima-nova";
font-size: 1em;
letter-spacing: .2em;
text-transform: uppercase;
background-color: #e94378;
padding:20px;
color:yellow;
position: absolute;
left:200px;
bottom:50px;
}
.tex{
font-family: "proxima-nova",sans-serif;
font-size: 2.5em;
letter-spacing: 3px;
text-transform: uppercase;
bottom:160px;
left: 320px;
color:white;
padding: 10px;
}
.image{
vertical-align: middle;
}
.logo a:hover{
color:white;
}
.active a{
color:white;
}
.contain{
display: table;
width: 100%;
text-align: center;
margin: 0 auto;
}
.block {
display: table-row;
height: 1px;
}
.navigation {
display: inline-block;
padding: 10px;
width:100%;
margin: auto;
height: 150px;
}
.top {
background-color: #444;
width:100%;
display: inline-block;
padding: 10px;
text-align: center;
}
.navigation:nth-child(odd) {
background: #222;
}
.push {
height: auto;
}
.contar {
margin: 0 auto;
text-align: center;
width:100%;
height:400px;
background-color: white;
}
img.ft{
float:left;
}
.featured{
background-color: white;
width:69%;
text-align: center;
margin: 0 auto;
display: inline-block;;
}
.block:nth-child(odd) {
background: #fff;
}
.search {
border:0px;
background-color:transparent;
color:white;
display: inline-block;
height:28px;
}
.section-nav a{-webkit-transition:400ms;-moz-transition:400ms;-o-transition:400ms;transition:400ms;color:#bbb;font-weight:700;outline:0;text-decoration:none;}
.section-nav a.active,.section-nav a:hover{color:#fff;text-decoration:none}
h1{
font: 800 1em "proxima-nova", sans-serif;
font-size:3.125em;
text-align:center;
padding:10px 10px;
margin:20px 20px;
background-color:;
position: relative;
text-decoration:none;
display:inline-block;
letter-spacing: 6px;
color:yellow;}
h1 a{
text-decoration: none;
letter-spacing: 8px;
padding-left: 0.15em;
color:#a8a820;
}
.txt{
font:800 proxima-nova;
}
h2{
font: 800 1em "proxima-nova", sans-serif;
font-size:3.125em;
text-align:center;
padding:10px 10px;
margin:20px 20px;
background-color:;
position: relative;
text-decoration:none;
display:inline-block;
letter-spacing: 6px;
color:yellow;}
h2 a{
text-decoration: none;
letter-spacing: 8px;
padding-left: 0.15em;
color:#a8a820;
}
Don't use overflow-x: hidden - it only papers over the cracks, it doesn't fix the issue. You can fix it by using the box-sizing property on the top div:
.top {
background-color: #444;
width:100%;
display: inline-block;
padding: 10px;
text-align: center;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
This takes your padding: 10px into account when applying 100% width.
You can also use a polyfill to check for browser support, using the Modernizr plugin.
add
overflow-x:hidden
to the main wrapper class
This is because you're combining both 100% width and padding. If 100% width evaluates to 100px, for example, adding 5px padding to the left and right on top of that will cause your element to have an overall width of 110px. You can get around this by changing the element's box-sizing.
.bottom, .top {
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
JSFiddle demo.
You can set overflow-x in body to hidden
http://jsfiddle.net/y5x7V/1/
body {
line-height: 1;
text-align: center;
overflow-x: hidden;
}
You can fix this correctly rather than hacking in some CSS to hide the scrollbar by fixing the top class in your CSS. Set the padding to 0 (as it's taking the full width of the parent) by adding:
padding:0;
to .top
JSFiddle
You can set the padding's height property to get the original look, this is just a quick fix to demo why it's breaking.
Change
.top {padding:10px;}
to
.top {padding:10px 0; }
Line 261 of css you provided, change from padding: 10px;, to padding: 10px 0;.