I’m using Bootstrap and have a gap between the right browser margin and the grid. The grid is equal to 12 with the offset, but it still doesn’t reach the other side. I don’t want to compromise the .col sizes and make it xs. This seems to be the only solution that has worked so far. Can anyone tell help with the issue?
HTML:
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/styles.css">
<link href="http://fonts.googleapis.com/css?family=Cookie:400" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,300' rel='stylesheet' type='text/css'>
<title>Junebug Mixology</title>
</head>
<body>
<header class="bgimage">
<img src='../bootstrap/images/junebug.png' alt="Junebug Mixology" class="img-responsive center-block" />
</header>
<div class="container-fluid">
<section class="hello col-md-5">
<h1>hello!</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab libero,
cupiditate veniam officiis itaque in porro iure fugit iusto reprehenderit
commodi earum cum blanditiis quos error similique quod, facere! Hic.</p>
</section>
<section class="social-media col-md-4 col-md-offset-3">
<div class="row">
<h3>To Stay Connected</h3>
<div class="row">
<div class="col-lg-2 col-md-2 col-sm-1 col-xs-1">
<a href="https://www.instagram.com/neon.honey/" target="_blank"><img class="media-object" src="../bootstrap/images/instagram.png" alt="Instagram"></a>
</div>
<div class="col-lg-2 col-md-2 col-sm-1 col-xs-1">
<a href="https://twitter.com/deephoney/" target="_blank"><img class="media-object" src="../bootstrap/images/twitter.png" alt="Twitter"></a>
</div>
<div class="col-lg-2 col-md-2 col-sm-1 col-xs-1">
<a href="https://www.pinterest.com/electrodextrose/" target="_blank"><img class="media-object" src="../bootstrap/images/pinterest.png" alt="Pinterest" /></a>
</div>
<div class="col-lg-2 col-md-2 col-sm-1 col-xs-1">
<a href="mailto:" target="_top"><span class="glyphicon glyphicon-envelope" aria-hidden="true"></span></a>
</div>
</div>
</div>
</section>
</div>
<script src="js/jquery-2.1.4.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/script.js"></script>
</body>
CSS:
body {
background-color: rgb(31, 37, 45);
color: rgb(239, 232, 239);
font-family: 'Open Sans', sans-serif;
font-weight: 300;
padding-top: 50px;
}
h1 {
color: rgb(244, 195, 197);
font-family: 'Cookie', sans-serif;
font-weight: 400;
text-shadow: 2px 2px 1px rgba(192,192,192,0.1);
text-transform: lowercase;
font-size: 70px;
margin-bottom: -5px;
text-align: center;
}
h3 {
color: rgb(244, 195, 197);
text-transform: uppercase;
}
.bgimage {
background-image: url('../images/bgimage.png');
background-position: center center;
background-size: cover;
height: 450px;
background-color: rgb(34, 39, 42);
padding-top: 25px;
}
.row {
margin: 7px;
}
h4 {
margin-top: 1px;
text-align: left;
font-size: 15px;
}
.glyphicon {
color: rgb(135, 112, 94);
font-size: 25px;
}
section.hello {
text-align: center;
}
3
Answers
You can just add the both “col-md-6”. And so the “hello” section and the “social media” will be at the same distance from the sides of the web.
Also, let me suggest you: If you’re beginner… when you’re getting an issue, it’s good to set a boder to the “element” with that issue. That way, you’ll get more “idea” about the space, margins, paddings and kind of things.
Here are two examples of how you can do this. Keep in mind if you’re going to nest columns they should keep the same relationship of row/column. In your example, you have your
hello section
structured without arow
and the socialmedia section
with tworows
. Ultimately your two base columns should be inside arow
and your innercolumns
should be inside arow
.And of you want the social icons to be as close the edge of the window as the hello section, you can align them to the right at above 992px and then center them @ under 992px.
Example 1: Using columns for social icons.
Example 2: Positions icons without columns.
You have got few things wrong.
Tip: change background color of section.social-media to help you see how big the grid is.
Here’s a link to fiddle which I created: https://jsfiddle.net/9r30nhby/