A Div has gap on sides - html

I have an issue with my divs. Whenever I add a border to div, there is some gap inside of divs image. It has 0 margins and 0 padding. Image link: https://imgur.com/a/ojppCWU
There is no border gap and outline gap is added for them. Also there is no extra border, margins and padding is added inside div contents.
I have attached the live link of page in case if you didn't found a bug from my snippet. You can review the live code here: https://10xplusmedia.com/seo-services/finalproject/pageold1.html
I have tried to add border-collapse, but it didn't work. But when I add outline, gap is gone but there is no chance to add border-radius. I need border-radius anyway. So finding a solution for gap though.
There should be no gap if possible.
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 1.4285;
color: #333;
background-color: #fff;
}
body {
font-family: arial;
font-size: 16px;
}
html {
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
html {
font-size: 10px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
html {
height: 100%;
}
.pageold__1__main__div {
border: 1px solid black;
border-radius: 0;
overflow: hidden;
}
.fgf {
background-color: #e6e7e9;
}
.eco__eff_1 {
overflow: hidden;
}
p {
margin: 0 0 10px;
}
.stg-cs-a {
margin: 14px 0 !important;
}
.lge p {
margin: 15px;
color: white;
}
.hj p {
font-size: 14px;
color: #233346;
}
.btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0px;
font-size: 14px;
font-weight: 400;
line-height: 1.4285;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
.btn-primary {
color: #fff;
background-color: #337ab7;
border-color: #2e6da4;
}
.btn-group-sm > .btn, .btn-sm {
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.form-control, .btn {
padding: 10px 12px;
height: auto;
font-size: 14px;
border-radius: 5px;
}
.btn {
border-radius: 5px;
}
.btn-sm {
padding: 3px 10px;
}
.hj button {
color: #ffffff;
text-shadow: 0px -1px 0px rgba(0,0,0,0.25);
background-image: url("assets/images/bu.jpg");
background-position: left center;
}
b, strong {
font-weight: 700;
}
.stg {
font-size: 8px;
}
.stg-cs-a .stg {
font-size: 11px !important;
font-weight: bold;
display: block;
padding: 5px 0px;
}
.stg-cs-a .stg {
font-size: 8px !important;
font-weight: bold;
display: block;
padding: 5px 0px;
}
.c__dd__1 {
padding-right: 0px;
}
.lang {
font-size: 16px;
color: #6e7076;
margin-left: 40px;
margin-top: 25px;
}
.langs {
font-size: 16px;
color: #6e7076;
margin-left: 40px;
}
.langss {
margin-left: 30px;
}
.mggpp__opo {
margin-left: 0px;
}
img {
border: 0;
}
img {
vertical-align: middle;
}
.mggpp__opo img {
width: 30px !important;
}
.w_100_cs__a {
width: 100% !important;
}
.bg_img_div__o {
background: #2F518B;
overflow: hidden;
}
.headeR__Page__old__1 {
color: white;
margin: 0;
padding: 20px 0;
}
<div class="pageold__1__main__div">
<div>
<div class="bg_img_div__o">
<div class="col-md-3 col-sm-3">
<p class="headeR__Page__old__1"><b>Booking ID:</b> EC4A7305</p>
</div>
<div class="col-md-6 col-sm-6">
<p class="headeR__Page__old__1"><b>Booking Date:</b> Montag, 27. Jan. 2018 - Dienstag, 28. Jan. 2018</p>
</div>
<div class="col-md-3 col-sm-3">
<p class="headeR__Page__old__1"><b>Booking Period:</b> 2Tage</p>
</div>
</div>
</div>
<div class="content__pageone_div">
<div class=" ">
<div class="row">
<div class=" col-sm-3 c__dd__1">
<img class="w_100_cs__a" alt="" src="assets/images/gg.JPG">
</div>
<div class="col-sm-9 c__dd__2">
<p class="lang mggpp__opo"><b> Langeoog,</b> Höhenpromenade 1, 26465 Langeoog</p>
<p class="langs mggpp__opo"><b> Öffnungszeiten:</b> 7:00 - 19:00 Uhr</p>
<p class="langss mggpp__opo"> <img style=" width: 40px;" alt="" src="assets/images/i0.JPG">
<img style=" width: 40px;
margin-top: -1px;" alt="" src="assets/images/i2.JPG">
<img style=" width: 40px;" alt="" src="assets/images/i3.JPG">
<img style=" width: 41px;" alt="" src="assets/images/i4.JPG">
<img style=" width: 41px;" alt="" src="assets/images/i5.JPG">
<img style=" width: 41px;" alt="" src="assets/images/i6.JPG">
<img style=" width: 44px;" alt="" src="assets/images/i7.JPG">
<img style=" width: 41px;" alt="" src="assets/images/i8.JPG">
<img style=" width: 41px;" alt="" src="assets/images/i9.JPG">
</p>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="lge fgf eco__eff_1">
<div class="col-md-3 col-sm-6 hj">
<p><b>Sie haben gewählt:</b><br>2x Strandkorb</p>
</div>
<div class="col-md-3 col-sm-6 hj">
<p><b>Standort:: </b><br>Strandabschnitt: 105<br>Strandkorb: 471, 462</p>
</div>
<div class="col-md-3 col-sm-6">
<div class="row">
<div class="col-sm-6 hj">
<p><b>Strandkorb: </b><br>471 / 2 Tage<br>462 / 2 Tage</p>
</div>
<div class="col-sm-6 hj">
<p><br>21,98 EUR<br>21,98 EUR</p>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6" style=" background-color: #FFB506;">
<div class="row hj">
<div class="col-sm-7 col-xs-4">
<p class="stg-cs-a"><b>Gesamtsumme: </b><br><span class="stg"> inkl. Steuern & Gebühren <br>(inkl. 0.99 € Nutzungsentgeld pro Tag StandKorb)</span></p>
</div>
<div class=" col-xs-4"></div>
<div class="col-sm-5 col-xs-4">
<p><b>43,96 EUR</b></p>
<button class="btn btn-primary btn-sm" type="button">Stornieren</button>
<br><br>
</div>
</div>
</div>
</div>
</div>
</div>

Your images have a white edge in them. Use image editing software to crop it out.
Edit:
I don't see any gaps as indicated in your screenshot.
Left is Chrome 71 and right is Firefox 65 Dev Edition both on MacOS 10.14

If it's not the image try this and see if it works:
body, html {
margin: 0px;
padding: 0px;
}

Related

Why H1 interfering to the navbar in mobile version?

I don't know why my H1 is interfering with navbar in mobile version. When I scroll down my navbar in mobile version, H1 interfering to the navbar and I can't fix this issue. How can I change my code, that it works ?
Image in mobile version is here: https://i.stack.imgur.com/SJ3vi.jpg
Code below:
.banner {
background-image: url('../../../assets/images/natallia-nagorniak-tA3sJ4u09eU-unsplash.jpg');
height: 800px;
background-position: center center;
background-size: 100%;
}
.content {
top: 25%;
left: 5%;
position: absolute;
}
.content h1 {
color: black;
font-size: 3em;
font-weight: bold;
}
.content a {
text-decoration: none;
background-color: var(--primary-color);
color: #fff;
padding: 15px 40px;
border-radius: 5px;
}
.content a:hover {
background-color: #64cff7;
color: #fff;
}
.stepBox {
background-color: #64cff7;
padding: 20px 20px;
border-radius: 5px;
text-align: center;
}
.stepBox h1 {
font-size: 30px;
font-weight: bold;
color: black;
}
.stepBox p {
font-size: 20px;
font-style: italic;
color: #fff;
}
.highlight {
color: var(--primary-color);
font-weight: bold;
font-style: italic;
text-decoration: underline;
}
.cakebox {
padding: 10px 5px;
}
.cakebox img {
width: 100%;
height: 250px;
object-fit: cover;
border-radius: 5px;
}
.cakebox h1 {
font-size: 18px;
margin-top: 20px;
font-weight: bold;
}
.viewmorebtn {
text-decoration: none;
background-color: #64cff7;
color: #fff;
padding: 10px 10px;
border-radius: 5px;
font-size: 18px;
}
.viewmorebtn i {
padding-left: 5px;
}
#media screen and (max-width:600px) {
.banner {
height: 600px;
}
}
<div class="banner">
<div class="content">
<h1 class="mb-5">Čerstvé koláče <br/> priamo k tvojim dverám</h1>
<a routerLink="menu">Objednaj teraz! <i class="bi bi-arrow-right"></i></a>
</div>
</div>
<!-- step -->
<div class="container mt-5 mb-5">
<h1 class="text-center">Ako získať <span class="highlight">čerstvé koláče</span></h1>
<div class="row mt-3">
<!-- one -->
<div class="col-lg-4 mt-2">
<div class="stepBox">
<h1>1</h1>
<p>vyberte koláč</p>
</div>
</div>
<!-- two -->
<div class="col-lg-4 mt-2">
<div class="stepBox">
<h1>2</h1>
<p>vyplnte podrobnosti</p>
</div>
</div>
<!-- three -->
<div class="col-lg-4 mt-2">
<div class="stepBox">
<h1>3</h1>
<p>doručenie vašej objednávky</p>
</div>
</div>
</div>
</div>
<!-- cakebox -->
<div class="container mt-4 mb-4">
<h1 class="text-center">Obľúbené produkty</h1>
<div class="row">
<div class="col-lg-3 mt-3" *ngFor="let ck of cakeData; index as i">
<div class="cakebox" *ngIf="i<=3">
<img src="{{ck.cakeImg}}" />
<h1>{{ck.cakeName}}</h1>
<p>{{ck.cakePrice | currency:'EUR'}}</p>
</div>
</div>
</div>
<a routerLink="menu" class="viewmorebtn">Zobraziť viac<i class="bi bi-arrow-right"></i></a>
</div>
Thank you for your answers!
.content {
top: 25%;
left: 5%;
position: absolute;
}
The container of the h1 is positioned absolutely. The default z-index is causing it to overlap other elements which have a smaller z-index value.
Setting the z-index of the .content div and navbar may help to solve the problem.
.content {
top: 25%;
left: 5%;
position: absolute;
z-index: 10; /** something smaller than the z-index of the navbar **/
}
.navbar {
...
z-index: 20; /** something bigger than the z-index of .content **/
}

News template like layout for menu

I am trying to make a menu which is generated dynamically. Its structure is similar to a newspaper template. I did some research and came to know that using css flexbox we can achieve something like this. However i am still not able to achieve it.
This is the desired look I want:-
To replicate the issue:- click on 'Bilar' menu item-> check the menu -> the 4th menu item is expected to come a bit upwards, but its comes downwards.
Below is the codepen link and my code. Any help is appreciated.
Click this Codepen link to see the current code
$font-stack: OpenSans, Helvetica, sans-serif;
$primary: #e50000;
$primary-hover: #ca0000;
$text-color: #555555;
$white: #ffffff;
$graphic-grey-color: #e1e1e1;
$background-grey-color: #f5f5f5;
$main-dark-color: #202020;
$form-border-color: #dddddd;
$form-active-border-color: #999999;
$navbar-light-color: $main-dark-color;
$link-hover-color: $white;
$link-hover-decoration: none;
$nav-tabs-link-active-bg: $primary;
$navbar-brand-padding-y: 0rem;
$navbar-nav-link-padding-x: 0.9375rem;
$nav-link-padding-y: 0rem;
.header-navigation {
height: 80px;
border-bottom: 2px solid $primary;
.header-brand{
margin-right: 1.4375rem;
height: 100%;
}
}
.header-menu{
height: 100%;
}
.header-menu-item{
font-family: $font-stack;
height: 100%;
color: $main-dark-color;
&:hover {
background-color: $primary;
}
+ .-collapse{
z-index: 1000;
display: none;
position: absolute;
top: 80px;
left: 0px;
// display: none;
opacity: 0;
.menu-item-level2 {
width: 100vw;
margin: auto;
.-level2-main-section{
padding: 0px;
background-color: $background-grey-color;
min-height: 280px;
.-level2-main-section-row{
max-width: 100%;
text-align: center;
margin: 30px 165px 50px 165px;
.-level2-menu-column{
padding: 0px;
text-align: left;
// .-level2-menu-container{
margin-bottom: 30px;
.-heading{
margin-bottom: 10px;
color: $main-dark-color;
font-size: 20px;
font-weight: bold;
line-height: 1.5;
}
.-subitems{
color: $text-color;
font-size: 16px;
line-height: 1.88;
}
// }
}
}
}
.-level2-side-section{
margin: auto;
padding: 20px;
background-color: $graphic-grey-color;
min-height: 280px;
.-info{
margin-bottom: 60px;
.-info-text{
margin-top: 10px;
line-height: 1.5;
font-size: 20px;
color: $text-color;
font-weight: normal;
}
}
}
}
}
}
.header-menu-item.active{
background-color: $primary;
color: $white;
+ .-collapse{
display: block;
opacity: 1;
transition: opacity 500ms linear;
}
}
.header-menu-list {
height: 100%;
}
.navbar{
padding: 0px 0px 0px 30px !important;
color: $text-color;
}
.header-brandname{
margin: 10px 0px;
}
.header-logo{
height: 100%;
padding: 0px 30px;
border-left: 1px solid $graphic-grey-color;
}
Your class col-lg-4 use the following responsive media query:
#media (min-width: 992px) {
.col-lg-4 {
-webkit-box-flex: 0;
-ms-flex: 0 0 33.333333%;
flex: 0 0 25%;
max-width: 33.333333%;
}
}
wich means that once your browser width is higher than 992px, these colums takes 33.33% width and it should be 25% (if you want 4 columns)
EDITED: Just saw your screenshot. css flex wont let you do what you want. If the content is fixed you can just add your 4th menu inside first one container, removing col-lg-4 class like in this codepen (Note I added margin-top inline to make it look better.)
If the content is dinamic you may need to search for any other way to achieve it. masonry came to my mind as first thing I would look into: link
You can use multi column for this layout. I have added on last please check
.header-navigation {
height: 80px;
border-bottom: 2px solid #e50000;
}
.header-navigation .header-brand {
margin-right: 1.4375rem;
height: 100%;
}
.header-menu {
height: 100%;
}$font-stack: OpenSans, Helvetica, sans-serif;
$primary: #e50000;
$primary-hover: #ca0000;
$text-color: #555555;
$white: #ffffff;
$graphic-grey-color: #e1e1e1;
$background-grey-color: #f5f5f5;
$main-dark-color: #202020;
$form-border-color: #dddddd;
$form-active-border-color: #999999;
$navbar-light-color: $main-dark-color;
$link-hover-color: $white;
$link-hover-decoration: none;
$nav-tabs-link-active-bg: $primary;
$navbar-brand-padding-y: 0rem;
$navbar-nav-link-padding-x: 0.9375rem;
$nav-link-padding-y: 0rem;
.header-navigation {
height: 80px;
border-bottom: 2px solid $primary;
.header-brand {
margin-right: 1.4375rem;
height: 100%;
}
}
.header-menu {
height: 100%;
}
.header-menu-item {
font-family: $font-stack;
height: 100%;
color: $main-dark-color;
&:hover {
background-color: $primary;
}
+ .-collapse {
z-index: 1000;
display: none;
position: absolute;
top: 80px;
left: 0px;
// display: none;
opacity: 0;
.menu-item-level2 {
width: 100vw;
margin: auto;
.-level2-main-section {
padding: 0px;
background-color: $background-grey-color;
min-height: 280px;
.-level2-main-section-row {
max-width: 100%;
text-align: center;
margin: 30px 165px 50px 165px;
.-level2-menu-column {
padding: 0px;
text-align: left;
// .-level2-menu-container{
margin-bottom: 30px;
.-heading {
margin-bottom: 10px;
color: $main-dark-color;
font-size: 20px;
font-weight: bold;
line-height: 1.5;
}
.-subitems {
color: $text-color;
font-size: 16px;
line-height: 1.88;
}
// }
}
}
}
.-level2-side-section {
margin: auto;
padding: 20px;
background-color: $graphic-grey-color;
min-height: 280px;
.-info {
margin-bottom: 60px;
.-info-text {
margin-top: 10px;
line-height: 1.5;
font-size: 20px;
color: $text-color;
font-weight: normal;
}
}
}
}
}
}
.header-menu-item.active {
background-color: $primary;
color: $white;
+ .-collapse {
display: block;
opacity: 1;
transition: opacity 500ms linear;
}
}
.header-menu-list {
height: 100%;
}
.navbar {
padding: 0px 0px 0px 30px !important;
color: $text-color;
}
.header-brandname {
margin: 10px 0px;
}
.header-logo {
height: 100%;
padding: 0px 30px;
border-left: 1px solid $graphic-grey-color;
}
.menu-wrap {
display: block;
}
.row.-level2-main-section-row {
display: block;
column-count: 3;
}
.-level2-menu-column {
display: block;
}
.header-menu-item {
font-family: OpenSans, Helvetica, sans-serif;
height: 100%;
color: #202020;
}
.header-menu-item:hover {
background-color: #e50000;
}
.header-menu-item + .-collapse {
z-index: 1000;
display: none;
position: absolute;
top: 80px;
left: 0px;
opacity: 0;
}
.header-menu-item + .-collapse .menu-item-level2 {
width: 100vw;
margin: auto;
}
.header-menu-item + .-collapse .menu-item-level2 .-level2-main-section {
padding: 0px;
background-color: #f5f5f5;
min-height: 280px;
}
.header-menu-item + .-collapse .menu-item-level2 .-level2-main-section .-level2-main-section-row {
max-width: 100%;
text-align: center;
margin: 30px 165px 50px 165px;
}
.header-menu-item + .-collapse .menu-item-level2 .-level2-main-section .-level2-main-section-row .-level2-menu-column {
padding: 0px;
text-align: left;
margin-bottom: 30px;
}
.header-menu-item + .-collapse .menu-item-level2 .-level2-main-section .-level2-main-section-row .-level2-menu-column .-heading {
margin-bottom: 10px;
color: #202020;
font-size: 20px;
font-weight: bold;
line-height: 1.5;
}
.header-menu-item + .-collapse .menu-item-level2 .-level2-main-section .-level2-main-section-row .-level2-menu-column .-subitems {
color: #555555;
font-size: 16px;
line-height: 1.88;
}
.header-menu-item + .-collapse .menu-item-level2 .-level2-side-section {
margin: auto;
padding: 20px;
background-color: #e1e1e1;
min-height: 280px;
}
.header-menu-item + .-collapse .menu-item-level2 .-level2-side-section .-info {
margin-bottom: 60px;
}
.header-menu-item + .-collapse .menu-item-level2 .-level2-side-section .-info .-info-text {
margin-top: 10px;
line-height: 1.5;
font-size: 20px;
color: #555555;
font-weight: normal;
}
.header-menu-item.active {
background-color: #e50000;
color: #ffffff;
}
.header-menu-item.active + .-collapse {
display: block;
opacity: 1;
transition: opacity 500ms linear;
}
.header-menu-list {
height: 100%;
}
.navbar {
padding: 0px 0px 0px 30px !important;
color: #555555;
}
.header-brandname {
margin: 10px 0px;
}
.header-logo {
height: 100%;
padding: 0px 30px;
border-left: 1px solid #e1e1e1;
}
.menu-wrap {
display: block;
}
.row.-level2-main-section-row {
display: block;
column-count: 3;
}
.-level2-menu-column {
display: block;
}
<header class="header">
<nav class="header-navigation navbar navbar-expand-lg">
<a class="header-brand navbar-brand d-flex align-items-center pull-left" href="#">
<img src="/static/images/fc-logo.svg" alt="brand-logo">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#header-navigation" aria-controls="header-navigation"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="header-menu collapse navbar-collapse" id="header-navigation">
<ul class="header-menu-list navbar-nav mr-auto">
<li class="nav-item">
<a class="header-menu-item nav-link d-flex align-items-center" href="#">
<span>Bilar</span>
</a>
<div class="-collapse">
<div class="menu-item-level2 row">
<div class="-level2-main-section col-lg-10">
<div class="menu-wrap">
<div class="-level2-main-section-row row align-items-start">
<div class="-level2-menu-column -level2-menu-container col-lg-4">
<div class="-heading">Nya bilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
</div>
<div class="-level2-menu-column -level2-menu-container col-lg-4">
<div class="-heading">Nya bilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
</div>
<div class="-level2-menu-column -level2-menu-container col-lg-4">
<div class="-heading">Nya bilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
</div>
<div class="-level2-menu-column -level2-menu-container col-lg-4">
<div class="-heading">Nya bilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
</div>
</div>
</div>
</div>
<div class="-level2-side-section col-lg-2">
<div class="-info">
<a class="-info-img" href="#">
<img src="/static/images/car.png" alt="info-image-1">
</a>
<div class="-info-text">
Vilken Yaris ar du?
</div>
</div>
<div class="-info">
<a class="-info-img" href="#">
<img src="/static/images/car2.png" alt="info-image-2">
</a>
<div class="-info-text">
Basta familjebilen - 7 sittplatser!
</div>
</div>
</div>
</div>
</li>
<li class="nav-item ">
<a class="header-menu-item nav-link d-flex align-items-center" href="#">
<span>Finansiering</span>
</a>
</li>
<li class="nav-item ">
<a class="header-menu-item nav-link d-flex align-items-center" href="#">
<span>Service</span>
</a>
</li>
<li class="nav-item ">
<a class="header-menu-item nav-link d-flex align-items-center" href="#">
<span>Om oss</span>
</a>
</li>
<li class="nav-item ">
<a class="header-menu-item nav-link d-flex align-items-center" href="#">
<span>Min Toyota</span>
</a>
</li>
</ul>
</div>
<a href="#" class="header-logo pull-right d-flex align-items-center">
<img src="/static/images/toyota-logo.jpg" alt="brand-logo">
</a>
</nav>
</header>
Link
One way is using CSS column, but is is not widely supported. You can check its Browser compatibility here.
If you decide to do so, remember you can not combine it with flex. Hence, no Bootstrap flex classes for this part of your page.
Use column-count: #x for the number of columns in row.
Use break-inside: avoid; to avoid break column break.
.-level2-main-section-row {
border: 1px solid;
-moz-column-count: 3;
-webkit-column-count: 3;
column-count: 3;
column-count: 3;
}
.-level2-menu-column {
margin-bottom: 10px;
border: 1px solid red;
-webkit-column-break-inside: avoid;
page-break-inside: avoid;
break-inside: avoid;
}
<div class="menu-wrap">
<div class="-level2-main-section-row align-items-start">
<div class="-level2-menu-column -level2-menu-container ">
<h1 class="-heading">Nya bilar</h1>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
</div>
<div class="-level2-menu-column -level2-menu-container ">
<h1 class="-heading">Nya bilar</h1>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
<div class="-heading">Nya bilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
<div class="-heading">Nya bilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
<div class="-heading">Nya bilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
<div class="-heading">Nya bilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
</div>
<div class="-level2-menu-column -level2-menu-container ">
<h1 class="-heading">Nya bilar</h1>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
</div>
<div class="-level2-menu-column -level2-menu-container ">
<h1 class="-heading">Nya bilar</h1>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
</div>
<div class="-level2-menu-column -level2-menu-container ">
<h1 class="-heading">Nya bilar</h1>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
</div>
<div class="-level2-menu-column -level2-menu-container">
<h1 class="-heading">Nya bilar</h1>
<div class="-subitems">Personbilar</div>
<div class="-subitems">Transportbilar</div>
</div>
</div>
</div>
Check this pen
You can set different column per page using media queries.
Update
An another problem with column is that it does not respect the order you lay down the columns. Therefore, if its important to order the columns, you may go for masonry or some other Javascript library.
This article is a good read on this topic.

Inexplicable gap in between my divs

I am trying to replicate the BBC News site and I have this weird styling problem.
Here is the image.
I always get this gap in between two of my divs.
Here is the code I used. Not sure how I am supposed to go about getting rid of that space. tried setting margin and padding to 0 but that didn't work.
Here is the code:
body{
margin: 0;
padding: 0;
font-family: Helvetica, Arial, sans-serif;
}
#topbar{
height: 40px;
width: 1000px;
margin: 0 auto;
background-color: #FFFFFF;
}
#logo{
float: left;
margin-top: 8px;
margin-right: 8px;
}
.topbarsections{
float:left;
border-left: 1px #CCCCCC solid;
height: 100%;
}
#signin-image{
float: left;
width: 30px;
margin-top: 7px;
margin-left: 8px;
}
#signin-text{
float: left;
font-weight: bold;
font-size: 90%;
color: #333333;
position: relative;
top: 13px;
padding-right: 80px;
}
.topbar-menu{
float: left;
font-weight: bold;
color: #333333;
font-size: 90%;
padding: 13px 15px 0 15px;
height: 27px;
}
#more-arrow{
height: 13px;
margin-left: 15px;
}
#search-box{
background-color: #E4E4E4;
margin: 8px 0 0 10px;
border: none;
font-weight: bold;
font-size: 14px;
padding: 5px;
width: 140px;
float: left
}
#magnifying-glass{
margin-top: 8px;
height: 26px;
}
.clear{
margin: 0;
padding: 0;
}
#news-bar{
background-color: #BB1919;
width: 100%;
height: 70px;
}
#inner-news-bar{
background-color: #BB1919;
margin: 0 auto;
width: 1200px;
height: 70px;
}
#news-bar h1{
color: white;
margin: 0;
padding: 10px;
font-weight: normal;
font-size: 45px;
}
#menu-bar{
background-color: #A91717;
width: 100%;
height: 35px;
}
#inner-menu-bar{
background-color: #A91717;
width: 1200px;
height: 35px;
margin: 0 auto;
}
.menu-bar-sections{
float: left;
border-right: 1px solid #BB4545;
padding-left: 10px;
padding-right:8px;
position: relative;
top: -5px;
}
.menu-bar-sections a{
float:left;
color: white;
text-decoration: none;
}
.menu-bar-sections a:hover{
text-decoration: underline;
}
#menu-bar-more-section{
border-right: none !important;
}
#down-arrow{
float: left;
height: 13px;
position: relative;
top: 2px;
margin-left: 2px;
}
#page-container{
width: 1200px;
margin: 0 auto;
}
h2{
}
<body>
<div id="topbar">
<img id="logo" src="images/bbclogo.png">
<div id="signin-div" class="topbarsections">
<img src="images/singin.PNG" id="signin-image">
<span id="signin-text">Sign in</span>
</div>
<div class="topbarsections topbar-menu">
News
</div>
<div class="topbarsections topbar-menu">
Sports
</div>
<div class="topbarsections topbar-menu">
Weather
</div>
<div class="topbarsections topbar-menu">
Shop
</div>
<div class="topbarsections topbar-menu">
Earth
</div>
<div class="topbarsections topbar-menu">
Travel
</div>
<div class="topbarsections topbar-menu">
More
<img id="more-arrow"src="images/more-arrow.PNG">
</div>
<div class="topbarsections">
<input id="search-box" type="text" placeholder="Search">
<input type="image" id="magnifying-glass" src="images/glass.PNG">
</div>
</div>
<div class="clear"></div>
<div id="news-bar">
<div id="inner-news-bar">
<h1>NEWS</h1>
</div>
</div>
<div class="clear"></div>
<div id="menu-bar">
<div id="inner-menu-bar">
<p class="menu-bar-sections">Home</p>
<p class="menu-bar-sections">Video</p>
<p class="menu-bar-sections">World</p>
<p class="menu-bar-sections">US & Canada</p>
<p class="menu-bar-sections">UK</p>
<p class="menu-bar-sections">Business</p>
<p class="menu-bar-sections">Tech</p>
<p class="menu-bar-sections">Science</p>
<p class="menu-bar-sections">Stories</p>
<p class="menu-bar-sections">Entertainment & Arts</p>
<p class="menu-bar-sections">Health</p>
<p class="menu-bar-sections" id="menu-bar-more-section">More<img src="images/down-arrow.PNG" id="down-arrow"></p>
</div>
</div>
<div class="clear"></div>
<div id="page-container">
<div id="main-article">
<h2>Technology</h2>
</div>
</div>
</body>
If by "gap" you mean the space above the heading "Technology", #Olivier Krull is right: that's the default margin of the h2 header.
You can simply add this CSS rule to set it to zero:
#main-article > h2:first-child {
margin-top: 0;
}

I have two items that appear to be centered in the code and individually on the page, but when aligned they are not

I have a button near the bottom of the page that is centered. Additionally, I have three images that I centered by making each image a col-lg-2 with 3 empty columns in between each one. I cannot figure out why these two items don't line up nicely, and which one is the one that is off center.
https://codepen.io/colesam/full/OgamyB/
SCSS:
a {
color: $blue;
font-size: 1.4vw;
font-weight: 500;
line-height: 1.7vw;
transition: all 0.2s;
&:hover {
color: $orange;
font-size: 1.7vw;
cursor: pointer;
text-decoration: none;
}
&:focus {
color: $blue;
text-decoration: none;
&:hover {
color: $orange;
cursor: pointer;
}
}
}
body {
background: white;
color: $black;
font-family: 'Roboto', sans-serif;
font-weight: 300;
text-shadow: $text-shadow-light;
}
h2 {
font-size: 5vh;
margin-top: 5vh;
}
p {
font-size: 3vh;
letter-spacing: 2px;
margin-top: 3vh;
text-shadow: none;
}
.btn-next {
bottom: 0;
padding-bottom: 5vh;
position: absolute;
text-align: center;
transition: all 0.3s;
a {
font-size: 5vw;
&:hover {
font-size: 5.5vw;
}
}
}
.center-text {
text-align: center;
}
.left-text {
text-align: left;
}
.no-margin {
margin: 0;
}
.right-text {
text-align: right;
}
.title {
padding-left: 4vw;
h3 {
font-size: 3vw;
text-shadow: $text-shadow;
}
}
#portfolio-page {
min-height: 100vh;
position: relative;
}
h4 {
font-size: 2vw;
}
.active-item {
box-shadow: $box-shadow-o;
-moz-box-shadow: $box-shadow-o;
-webkit-box-shadow: $box-shadow-o;
}
.btn-portfolio {
padding-top: 20vh;
text-align: center;
transition: all 0.3s;
a {
font-size: 5vw;
&:hover {
font-size: 5.5vw;
}
}
}
#featured-content {
background: rgba(0, 0, 0, 0.1);
height: 65vh;
margin-top: 2vh;
padding: 3vh 0;
}
#featured-img img {
box-shadow: $box-shadow-light;
-moz-box-shadow: $box-shadow-light;
-webkit-box-shadow: $box-shadow-light;
}
#primary-featured {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
height: 45.5vh;
top: 10%;
}
#secondary-featured {
margin-top: 3vh;
}
HTML(inside a div.container):
<div id="portfolio-page">
<div class="row">
<div class="col-lg-4 col-lg-offset-4">
<h2 class="center-text">My Portfolio</h2>
<hr>
</div>
</div>
<div class="row">
<div class="col-lg-12" id="featured-content">
<div class="row no-margin">
<div class="col-lg-1 btn-portfolio" id="left-button">
<a><i class="glyphicon glyphicon-chevron-left"></i></a>
</div>
<div class="col-lg-8 col-lg-offset-1" id="primary-featured">
<div class="row">
<div class="col-lg-5" id="featured-img">
<img src="includes/img/headers.jpg" alt="A cluster of header images." class="img-responsive">
</div>
<div class="col-lg-6 col-lg-offset-1" class="center-text">
<h4 id="featured-title">Placeholder</h4>
<hr>
<p id="featured-description">Placeholder text.</p>
</div>
</div>
</div>
<div class="col-lg-1 col-lg-offset-1 btn-portfolio" id="right-button">
<a><i class="glyphicon glyphicon-chevron-right"></i></a>
</div>
<div class="col-lg-6 col-lg-offset-3" id="secondary-featured">
<div class="row">
<div class="col-lg-2" id="secondary-feature1">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
<div class="col-lg-2 col-lg-offset-3" id="secondary-feature2">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
<div class="col-lg-2 col-lg-offset-3" id="secondary-feature3">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
</div>
Edit: Your problem is with position: absolute on .btn-next.
For absolutely positioned elements
This property specifies the distance between the left margin edge of
the element and the left edge of its containing block.
You have margin-left: -15px, so it aligns to center with the margin-left: -15px.
How to fix:
Add this to .btn-next:
right: 0;
left: 0;
...or you can remove position: absolute from .btn-next.
Alternative option:
The "down arrow" at the bottom isn't centered, because it's in the row class and that class has margin-left: 15px and margin-right: 15px.
If you give it margin: 0px, it'll be fine.
Rename div class="row" to something else or give it another class like div class="row down".
Examples:
<div class="down">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
or
<div class="row down">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
CSS (only if using second option):
.row.down {
margin: 0px;
}

External CSS files causing problems to images

This is NetBeans. I have tried to include an external CSS file but when used externally the images all get really enlarged. Whereas my I use the same styling within the html file using internal styling the images are of correct ratio.
body {
width: 100%;
height: 100%;
margin: 0;
}
.header {
background-color: #000;
color: #fff;
border-color: #080808;
min-height: 50px;
border: 1px solid transparent;
}
.inner header {
width: 80%;
margin: auto;
}
.logo {
float: left;
height: 50px;
padding: 15px;
font-size: 20px;
font-weight: bold;
padding-left: 90px;
}
a {
text-decoration: none;
background-color: transparent;
color: #ededed;
}
.header link {
float: right;
font-size: 14px;
height: 50px;
padding: 15px 15px;
font-size: 16px;
font-weight: bold;
}
#su {
float: right;
height: 50px;
padding: 15px 90px;
}
#l {
float: right;
height: 50px;
padding: 15px 0px;
}
.content {
min-height: 600px;
}
.banner-image {
padding-bottom: 50px;
margin-bottom: 20px;
text-align: center;
color: #f8f8f8;
background: url(image/intro-bg_1.jpg) no-repeat center;
background-size: cover;
}
.inner-banner-image {
padding-top: 12%;
width: 80%;
margin: auto;
}
.banner-content {
position: relative;
padding-top: 6%;
padding-bottom: 6%;
overflow: hidden;
margin-bottom: 12%;
background-color: rgba(0, 0, 0, 0.7);
max-width: 660px;
margin-left: 200px;
}
.button {
color: #fff;
background-color: #c9302c;
border-color: #ac2925;
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
padding: 10px 16px;
font-size: 18px;
border-radius: 6px;
}
.container {
width: 90%;
margin: auto;
overflow: hidden;
}
.items {
width: 30%;
display: block;
padding: 4px;
margin-bottom: 20px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
float: left;
margin-left: 1%;
}
.thumbnail {
display: block;
max-width: 100%;
height: auto;
}
.caption {
color: #000;
padding: 0px 10px 10px;
font-weight: bold;
text-align: center;
}
footer {
background-color: #000;
color: #fff;
font-size: 14px;
text-align: center;
}
<html>
<head>
<title>Lifestyle Store</title>
</head>
<body>
<div class="header">
<div class="inner header">
<div class="logo">
Lifestyle Store
</div>
<div class="header link">
<div id="su">
Sign Up
</div>
<div id="l">
Login
</div>
</div>
</div>
</div>
<div class="content">
<div class="banner-image">
<div class="inner-banner-image ">
<div class="banner-content">
<h1>We sell lifestyle</h1>
<p>Flat 40% OFF on premium brands</p>
<form>
Shop Now
</form>
</div>
</div>
</div>
</div>
<div class="container">
<div class="items">
<a href="#">
<img src="image/camera.jpg" class="thumbnail">
<div class="caption">
<h2>Cameras</h2>
<p>Choose among the best from the world</p>
</div>
</a>
</div>
<div class="items">
<a href="#">
<img src="image/watch.jpg" class="thumbnail">
<div class="caption">
<h2>Watches</h2>
<p>Original watches from the best brands</p>
</div>
</a>
</div>
<div class="items">
<a href="#">
<img src="image/shirt.jpg" class="thumbnail">
<div class="caption">
<h2>Shirts</h2>
<p>Our exquisite collection of shirts</p>
</div>
</a>
</div>
</div>
<footer>
<div class="container">
<p>Copyright © Lifestyle Store. All Rights Reserved | Contact Us: +91 90000 00000</p>
</div>
</footer>
</body>
</html>
Have you linked the CSS file correctly in this line? Try dragging and dropping the file directly into the HTML to ensure the location and name is correct.
href="assignment1/public_html/style.css"
Edit:
The current link you have is saying that you have the index.html file outside of the 'assignment1' folder. If you have your HTML file inside 'public_html' then the stylesheet link should be the following.
href="style.css"