Static Header when scrolling - html

I coded a homepage and now I am trying to build a header, which is static like not scrolling with, when content is being scrolled. It should stay at the top while the content goes beneath/under it. I found this solution here, however, it's not working for me as I don' know where to put this code in, because everything I tried didn't work.
Click here for jsfiddle!.
My HTML is:
<!-- #PAGE -->
<div id="page1">
<!-- #HEADER -->
<div id="header1">
<div class="content-wrapper">
<div class="ft-div-left">
<center>
<img src="FW_Logo_Website.png">
</center>
</div>
<div class="ft-div-right">
<center>
</br>
<a href="logout.php" style="text-decoration:none;">
<button class="button-logout" name="Ausloggen">Logout</button>
</a>
</center>
</div>
<div class="ft-div-middle"> </div>
</div>
</div>
<!-- HEADER ENDE -->
<!-- #CONTENT -->
<div id="content">
<div class="wrapper">
<div class="left_box">
<center>
<img alt="" src="images/camera.png" width="100" height="100" />
<h1 class="headline" style="font-family:'Montserrat',sans-serif;">RAW DATA</h1>
<p class="explanation">Alle unretuschierten Fotos.</p>
<table>
<tbody>
<tr>
<td><img alt="" src="images/megabyte.png" width="20" height="20" /></td>
<td> 24.5 MB</td>
</tr>
<tr>
<td><img alt="" src="images/image.png" width="20" height="20" /></td>
<td> 758</td>
</tr>
<tr>
<td><img alt="" src="images/resolution.png" width="20" height="20" /></td>
<td> 3459 x 3294</td>
</tr>
</tbody>
</table>
</br>
<button class="button" name="DownloadRaw" onClick="getRawData()">Download</button>
</center>
</div>
<div class="right_box">
<center>
<img alt="" src="images/brush.png" width="100" height="100" />
<h1 class="headline" style="font-family:'Montserrat',sans-serif;">RETUSCHIERT</h1>
<p class="explanation">Alle retuschierten Fotos.</p>
<table>
<tbody>
<tr>
<td><img alt="" src="images/megabyte.png" width="20" height="20" /></td>
<td> 24.5 MB</td>
</tr>
<tr>
<td><img alt="" src="images/image.png" width="20" height="20" /></td>
<td> 758</td>
</tr>
<tr>
<td><img alt="" src="images/resolution.png" width="20" height="20" /></td>
<td> 3459 x 3294</td>
</tr>
</tbody>
</table>
</br>
<button class="button" name="DownloadRet" onClick="getRetouchedData()">Download</button>
</center>
</div>
<div class="clearer"></div>
</div>
</div>
<!-- #FOOTER -->
<div id="footer1" style="position: fixed; bottom: 0;">
<div class="content-wrapper">
<div class="ft-div-left"> </div>
<div class="ft-div-right">
<p></p>
</div>
<div class="ft-div-middle">
<center>
<p>
<center>
<span class="icon-facebook4" id="facebook" style="color: white;"></span>
<span class="icon-network" id="website" style="color: white;"></span>
<span class="icon-stumbleupon3" id="issuu" style="color: white;"></span>
<span class ="icon-twitter3"></span>
</br>
<br>
<br>
<span style="font-family:'Open Sans',sans-serif; font-size:11px; color:grey;">© 2014. Frederik Wilhelm. All Rights Reserved.</span>
</center>
</p>
</center>
</div>
</div>
</div>
<!-- FOOTER ENDE -->
</div>
My CSS is:
body {
font-family: 'Open Sans', sans-serif;
background-color: #FFF;
position: center;
margin: 0;
padding: 0;
/*height: 350px; */
}
#page1 {
/*font-family: 'Open Sans', sans-serif;*/
background-color: #FFF;
position: center;
}
#header1 {
padding: 5em;
height: 100px;
background-color: #FFF;
background: url(images/myLogo.png) no-repeat scroll transparent;
background-position: center;
/*border-bottom: 3px solid #000;*/
-webkit-box-shadow: 2px 2px 2px rgba(100, 100, 100, 0.6);
-moz-box-shadow: 2px 2px 2px rgba(100, 100, 100, 0.6);
box-shadow: 2px 2px 2px rgba(100, 100, 100, 0.6);
}
#content {
padding: 10px;
padding-bottom: 7em; /* Höhe des Footers */
}
#footer1 {
position: absolute;
bottom: 0;
background: #333;
height: 7em; /* Höhe des Footers*/
width: 100%;
-webkit-box-shadow: 2px -2px 2px rgba(100, 100, 100, 0.6);
-moz-box-shadow: 2px -2px 2px rgba(100, 100, 100, 0.6);
box-shadow: 2px -2px 2px rgba(100, 100, 100, 0.6);
}
/***** 2 INHALTSBOXEN *****/
.wrapper {
width: 630px;
margin: 0 auto;
}
.left_box {
float: left;
padding: 10px;
width: 290px;
height: 350px;
text-align: center;
border: 2px solid white;
margin-top: 10px;
}
.right_box {
float: right;
padding: 10px;
width: 290px;
height: 100%;
text-align: center;
border: 2px solid white;
margin-top: 10px;
}
.clearer {
clear: both;
padding: 1px;
width: 100%;
height: 0.5px;
}
.content-wrapper {
margin: 0 auto;
max-width: 1216px;/*padding: 10px;*/
}
.ft-div-left {
float: left;
}
.ft-div-right {
float: right;
}
.ft-div-middle {
text-align: center;
}
li {
display: block;
float: left;
}
table {
list-style: none;
margin: 0;
padding: 0;
text-align: left;
font-family: 'Open Sans', sans-serif;
font-weight: 200;
font-size: 13px;
}

Just set it to a fix positioned element.
#header1{
position: fixed;
top: 0;
left: 0;
z-index: 999;
}

Add
position:fixed;
into the header1 part of your css.
you could also do it in the call as
<div id="header1" style="position:fixed">

Related

Mautic emailing - problem with spaces between images

I'm hoping someone will help me. I'm programming an email in Mautic and It's almost done but the main problem I have is that: between two images or image and text is a space and I don't know how to remove it. You can see the whole email code here. I would appreciate any advice how to fix this and have a good looking emailing.
/* Take care of image borders and formatting */
img {
max-width: 600px;
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}
a img {
border: none;
}
table {
border-collapse: collapse !important;
}
#outlook a {
padding:0;
}
.ReadMsgBody {
width: 100%;
}
.ExternalClass {
width:100%;
}
.backgroundTable {
margin:0 auto;
padding:0;
width:100% !important;
}
table td {
border-collapse: collapse;
}
.ExternalClass * {
line-height: 115%;
}
/* General styling */
td {
font-family: Arial, sans-serif;
}
body {
-webkit-font-smoothing:antialiased;
-webkit-text-size-adjust:none;
width: 100%;
height: 100%;
color: #000000;
font-weight: 400;
font-size: 18px;
}
h1, h2, h3, h4 {
text-align: center;
}
a {
color: #e86047;
text-decoration: none;
}
.force-full-width {
width: 100% !important;
}
.body-padding {
padding: 0 75px;
}
</style>
<style type="text/css" media="screen">
#media screen {
#import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,900);
/* Thanks Outlook 2013! */
body {
font-family: 'Source Sans Pro', 'Helvetica Neue', 'Arial', 'sans-serif' !important;
}
.w280 {
width: 280px !important;
}
}
</style>
<style type="text/css" media="only screen and (max-width: 480px)">
/* Mobile styles */
#media only screen and (max-width: 480px) {
table[class*="w320"] {
width: 320px !important;
}
td[class*="w320"] {
width: 280px !important;
padding-left: 20px !important;
padding-right: 20px !important;
}
img[class*="w320"] {
width: 250px !important;
height: 67px !important;
}
td[class*="mobile-spacing"] {
padding-top: 10px !important;
padding-bottom: 10px !important;
}
*[class*="mobile-hide"] {
display: none !important;
}
*[class*="mobile-br"] {
font-size: 12px !important;
}
td[class*="mobile-w20"] {
width: 20px !important;
}
img[class*="mobile-w20"] {
width: 20px !important;
}
td[class*="mobile-center"] {
text-align: center !important;
}
table[class*="w100p"] {
width: 100% !important;
}
td[class*="activate-now"] {
padding-right: 0 !important;
padding-top: 20px !important;
}
[class="mobile-block"] {
width: 100% !important;
display: block !important;
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" class=" responsejs " style="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{subject}
</title>
</head>
<body offset="0" class="body ui-sortable" style="padding: 0px; margin: 0px; display: block; background: rgb(238, 235, 235); text-size-adjust: none; -webkit-font-smoothing: antialiased; width: 100%; height: 100%; color: #000000; font-weight: 400; font-size: 18px; cursor: auto; overflow: visible;" bgcolor="#eeebeb">
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<center>
<table data-section="1" style="margin: 0 auto;border-collapse: collapse !important;width: 600px;" class="w320" cellpadding="0" cellspacing="0" width="600">
<tbody>
<tr>
<td data-slot-container="1" valign="top" class="mobile-block ui-sortable">
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; padding-bottom: 0px; padding-top: 10px;" data-param-padding-bottom="0" data-param-padding-top="10">
<img src="https://marketingheroes.cz/mautic/media/images/9b5eae91041367cd39287b92bdb3d3e9.png" alt="An image" class="fr-view" style="" width="600" height="38.8594" />
<div style="clear:both">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<center>
<table data-section="1" style="margin: 0px auto; width: 600px; border-collapse: collapse !important; background-color: rgb(0, 124, 220);" class="w320" cellpadding="0" cellspacing="0" width="600" bgcolor="#007cdc">
<tbody>
<tr>
<td data-slot-container="1" valign="top" class="mobile-block ui-sortable">
<div data-slot="image" data-param-caption-color="129ac7" data-param-align="1" data-param-text-align="1" style="text-align: center; position: relative; left: 0px; top: 0px; padding-top: 0px; padding-bottom: 0px;" class="" data-param-padding-top="0" data-param-padding-bottom="0">
<img src="https://marketingheroes.cz/mautic/media/images/388aa6e28fba0481dad8773fc042558a.png" alt="An image" class="fr-view" style="width: 518px; height: 291.375px;" width="518" height="291.375" />
<div style="clear:both">
</div>
</div>
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; text-align: center;" data-param-align="1" data-param-text-align="1">
<img src="https://marketingheroes.cz/mautic/media/images/242f21a049c560ab1395166265f0c254.png" alt="An image" class="fr-view" style="width: 480px; height: 52px; display: inline-block; vertical-align: bottom; margin-right: 5px; margin-left: 5px; max-width: calc(100% - 10px);" width="480" height="52" />
<div style="clear:both">
</div>
</div>
<div data-slot="text" data-param-padding-top="" style="padding-top: 10px; position: relative; left: 0px; top: 0px; padding-bottom: 0px;" class="" data-param-padding-bottom="">
<h1>
...přiletí kdykoliv budete v nesnázích se svým marketingem na sociálních sítích!
</h1>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<center>
<table data-section="1" style="margin: 0px auto; width: 600px; border-collapse: collapse !important; background-color: rgb(255, 255, 255);" class="w320" cellpadding="0" cellspacing="0" width="600" bgcolor="#ffffff">
<tbody>
<tr>
<td data-slot-container="1" valign="top" class="mobile-block ui-sortable">
<div data-slot="image" data-param-background-color="ffffff" class="" style="position: relative; left: 0px; top: 0px; padding-top: 0px; text-align: center; padding-bottom: 0px;" data-param-padding-top="0" data-param-text-align="1" data-param-align="1" data-param-padding-bottom="0">
<img src="https://marketingheroes.cz/mautic/media/images/678d01285b77fb587bdb653e5ebcd9d2.png" alt="An image" class="fr-view" style="width: 630px; height: 144.359px;" width="630" height="144.359" />
<div style="clear:both">
</div>
</div>
<div data-slot="text" data-param-padding-top="25" style="padding-top: 25px; padding-bottom: 2px; position: relative; left: 0px; top: 0px;" data-param-padding-bottom="" class="">
<h2>1. Neumíte si spravovat sociální sítě a výkonnostní reklamu?
</h2>
<h3>Nevadí! Ukážeme vám, co teď na sociálních sítích “letí” a nenecháme Vám to uletět...
</h3>
<h4>
<b>Domluvte si online konzultaci ZDARMA >>>
</b>
</h4>
</div>
<div data-slot="image" data-param-align="1" data-param-text-align="1" style="text-align: center; padding-bottom: 0px; position: relative; left: 0px; top: 0px;" data-param-padding-bottom="" class="">
<img src="https://marketingheroes.cz/mautic/media/images/491683509f0d67fda7fb2c1c13294381.gif" alt="An image" class="fr-view" style="" width="500" height="270" />
<div style="clear:both">
</div>
</div>
<div data-slot="text" data-param-padding-top="25" style="padding-top: 25px; padding-bottom: 2px; position: relative; left: 0px; top: 0px;" data-param-padding-bottom="" class="">
<h2>2. Sociální sítě vám již spravuje agentura, ale chcete to levněji nebo s lepším obsahem a výsledky?
</h2>
<h3>Korona Vánoce 2020 jsou za rohem a VY chcete být vidět! Vystřelte s námi ke hvězdám nebo upadněte v zapomnění...
</h3>
<h4>Chceme se připravit na Vánoce 2020
</h4>
</div>
<div data-slot="image" data-param-align="1" data-param-text-align="1" style="text-align: center; padding-bottom: 0px; position: relative; left: 0px; top: 0px;" data-param-padding-bottom="" class="">
<img src="https://marketingheroes.cz/mautic/media/images/8b62f9bfeb9fe97ba57cc9c7f4207294.gif" alt="An image" class="fr-view" style="" width="500" height="270" />
<div style="clear:both">
</div>
</div>
<div data-slot="text" data-param-padding-top="25" style="padding-top: 25px; padding-bottom: 2px; position: relative; left: 0px; top: 0px;" data-param-padding-bottom="" class="">
<h2>3. Máte skvÄ›lĂ˝ produkt, ale neumĂ­te ho “prodat” na sociálnĂ­ch sĂ­tĂ­ch?Â
</h2>
<h3>Ukažme ten vzácný poklad, který schováváte ve skladu světu…
<br />“A brzy budete hodně někde!” - Jolanda
</h3>
<h4>Chceme zaujmout a udržet si #nové zákazníky
</h4>
</div>
<div data-slot="image" data-param-align="1" data-param-text-align="1" style="text-align: center; padding-bottom: 0px; position: relative; left: 0px; top: 0px;" data-param-padding-bottom="" class="">
<img src="https://marketingheroes.cz/mautic/media/images/f0d774b5c8e6e5266520a3a9da2b5106.gif" alt="An image" class="fr-view" style="" width="500" height="270" />
<div style="clear:both">
</div>
</div>
<div data-slot="text" class="" style="position: relative; left: 0px; top: 0px;">
<h2>PojÄŹme se do toho spoleÄŤnÄ› zakousnout!
</h2>
</div>
<div data-slot="text" class="" style="position: relative; left: 0px; top: 0px;">
<div style="text-align: center;">„Bez strategie jsou sociální sítě bezedná studna na peníze… S tou správnou se stanou vaším zlatým dolem!“
</div>
</div>
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; padding-bottom: 0px; padding-top: 25px;" data-param-padding-bottom="0" data-param-padding-top="25">
<img src="https://marketingheroes.cz/mautic/media/images/aea055b371bb7e76cc1c7a54ef5e9236.png" alt="An image" class="fr-view" style="width: 625px; height: 141.875px;" width="625" height="141.875" />
<div style="clear:both">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<center>
<table data-section="1" style="margin: 0 auto;border-collapse: collapse !important;width: 600px;" class="w320" cellpadding="0" cellspacing="0" width="600">
<tbody>
<tr>
<td data-slot-container="1" valign="top" class="mobile-block ui-sortable" style="padding-top: 0px; padding-bottom: 0px;">
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; padding-top: 0px; padding-bottom: 0px;" data-param-padding-top="0" data-param-padding-bottom="0">
<img src="https://marketingheroes.cz/mautic/media/images/b3dc602ff2dc0093a218d69e6302d700.png" alt="An image" class="fr-view" style="" width="600" height="39.0625" />
<div style="clear:both">
</div>
</div>
<div data-slot="image" data-param-padding-bottom="0" style="padding-bottom: 0px; padding-top: 25px;" data-param-padding-top="25">
<img src="https://marketingheroes.cz/mautic/media/images/7c9dcd22c754b6c9352d5350fa34dfe4.png" alt="An image" class="fr-view" style="" width="600" height="38.8594" />
<div style="clear:both">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<center>
<table data-section="1" style="margin: 0px auto; width: 600px; border-collapse: collapse !important; background-color: rgb(0, 124, 220);" class="w320" cellpadding="0" cellspacing="0" width="600" bgcolor="#007cdc">
<tbody>
<tr>
<td data-slot-container="1" valign="top" class="mobile-block ui-sortable">
<div data-slot="text" class="" style="position: relative; left: 0px; top: 0px; padding-top: 0px; padding-bottom: 0px;" data-param-padding-top="0" data-param-padding-bottom="0">
<h2>
<b>SkonÄŤete s tou nudou
<br />a začněte to s marketingovým HRDINOU!
</b>
</h2>
</div>
<div data-slot="button" class="" data-param-float="1" align="center" style="position: relative; left: 0px; top: 0px;" data-param-background-color="2ecb71" data-param-link-text="Podívejte se, co děláme jinak?" data-param-button-size="0">
<a href="#" class="button" target="_blank" style="border-color: rgb(46, 203, 113); border-width: 10px 20px; border-style: solid; text-decoration: none; border-radius: 3px; background-color: rgb(46, 203, 113); display: inline-block; font-size: 14px; color: rgb(255, 255, 255); padding: 0px;" background="#2ecb71">Podívejte se, co děláme jinak?
</a>
<div style="clear:both">
</div>
</div>
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; text-align: center; padding-top: 0px; padding-bottom: 0px;" data-param-align="1" data-param-text-align="1" data-param-background-color="007cdc" data-param-padding-top="0" data-param-padding-bottom="0">
<img src="https://marketingheroes.cz/mautic/media/images/31a746de9d24870a515b695106eca718.png" alt="An image" class="fr-view" style="width: 633px; height: 600px;" width="633" height="600" />
<div style="clear:both">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<div data-section-wrapper="one-column">
<center>
<table data-section="1" cellspacing="0" cellpadding="0" width="600" class="w320" bgcolor="#ffffff" style="background-color: rgb(255, 255, 255); border-collapse: collapse !important;">
<tbody>
<tr>
<td style="font-family: Arial, sans-serif;border-collapse: collapse;">
<table cellspacing="0" cellpadding="0" class="force-full-width" style="border-collapse: collapse !important;width: 100% !important;">
<tbody>
<tr>
<td data-slot-container="1" style="text-align: center;font-family: Arial, sans-serif;border-collapse: collapse;" class="ui-sortable">
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; padding-top: 0px; padding-bottom: 0px;" data-param-background-color="ffffff" data-param-padding-top="0" data-param-padding-bottom="0">
<img src="https://marketingheroes.cz/mautic/media/images/b5bd5c6bd42ece031ebeab79b8d8a7b6.png" alt="An image" class="fr-view" style="width: 627px; height: 144.375px;" width="627" height="144.375" />
<div style="clear:both">
</div>
</div>
<div data-slot="text">
<br />
<br />
<img width="62" height="56" img="" src="https://www.marketingheroes.cz/mautic/themes/sunday/img/gplus.gif" style="max-width: 600px;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;" />
<img width="68" height="56" src="https://www.marketingheroes.cz/mautic/themes/sunday/img/facebook.gif" style="max-width: 600px;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;" />
<img width="61" height="56" src="https://www.marketingheroes.cz/mautic/themes/sunday/img/twitter.gif" style="max-width: 600px;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;" />
<br />
<br />
</div>
<div data-slot="text" class="" style="position: relative; left: 0px; top: 0px;">
<h3>Chcete vědět více... Neváhejte napsat na > chceme#marketingheroes.cz nebo si nás najděte na:
<br />NovĂ© sady 988/2, 602 00 BrnoÂ
</h3>
</div>
<div data-slot="text" class="" style="position: relative; left: 0px; top: 0px; padding-bottom: 0px;" data-param-padding-bottom="0">
<a href="{webview_url}">View in browser
</a> |
<a href="{unsubscribe_url}">Unsubscribe
</a>
</div>
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; padding-bottom: 0px; padding-top: 25px;" data-param-padding-bottom="0" data-param-padding-top="25">
<img src="https://marketingheroes.cz/mautic/media/images/f0767d753e853646327c8a1331953ce9.png" alt="An image" class="fr-view" style="" width="600" height="141.875" />
<div style="clear:both">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</center>
</div>
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<center>
<table data-section="1" style="margin: 0 auto;border-collapse: collapse !important;width: 600px;" class="w320" cellpadding="0" cellspacing="0" width="600">
<tbody>
<tr>
<td data-slot-container="1" valign="top" class="mobile-block ui-sortable">
<div data-slot="image" data-param-padding-top="0" data-param-padding-bottom="0" style="padding-top: 0px; padding-bottom: 0px; position: relative; left: 0px; top: 0px;" class="">
<img src="https://marketingheroes.cz/mautic/media/images/650aca3949de51ca4c276c92b8beef9e.png" alt="An image" class="fr-view" style="" width="600" height="39.0625" />
<div style="clear:both">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
</body>
</html>
I just add margin-bottom:-5px; to set correctly this white sepration you had and it is fixed properly and worked for all devices.
/* Take care of image borders and formatting */
img {
max-width: 600px;
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}
a img {
border: none;
}
table {
border-collapse: collapse !important;
}
#outlook a {
padding:0;
}
.ReadMsgBody {
width: 100%;
}
.ExternalClass {
width:100%;
}
.backgroundTable {
margin:0 auto;
padding:0;
width:100% !important;
}
table td {
border-collapse: collapse;
}
.ExternalClass * {
line-height: 115%;
}
/* General styling */
td {
font-family: Arial, sans-serif;
}
body {
-webkit-font-smoothing:antialiased;
-webkit-text-size-adjust:none;
width: 100%;
height: 100%;
color: #000000;
font-weight: 400;
font-size: 18px;
}
h1, h2, h3, h4 {
text-align: center;
}
a {
color: #e86047;
text-decoration: none;
}
.force-full-width {
width: 100% !important;
}
.body-padding {
padding: 0 75px;
}
</style>
<style type="text/css" media="screen">
#media screen {
#import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,900);
/* Thanks Outlook 2013! */
body {
font-family: 'Source Sans Pro', 'Helvetica Neue', 'Arial', 'sans-serif' !important;
}
.w280 {
width: 280px !important;
}
}
</style>
<style type="text/css" media="only screen and (max-width: 480px)">
/* Mobile styles */
#media only screen and (max-width: 480px) {
table[class*="w320"] {
width: 320px !important;
}
td[class*="w320"] {
width: 280px !important;
padding-left: 20px !important;
padding-right: 20px !important;
}
img[class*="w320"] {
width: 250px !important;
height: 67px !important;
}
td[class*="mobile-spacing"] {
padding-top: 10px !important;
padding-bottom: 10px !important;
}
*[class*="mobile-hide"] {
display: none !important;
}
*[class*="mobile-br"] {
font-size: 12px !important;
}
td[class*="mobile-w20"] {
width: 20px !important;
}
img[class*="mobile-w20"] {
width: 20px !important;
}
td[class*="mobile-center"] {
text-align: center !important;
}
table[class*="w100p"] {
width: 100% !important;
}
td[class*="activate-now"] {
padding-right: 0 !important;
padding-top: 20px !important;
}
[class="mobile-block"] {
width: 100% !important;
display: block !important;
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" class=" responsejs " style="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{subject}
</title>
</head>
<body offset="0" class="body ui-sortable" style="padding: 0px; margin: 0px; display: block; background: rgb(238, 235, 235); text-size-adjust: none; -webkit-font-smoothing: antialiased; width: 100%; height: 100%; color: #000000; font-weight: 400; font-size: 18px; cursor: auto; overflow: visible;" bgcolor="#eeebeb">
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<center>
<table data-section="1" style="margin: 0 auto;border-collapse: collapse !important;width: 600px;" class="w320" cellpadding="0" cellspacing="0" width="600">
<tbody>
<tr>
<td data-slot-container="1" valign="top" class="mobile-block ui-sortable">
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; padding-bottom: 0px; padding-top: 10px; margin-bottom:-5px;" data-param-padding-bottom="0" data-param-padding-top="10">
<img src="https://marketingheroes.cz/mautic/media/images/9b5eae91041367cd39287b92bdb3d3e9.png" alt="An image" class="fr-view" style="" width="600" height="38.8594" />
<div style="clear:both">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<center>
<table data-section="1" style="margin: 0px auto; width: 600px; border-collapse: collapse !important; background-color: rgb(0, 124, 220);" class="w320" cellpadding="0" cellspacing="0" width="600" bgcolor="#007cdc">
<tbody>
<tr>
<td data-slot-container="1" valign="top" class="mobile-block ui-sortable">
<div data-slot="image" data-param-caption-color="129ac7" data-param-align="1" data-param-text-align="1" style="text-align: center; position: relative; left: 0px; top: 0px; padding-top: 0px; padding-bottom: 0px;" class="" data-param-padding-top="0" data-param-padding-bottom="0">
<img src="https://marketingheroes.cz/mautic/media/images/388aa6e28fba0481dad8773fc042558a.png" alt="An image" class="fr-view" style="width: 518px; height: 291.375px;" width="518" height="291.375" />
<div style="clear:both">
</div>
</div>
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; text-align: center;" data-param-align="1" data-param-text-align="1">
<img src="https://marketingheroes.cz/mautic/media/images/242f21a049c560ab1395166265f0c254.png" alt="An image" class="fr-view" style="width: 480px; height: 52px; display: inline-block; vertical-align: bottom; margin-right: 5px; margin-left: 5px; max-width: calc(100% - 10px);" width="480" height="52" />
<div style="clear:both">
</div>
</div>
<div data-slot="text" data-param-padding-top="" style="padding-top: 10px; position: relative; left: 0px; top: 0px; padding-bottom: 0px;" class="" data-param-padding-bottom="">
<h1>
...přiletí kdykoliv budete v nesnázích se svým marketingem na sociálních sítích!
</h1>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<center>
<table data-section="1" style="margin: 0px auto; width: 600px; border-collapse: collapse !important; background-color: rgb(255, 255, 255);" class="w320" cellpadding="0" cellspacing="0" width="600" bgcolor="#ffffff">
<tbody>
<tr>
<td data-slot-container="1" valign="top" class="mobile-block ui-sortable">
<div data-slot="image" data-param-background-color="ffffff" class="" style="position: relative; left: 0px; top: 0px; padding-top: 0px; text-align: center; padding-bottom: 0px;" data-param-padding-top="0" data-param-text-align="1" data-param-align="1" data-param-padding-bottom="0">
<img src="https://marketingheroes.cz/mautic/media/images/678d01285b77fb587bdb653e5ebcd9d2.png" alt="An image" class="fr-view" style="width: 630px; height: 144.359px;" width="630" height="144.359" />
<div style="clear:both">
</div>
</div>
<div data-slot="text" data-param-padding-top="25" style="padding-top: 25px; padding-bottom: 2px; position: relative; left: 0px; top: 0px;" data-param-padding-bottom="" class="">
<h2>1. Neumíte si spravovat sociální sítě a výkonnostní reklamu?
</h2>
<h3>Nevadí! Ukážeme vám, co teď na sociálních sítích “letí” a nenecháme Vám to uletět...
</h3>
<h4>
<b>Domluvte si online konzultaci ZDARMA >>>
</b>
</h4>
</div>
<div data-slot="image" data-param-align="1" data-param-text-align="1" style="text-align: center; padding-bottom: 0px; position: relative; left: 0px; top: 0px;" data-param-padding-bottom="" class="">
<img src="https://marketingheroes.cz/mautic/media/images/491683509f0d67fda7fb2c1c13294381.gif" alt="An image" class="fr-view" style="" width="500" height="270" />
<div style="clear:both">
</div>
</div>
<div data-slot="text" data-param-padding-top="25" style="padding-top: 25px; padding-bottom: 2px; position: relative; left: 0px; top: 0px;" data-param-padding-bottom="" class="">
<h2>2. Sociální sítě vám již spravuje agentura, ale chcete to levněji nebo s lepším obsahem a výsledky?
</h2>
<h3>Korona Vánoce 2020 jsou za rohem a VY chcete být vidět! Vystřelte s námi ke hvězdám nebo upadněte v zapomnění...
</h3>
<h4>Chceme se připravit na Vánoce 2020
</h4>
</div>
<div data-slot="image" data-param-align="1" data-param-text-align="1" style="text-align: center; padding-bottom: 0px; position: relative; left: 0px; top: 0px;" data-param-padding-bottom="" class="">
<img src="https://marketingheroes.cz/mautic/media/images/8b62f9bfeb9fe97ba57cc9c7f4207294.gif" alt="An image" class="fr-view" style="" width="500" height="270" />
<div style="clear:both">
</div>
</div>
<div data-slot="text" data-param-padding-top="25" style="padding-top: 25px; padding-bottom: 2px; position: relative; left: 0px; top: 0px;" data-param-padding-bottom="" class="">
<h2>3. Máte skvÄ›lĂ˝ produkt, ale neumĂ­te ho “prodat” na sociálnĂ­ch sĂ­tĂ­ch?Â
</h2>
<h3>Ukažme ten vzácný poklad, který schováváte ve skladu světu…
<br />“A brzy budete hodně někde!” - Jolanda
</h3>
<h4>Chceme zaujmout a udržet si #nové zákazníky
</h4>
</div>
<div data-slot="image" data-param-align="1" data-param-text-align="1" style="text-align: center; padding-bottom: 0px; position: relative; left: 0px; top: 0px;" data-param-padding-bottom="" class="">
<img src="https://marketingheroes.cz/mautic/media/images/f0d774b5c8e6e5266520a3a9da2b5106.gif" alt="An image" class="fr-view" style="" width="500" height="270" />
<div style="clear:both">
</div>
</div>
<div data-slot="text" class="" style="position: relative; left: 0px; top: 0px;">
<h2>PojÄŹme se do toho spoleÄŤnÄ› zakousnout!
</h2>
</div>
<div data-slot="text" class="" style="position: relative; left: 0px; top: 0px;">
<div style="text-align: center;">„Bez strategie jsou sociální sítě bezedná studna na peníze… S tou správnou se stanou vaším zlatým dolem!“
</div>
</div>
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; padding-bottom: 0px; padding-top: 25px; margin-bottom:-5px;" data-param-padding-bottom="0" data-param-padding-top="25">
<img src="https://marketingheroes.cz/mautic/media/images/aea055b371bb7e76cc1c7a54ef5e9236.png" alt="An image" class="fr-view" style="width: 625px; height: 141.875px;" width="625" height="141.875" />
<div style="clear:both">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<center>
<table data-section="1" style="margin: 0 auto;border-collapse: collapse !important;width: 600px;" class="w320" cellpadding="0" cellspacing="0" width="600">
<tbody>
<tr>
<td data-slot-container="1" valign="top" class="mobile-block ui-sortable" style="padding-top: 0px; padding-bottom: 0px;">
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; padding-top: 0px; padding-bottom: 0px;" data-param-padding-top="0" data-param-padding-bottom="0">
<img src="https://marketingheroes.cz/mautic/media/images/b3dc602ff2dc0093a218d69e6302d700.png" alt="An image" class="fr-view" style="" width="600" height="39.0625" />
<div style="clear:both">
</div>
</div>
<div data-slot="image" data-param-padding-bottom="0" style="padding-bottom: 0px; padding-top: 25px;margin-bottom:-5px;" data-param-padding-top="25">
<img src="https://marketingheroes.cz/mautic/media/images/7c9dcd22c754b6c9352d5350fa34dfe4.png" alt="An image" class="fr-view" style="" width="600" height="38.8594" />
<div style="clear:both">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<center>
<table data-section="1" style="margin: 0px auto; width: 600px; border-collapse: collapse !important; background-color: rgb(0, 124, 220);" class="w320" cellpadding="0" cellspacing="0" width="600" bgcolor="#007cdc">
<tbody>
<tr>
<td data-slot-container="1" valign="top" class="mobile-block ui-sortable">
<div data-slot="text" class="" style="position: relative; left: 0px; top: 0px; padding-top: 0px; padding-bottom: 0px;" data-param-padding-top="0" data-param-padding-bottom="0">
<h2>
<b>SkonÄŤete s tou nudou
<br />a začněte to s marketingovým HRDINOU!
</b>
</h2>
</div>
<div data-slot="button" class="" data-param-float="1" align="center" style="position: relative; left: 0px; top: 0px;" data-param-background-color="2ecb71" data-param-link-text="Podívejte se, co děláme jinak?" data-param-button-size="0">
<a href="#" class="button" target="_blank" style="border-color: rgb(46, 203, 113); border-width: 10px 20px; border-style: solid; text-decoration: none; border-radius: 3px; background-color: rgb(46, 203, 113); display: inline-block; font-size: 14px; color: rgb(255, 255, 255); padding: 0px;" background="#2ecb71">Podívejte se, co děláme jinak?
</a>
<div style="clear:both">
</div>
</div>
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; text-align: center; padding-top: 0px; padding-bottom: 0px;" data-param-align="1" data-param-text-align="1" data-param-background-color="007cdc" data-param-padding-top="0" data-param-padding-bottom="0">
<img src="https://marketingheroes.cz/mautic/media/images/31a746de9d24870a515b695106eca718.png" alt="An image" class="fr-view" style="width: 633px; height: 600px;" width="633" height="600" />
<div style="clear:both">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<div data-section-wrapper="one-column">
<center>
<table data-section="1" cellspacing="0" cellpadding="0" width="600" class="w320" bgcolor="#ffffff" style="background-color: rgb(255, 255, 255); border-collapse: collapse !important;">
<tbody>
<tr>
<td style="font-family: Arial, sans-serif;border-collapse: collapse;">
<table cellspacing="0" cellpadding="0" class="force-full-width" style="border-collapse: collapse !important;width: 100% !important;">
<tbody>
<tr>
<td data-slot-container="1" style="text-align: center;font-family: Arial, sans-serif;border-collapse: collapse;" class="ui-sortable">
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; padding-top: 0px; padding-bottom: 0px;" data-param-background-color="ffffff" data-param-padding-top="0" data-param-padding-bottom="0">
<img src="https://marketingheroes.cz/mautic/media/images/b5bd5c6bd42ece031ebeab79b8d8a7b6.png" alt="An image" class="fr-view" style="width: 627px; height: 144.375px;" width="627" height="144.375" />
<div style="clear:both">
</div>
</div>
<div data-slot="text">
<br />
<br />
<img width="62" height="56" img="" src="https://www.marketingheroes.cz/mautic/themes/sunday/img/gplus.gif" style="max-width: 600px;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;" />
<img width="68" height="56" src="https://www.marketingheroes.cz/mautic/themes/sunday/img/facebook.gif" style="max-width: 600px;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;" />
<img width="61" height="56" src="https://www.marketingheroes.cz/mautic/themes/sunday/img/twitter.gif" style="max-width: 600px;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;" />
<br />
<br />
</div>
<div data-slot="text" class="" style="position: relative; left: 0px; top: 0px;">
<h3>Chcete vědět více... Neváhejte napsat na > chceme#marketingheroes.cz nebo si nás najděte na:
<br />NovĂ© sady 988/2, 602 00 BrnoÂ
</h3>
</div>
<div data-slot="text" class="" style="position: relative; left: 0px; top: 0px; padding-bottom: 0px;" data-param-padding-bottom="0">
<a href="{webview_url}">View in browser
</a> |
<a href="{unsubscribe_url}">Unsubscribe
</a>
</div>
<div data-slot="image" class="" style="position: relative; left: 0px; top: 0px; padding-bottom: 0px; padding-top: 25px; margin-bottom:-5px;" data-param-padding-bottom="0" data-param-padding-top="25">
<img src="https://marketingheroes.cz/mautic/media/images/f0767d753e853646327c8a1331953ce9.png" alt="An image" class="fr-view" style="" width="600" height="141.875" />
<div style="clear:both">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</center>
</div>
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<center>
<table data-section="1" style="margin: 0 auto;border-collapse: collapse !important;width: 600px;" class="w320" cellpadding="0" cellspacing="0" width="600">
<tbody>
<tr>
<td data-slot-container="1" valign="top" class="mobile-block ui-sortable">
<div data-slot="image" data-param-padding-top="0" data-param-padding-bottom="0" style="padding-top: 0px; padding-bottom: 0px; position: relative; left: 0px; top: 0px;" class="">
<img src="https://marketingheroes.cz/mautic/media/images/650aca3949de51ca4c276c92b8beef9e.png" alt="An image" class="fr-view" style="" width="600" height="39.0625" />
<div style="clear:both">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
</body>
</html>

Can't position items how I want it

My "Products" bar isn't where is supposed to be. I am trying to put it near my sidebar in left. I don't want so much distance.
I have "float:left". I can't move it to the left using margin-left or right.
If I have "float:right", I can do this, but I don't want that.
I want to set it with "float:left" option.
Photo
tast.html
<!DOCTYPE html>
<html>
<!-- START HEAD -->
<head>
<meta charset="utf-8">
<title>xPeke</title>
<link rel="stylesheet" href="test.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="icon" href="images/favicon-16x16.png" sizes="16x16" type="image/png">
</head>
<!-- END HEAD -->
<!-- START BODY -->
<body>
<div class="content">
<!-- START TOPBAR -->
<div id="program">
<b style="color:black;">Program:</b> Luni-Vineri: 9:00-22:00 Sambata: 9:00–20:00 Duminica: Inchis
Login <span> / </span> Register
</div><br>
<!-- END TOPBAR -->
<!-- START SLIDESHOW -->
<div class="slideshow-container">
<img class="mySlides" src="images/logo1.png" alt="Logo1" width="1500" height="300">
<img class="mySlides" src="images/logo2.png" alt="Logo2" width="1500" height="300">
<img class="mySlides" src="images/logo3.png" alt="Logo3" width="1500" height="300">
<div class="butonpoza">
<button onclick="clearTimeout(timer)">Opreste Animatia</button>
<div class="dotts">
<span class="dot" onclick="currentSlide(1)"></span>
<span class="dot" onclick="currentSlide(2)"></span>
<span class="dot" onclick="currentSlide(3)"></span>
</div>
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a><br>
</div>
<!-- END SLIDESHOW -->
<!-- START LOGO, SEARCH & SOCIAL BAR -->
<div>
<img src="images/logo.png" alt="Logo" width="180" height="45" style="float:left">
<input class="search" type="text" name="search" placeholder="Search..">
<div style="float:right">
<img class="socialmedia" src="images/facebook.png" alt="Facebook">
<img class="socialmedia" src="images/youtube.png" alt="Youtube">
<img class="socialmedia" src="images/reddit.png" alt="Reddit">
</div>
</div>
<!-- END LOGO, SEARCH & SOCIAL BAR -->
<!-- START NAVIGATION BAR -->
<div style="float:left"><br>
<ul>
<li class="dropdown"><a class="active" href="#home">Produse</a>
<div class="dropdown-content">
Laptop, Telefoane & Tablete
Televizoare & Desktop
Tehnologii Smart
Haine & Accesorii
Anime & Manga
Carti de Joc
Jocuri & Jucarii
</div>
</li>
<li>Articole</li>
<li>Promotii</li>
<li>Wishlist</li>
<li>FAQ</li>
<li style="padding: 0px 432.5px;"></li>
<li style="float:right">Cosul meu</li>
<li style="float:right">Contul meu</li>
</ul>
</div>
<!-- END NAVIGATION BAR -->
<!-- START SIDEBAR -->
<div style="float:left"><br>
Noutati
Cele mai populare
Cele mai vandute
Precomenzi
Oferte speciale
<h3>Anunturi</h3>
<aside class="sidebar">
<section class="articles">
<article class="article clearfix">
<img class="article__image" src="images/art1.png" alt="Hello World!">
<div class="article__content">
<h3 class="article__title">Hello Everyone!</h3>
<p class="pby">posted by xPeke</p>
</div>
</article>
<article class="article clearfix">
<img class="article__image" src="images/art2.png" alt="Yu-Gi-Oh!">
<div class="article__content">
<h3 class="article__title">We've added the newest Yu-Gi-Oh cards.</h3>
<p class="pby">posted by Rekkles</p>
</div>
</article>
<article class="article clearfix">
<img class="article__image" src="images/art3.png" alt="iPhone">
<div class="article__content">
<h3 class="article__title">A aparut noul iphone 8.</h3>
<p class="pby">posted by Soaz</p>
</div>
</article>
</section>
</aside>
<form class="twentyone">
<fieldset>
<legend>Newsletter</legend><br>
<div>
Daca vrei sa afli ultimele promotii si noutați aboneaza-te la newsletter-ul Fnatic!
</div><br>
<div>
<input class="newslt" type="text" name="newslt" placeholder="Email">
</div><br>
<div>
<button class="fltrgt" type="submit">Aboneaza-te!</button>
</div>
</fieldset>
</form><br>
</div>
<!-- END SIDEBAR -->
<!-- START PRODUSE RECOMANDATE BAR -->
<div class="prodrec">
<h2> Products </h2>
<table>
<tr>
<td>
<div id="1" class="items">
<img src="img/products/robot1.jpg"/>
<span class="desc">Description</span>
<span class="price">$100</span>
<span class="other">Other</span>
<button>BUY</button>
</div>
</td>
<td>
<div id="2" class="items">
<img src="img/products/robot1.jpg"/>
<span class="desc">Description</span>
<span class="price">$100</span>
<span class="other">Other</span>
<button>BUY</button>
</div>
</td>
<td>
<div id="3" class="items">
<img src="img/products/robot1.jpg"/>
<span class="desc">Description</span>
<span class="price">$100</span>
<span class="other">Other</span>
<button>BUY</button>
</div>
</td>
</tr>
<!-- Spatiu-->
<tr>
<td></td>
<td><br></td>
</tr>
<!-- pana aici-->
<tr>
<td>
<div id="4" class="items">
<img src="img/products/robot1.jpg"/>
<span class="desc">Description</span>
<span class="price">$100</span>
<span class="other">Other</span>
<button>BUY</button>
</div>
</td>
<td>
<div id="5" class="items">
<img src="img/products/robot1.jpg"/>
<span class="desc">Description</span>
<span class="price">$100</span>
<span class="other">Other</span>
<button>BUY</button>
</div>
</td>
<td>
<div id="6" class="items">
<img src="img/products/robot1.jpg"/>
<span class="desc">Description</span>
<span class="price">$100</span>
<span class="other">Other</span>
<button>BUY</button>
</div>
</td>
</tr>
<!-- Spatiu-->
<tr>
<td></td>
<td><br></td>
</tr>
<!-- pana aici-->
<tr>
<td>
<div id="7" class="items">
<img src="img/products/robot1.jpg"/>
<span class="desc">Description</span>
<span class="price">$100</span>
<span class="other">Other</span>
<button>BUY</button>
</div>
</td>
<td>
<div id="8" class="items">
<img src="img/products/robot1.jpg"/>
<span class="desc">Description</span>
<span class="price">$100</span>
<span class="other">Other</span>
<button>BUY</button>
</div>
</td>
<td>
<div id="9" class="items">
<img src="img/products/robot1.jpg"/>
<span class="desc">Description</span>
<span class="price">$100</span>
<span class="other">Other</span>
<button>BUY</button>
</div>
</td>
</tr>
<!-- Spatiu-->
<tr>
<td></td>
<td><br></td>
</tr>
<!-- pana aici-->
</table>
</div>
<!-- END PRODUSE RECOMANDATE BAR -->
<div style="float:right">
<h1> RIGHT! </h1>
</div>
<!-- START SCRIPT ZONE -->
<script>
var slideIndex = 1;
var timer = null;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n==undefined){n = ++slideIndex}
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
timer = setTimeout(showSlides, 10000);
}
</script>
<!-- END SCRIPT ZONE -->
<!-- START FOOTER -->
<footer style="float:left">
<div class="skills">© Cat e facut din site pana acum: 60%</div>
</footer>
<!-- END FOOTER -->
</div>
</body>
<!-- END BODY -->
</html>
test.css
.prodrec{
float: left;
}
/* START BODY */
body{
background-image: url("images/bgd.png");
background-repeat: repeat;
}
.content {
max-width: 1500px;
margin: auto;
padding: 10px;
}
/* END BODY */
/* START TOPBAR */
#program{
font-size: 90%;
font-family: 'Oswald', sans-serif;
color: #2E2EFE;
font-style: normal;
font-weight: 700;
padding: 0;
border: 0;
text-transform: uppercase;
padding-bottom: 0;
}
a{
color: #2E2EFE;
text-decoration: none;
font-weight: 700;
}
/* END TOPBAR */
/* START SLIDESHOW */
.slideshow-container{
position: relative;
}
.mySlides{
display:none;
width:100%;
}
.butonpoza{
float: right;
margin-right: 10px;
margin-top: -30px;
position:relative;
}
/* END SLIDESHOW */
/* START SAGETI */
.prev, .next{
cursor: pointer;
position: absolute;
top: 50%;
width: 15px;
padding: 16px;
margin-top: -50px;
color: white;
font-weight: bold;
font-size: 25px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
}
.next{
width: 15px;
right: 0px;
border-radius: 3px 0 0 3px;
}
.prev:hover, .next:hover{
background-color: rgba(0,0,0,0.8);
}
/* END SAGETI */
/* START DOTTS */
.dot{
cursor:pointer;
height: 17px;
width: 17px;
margin: 0 10px;
background-color: black;
border-radius: 50%;
display: inline-block;
transition: background-color 0.6s ease;
}
.active, .dot:hover{
background-color: white;
}
.dotts{
text-align: center;
margin-left: -1362px;
margin-top: -20px;
}
/* END DOTTS */
/* START SEARCH AND SOCIAL BAR */
.search{
width: 10px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-image: url("images/search.png");
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 12px 40px;
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
margin-left: 32px;
width: 69%;
}
.socialmedia{
height: 50px;
width: 50px;
}
/* END SEARCH AND SOCIAL BAR */
/* START NAVIGATION BAR */
ul{
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li{
float: left;
}
li a{
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover:not(.active){
background-color: #111;
}
.dropdown{
float: left;
overflow: hidden;
}
.dropdown .dropbtn{
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
}
.active{
background-color: #4CAF50;
}
.dropdown-content{
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a{
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover:not(.active){
background-color: #ddd;
}
.dropdown:hover .dropdown-content{
display: block;
}
/* END NAVIGATION BAR */
/* START SIDEBAR */
.da{
display: block;
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.2);
background-color: #f9f9f9;
text-transform: uppercase;
box: 5px;
width: 250px;
border: 1px solid #555;
}
.da:hover:not(.active){
background-color: #fb2545;
}
.sidebar{
width: 50%;
float: left;
}
.sidebar .article__image{
float: left;
width: 35%;
}
.sidebar .article__content{
float: right;
width: 61%;
padding-left: 10px;
}
.sidebar .article__title{
display: block;
text-transform: uppercase !important;
line-height: 16px;
font-family: 'Oswald' !important;
}
.pby{
font-family: 'Play', sans-serif;
color: #995d08;
font-size: 13px;
}
.clearfix::after{
content: "";
display: table;
clear: both;
}
.twentyone{
display: block;
width: 50%;
}
.newslt{
width: 130px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-image: url("images/email.png");
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 12px 40px;
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
width: 100%;
}
.fltrgt{
float: right;
}
/* END SIDEBAR */
/* START PRODUSE RECOMANDATE BAR */
tr{
display: block;
}
td{
display: inline-block;
}
.items{
display: inline-block;
text-align: center;
width: 180px;
margin: 0 7px 0 7px;
padding-top: 10px;
border: 1px solid #999;
border-radius: 20px;
}
.items img{
width: 160px;
height: 140px;
border: 1px solid rgba(207, 207, 207, .7);
}
.items button{
background: #666;
width: 80px;
height: 26px;
float: right;
border-top: 1px solid #999;
border-left: 1px solid #999;
border-right: none;
border-bottom: none;
outline: none;
cursor: pointer;
border-bottom-right-radius: 20px;
transition: background 0.2s ease-in;
}
.items button:hover{
background: #888;
}
.desc, .price, .other{
display: block;
margin-bottom: 10px;
}
/* END PRODUSE RECOMANDATE BAR */
/* START FOOTER */
footer{
height: 40px;
width: 60%;
text-align: center;
color: white;
background-color: #2196F3;
}
.skills{
text-align: right;
padding-right: 20px;
line-height: 40px;
color: white;
}
/* END FOOTER */
Have you considered using bootstrap to create your layout? It makes things like this really easy.
Check it out here : http://getbootstrap.com/examples/grid/
You can use pull-right and pull-left within your columns to align your content and text-right and text-left for text.
I believe pull-right and pull-left have been replaced with float-right and float-left in Bootstrap 4.
Have fun experimenting with bootstrap!
This site lets you play around with your layouts also http://www.bootply.com

How can I horizontally align these divs?

I have 7 divs in a row on and I can't get the arrows in the middle to be horizontally in the centre of the outer div.
I've tried
top: 50%;
text-align: centre:
margin: 0 auto;
But none of them seem to work. How can I correct this?
HTML:
<div id="instruct">
<div align="center" class="category">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/07/1-DEVO.png" width="150" height="auto"/>
<p class="ititle">1. You Order</p>
<p class="itext">Shop and browse your favorite<br>brands from your local shops</p>
</div>
<div align="center" class="arrow">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/08/rightgreyarrow.png" width="50" height="auto"/>
</div>
<div align="center" class="category">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/07/2-DEVOnewblue.png" width="175" height="auto"/>
<p class="ititle">2. We Collect</p>
<p class="itext">Our drivers make their way to your<br>local shop</p>
</div>
<div align="center" class="arrow">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/08/rightgreyarrow.png" width="50" height="auto"/>
</div>
<div align="center" class="category">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/07/3-DEVOcolour.png" width="95" height="auto"/>
<p class="ititle">3. We Deliver</p>
<p class="itext">Our drivers make their way to<br>your location</p>
</div>
<div align="center" class="arrow">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/08/rightgreyarrow.png" width="50" height="auto"/>
</div>
<div align="center" class="category">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/07/4-DEVO.png" width="65" height="auto"/>
<p class="ititle">4. You Enjoy</p>
<p class="itext">Track and receive your order<br>in as little as 30 minutes</p>
</div>
</div>
CSS:
#instruct {
height: auto;
width: 100%;
background-color: transparent;
border-bottom: 3px solid #fd0e35;
}
.category {
padding: 40px 50px 10px 50px;
display: inline-block;
}
.arrow {
padding: 0px;
display: inline-block;
border: 1px solid pink;
}
.ititle {
margin-top: 20px;
margin-bottom: 0;
text-transform: uppercase;
font-weight: bold;
font-size: 14px;
color: #a6a6a6;
}
.itext {
font-size: 13px;
}
The simplest solution is the use of vertical-align: middle; on the children of the container:
#instruct > div { vertical-align: middle; }
See this fiddle.
You need to relatively position the element in order for the 'top' property to take effect:
.arrow {
padding: 0px;
display: inline-block;
border: 1px solid pink;
position:relative;
top:-50px; // <---- change this value to suit your preferred positioning.
}

Why is there so much whitespace between the two divs?

Picture of the white space between "header" and "content"
I just got back into web work and cannot figure this out! Theres a big gap between the header div and the content div that isn't present with the sidebar div and the code isn't too different for each one so thats why it confuses me. I don't know where the whitespace is coming from.
I took some stuff out of my code that wasn't relevant but let me know if theres something that isn't there.
<!-- Page Wrap -->
<div class="pagewrap">
<!-- Header -->
<div class="header">
<img src="images/Logo.jpg" width="530" height="180" alt=""/>
</div>
<!-- Header end -->
<!-- Sidebar -->
<div class="sidebartitle">
<center style="color: #FFFFFF">Specials</center>
</div>
<div class="sidebar">
<center>
<div class="page-popper">
</div>
<table width="187" height="196" border="0" align="center">
<tbody>
<tr>
<td><div class="buttonImageWrapper">
<img src="images/M-2.jpg" alt=""/>
</div></td>
<td>
Request an Appointment</td>
</tr>
<tr>
<td><div class="buttonImageWrapper">
<img src="images/M-2.jpg" alt=""/>
</div></td>
<td>Salon Menu</td>
</tr>
<tr>
<td><div class="buttonImageWrapper"><img src="images/M-2.jpg" alt=""/></div></td>
<td>Spa Menu</td>
</tr>
<tr>
<td><div class="buttonImageWrapper"><img src="images/M-2.jpg" alt=""/></div></td>
<td>Bridal Services</td>
</tr>
<tr>
<td><div class="facebookImageWrapper"><img src="images/facebook-logo.png" width="48" height="48"></div></td>
<td>Like us on Facebook</td>
</tr>
</tbody>
</table>
</center>
</div>
<!-- Sidebar end -->
<!-- Content -->
<div class="contenttitle">
<center style="color: #FFFFFF">Welcome</center>
</div>
<div class="content">
<!-- Picture Slider -->
<table width="350" border="0" cellpadding="2" cellspacing="2">
<tr>
<td align="left" valign="top"><div id="p7IRM_1" class="p7IRM01">
<div id="p7IRMow_1" class="p7IRMowrapper">
<div id="p7IRMw_1" class="p7IRMwrapper">
<div id="p7IRMdv_1" class="p7IRMdv"><a class="p7IRMlink" id="p7IRMlk_1" title=""><img class="p7IRMimage" src="../images/new/slide-show1/000.jpg" alt="000" name="p7IRMim_1" width="350" height="233" id="p7IRMim_1" /></a></div>
<div id="p7IRMdsw_1" class="p7IRMdesc_wrapper">
<div class="p7IRMdesc_close"><a id="p7IRMdsclose_1" href="javascript:;" title="Hide Description"><em>Hide</em></a></div>
<div id="p7IRMds_1" class="p7IRMdesc"> </div>
</div>
<div id="p7IRMdsopw_1" class="p7IRMdesc_open_wrapper">
<div id="p7IRMdsop_1" class="p7IRMdesc_open"><a id="p7IRMdsopen_1" href="javascript:;" title="Show Description"><em>Show</em></a></div>
</div>
</div>
</div>
<ul id="p7IRMlist_1" class="p7IRMlist">
<li>000</li>
<li>001</li>
<li>002</li>
<li>003</li>
<li>004</li>
<li>005</li>
<li>006</li>
<li>007</li>
</ul>
<!--[if IE 5.000]>
<style>.p7IRMdesc_wrapper {position:static !important;visibility:visible !important;}.p7IRMdesc_open_wrapper, .p7IRMdesc_close {display: none;}.p7IRMpaginator {position: static !important;height: 3em;}.p7IRMpaginator li, .p7IRMpaginator a {float: left !important;}.p7IRMpaginator a {float: left !important;overflow: visible !important;}</style>
<![endif]-->
<!--[if lte IE 6]>
<style>.p7IRMpaginator a {width: auto !important;}</style>
<![endif]-->
<!--[if lte IE 7]>
<style>.p7IRMpaginator li {display: inline !important;margin-right: 3px !important;}.p7IRMpaginator {zoom: 1;}</style>
<![endif]-->
<script type="text/javascript">P7_opIRM('p7IRM_1',1,1,1,3000,4000,1,0,1,0,1500,0,0);</script>
</div></td>
</tr>
</table>
<!-- Picture Slider end -->
<p><strong></strong><br />
<br />
<br />
</p>
<p>Salon Services | Spa Services | Spa Packages | Bridal Services | About Us | Contact Us</p>
</div>
<!-- Content end -->
and the css
.pagewrap {
width: 1000px;
margin: 0 auto;
}
.header {
background-color: black;
margin-bottom: 5px;
}
.header img {
width: 55%;
}
.sidebar {
width: 200px;
height: auto;
font-size: 16px;
float: left;
margin-bottom: 5px;
padding: 10px;
border: #000000 solid 2px;
border-bottom-left-radius: 2em;
border-bottom-right-radius: 2em;
}
.sidebartitle {
border: #000000 solid 2px;
border-top-left-radius: 2em;
border-top-right-radius: 2em;
padding: 10px;
height: auto;
width: 200px;
background-color: #68316B;
}
.content {
width: 600px;
height: auto;
font-size: 16px;
float: right;
margin-bottom: 5px;
padding: 10px;
border: #000000 solid 2px;
border-bottom-left-radius: 2em;
border-bottom-right-radius: 2em;
}
.contenttitle {
border: #000000 solid 2px;
border-top-left-radius: 2em;
border-top-right-radius: 2em;
float: right;
padding: 10px;
font-size: 16px;
width: 600px;
height: auto;
background-color: #68316B;
}
It's caused by the fact that .sidebartitle isn't floating, so .contenttitle won't float right of it, but stays below it. If you float .sidebartitle, however, .sidebar will be right of .sidebartitle, so just put a wrapper DIV around sidebartitle AND sidebar and make that float:left;.
See the result here: http://codepen.io/anon/pen/jqdNzy

CSS Body width not working on every web page

I am relatively new to CSS and I am creating a web application with a number of web pages that I want centered across all web pages. I have created a CSS style sheet where I set the width to 60% and text-align to be centered. On the index page the document in centered but when I hit a link the next page is always the full width of the screen.
I attached some of the code below;
Thanks for the help...
CSS Style sheet
/*
Document : affablebean
Created on : Jun 9, 2010, 3:59:32 PM
Author : tgiunipero
Description: Style rules for the AffableBean application
*/
/* html tags */
body {
font-family: Arial, Helvetica, sans-serif;
width: 60%;
text-align: center;
margin: 20px auto;
}
hr {
border: 0;
background-color: #333;
height: 1px;
margin: 0 25px;
width: 300px;
}
table {
margin: 0 20px;
border-spacing: 0;
text-align: center;
border: solid 1px #f5eabe;
}
/* general styles */
#main { background: #eee }
#singleColumn {
margin: 20px 30px;
text-align: left;
}
.lightBlue { background-color: #edf8f7 }
.white { background-color: #fff }
.bubble {
font-weight: bold;
background-color: #f5eabe;
padding: 5px;
color: inherit;
}
.hMargin { margin: 0 30px }
.smallText { font-size: small }
.header {
background-color: #c3e3e0;
height: 30px;
}
/* styles for elements contained in the header, i.e.,
shopping cart widget, language toggle, and logo */
#header {
height: 250px;
background: #aaa;
}
#logo {
height: 155px;
width: 155px;
float: left;
margin-left: 30px;
margin-top: -20px;
}
#logoText {
float: left;
margin: 20px 0 0 70px;
/* font styles apply to text within img alt attribute */
font-family: 'American Typewriter', Courier, monospace;
font-size: 50px;
color: #333;
}
#widgetBar {
height: 50px;
width: 850px;
float: right;
background: #ccc;
}
.headerWidget {
width: 194px;
margin: 20px 2px;
font-size: small;
float: right;
line-height: 25px;
background: #aaa;
}
/* footer styles */
#footer {
height: 60px;
width: 350px;
clear: left;
background: #aaa;
}
/* index page styles */
#indexLeftColumn {
height: 400px;
width: 350px;
float: left;
background: #ccc;
}
#indexRightColumn {
height: 400px;
width: 500px;
float: left;
background: #eee;
}
.categoryBox {
height: 176px;
width: 212px;
margin: 21px 14px 6px;
float: inherit;
background: #ccc;
}
.categoryLabelText {
line-height: 150%;
font-size: x-large;
}
/* category page styles */
#categoryLeftColumn {
width: 185px;
float: left;
margin-top: 25px;
padding-left: 15px;
}
#categoryRightColumn {
margin-top: 10px;
width: 650px;
float: left;
}
.categoryButton {
margin: 15px 22px;
padding: 13px;
display: block;
background-color: #d3ede8;
}
#selectedCategory {
background-color: #b2d2d2;
margin-left: 10px;
width: 139px;
}
#categoryTitle {
margin: -34px 180px 0 0;
font-size: x-large;
float: right;
background-color: #f5eabe;
padding: 7px;
}
.categoryText {
line-height: 25px;
font-size: x-large;
}
#productTable { width: 600px }
#productTable tr { height: 90px }
#productTable td { width: 145px }
/* cart page styles */
#actionBar {
margin: 30px;
width: 750px;
text-align: center;
}
#subtotal { margin: 40px 0 20px 430px }
#cartTable { width: 750px }
#cartTable td {
width: 145px;
height: 90px;
}
/* checkout page styles */
#checkoutTable {
width: 360px;
background-color: #f5eabe;
float: left;
height: 280px;
}
#infoBox {
width: 300px;
padding-left: 30px;
float: left;
}
#priceBox {
padding: 10px;
margin: 10px 0;
height: 128px;
background-color: #c3e3e0;
}
/* confirmation page styles */
#confirmationText {
margin: 0 20px 20px;
padding: 10px;
background-color: #f5eabe;
float: left;
width:540px;
}
.summaryColumn {
margin-top: 15px;
width: 50%;
float: left;
}
#orderSummaryTable {
width: 100%;
text-align: left;
height: 200px;
}
#deliveryAddressTable {
width: 70%;
margin-left: 15%;
text-align: left;
height: 200px;
}
Index Page
<ui:composition template="/layout/abMainTemplate.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:define name="head">
<link rel="stylesheet" type="text/css" href="css/affablebean.css"></link>
<title>The Affable Bean</title>
</ui:define>
<ui:define name="content">
<div id="main">
<div id="header">
<div id="widgetBar">
<div class="headerWidget">
[ language toggle ]
</div>
<div class="headerWidget">
[ shopping cart widget ]
</div>
</div>
<a href="#">
<img src="#" id="logo" alt="Affable Bean logo"></img>
</a>
<img src="#" id="logoText" alt="the affable bean"></img>
</div>
<div id="indexLeftColumn">
<div id="welcomText">
<p>[ welcome text ]</p>
</div>
</div>
<div id="indexRightColumn">
<div class="categoryBox">
<a href="category.xhtml">
<span class="categoryLabelText">dairy</span>
</a>
</div>
<div class="categoryBox">
<a href="cart.xhtml">
<span class="categoryLabelText">meats</span>
</a>
</div>
<div class="categoryBox">
<a href="checkout.xhtml">
<span class="categoryLabelText">bakery</span>
</a>
</div>
<div class="categoryBox">
<a href="confirmation.xhtml">
<span class="categoryLabelText">fruit and veg</span>
</a>
</div>
</div>
<div id="footer">
<hr>
<p id="footerText">[ footer text ]</p>
</hr>
</div>
</div>
</ui:define>
</ui:composition>
Category Page
<ui:composition template="/layout/abMainTemplate.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:define name="head">
<link rel="stylesheet" type="text/css" href="css/affablebean.css"></link>
<title>The Affable Bean</title>
</ui:define>
<ui:define name="content">
<div id="main">
<div id="header">
<div id="widgetBar">
<div class="headerWidget">
[ language toggle ]
</div>
<div class="headerWidget">
[ checkout button ]
</div>
<div class="headerWidget">
[ shopping cart widget ]
</div>
</div>
<a href="#">
<img src="#" id="logo" alt="Affable Bean logo"></img>
</a>
<img src="#" id="logoText" alt="the affable bean"></img>
</div>
<div id="categoryLeftColumn">
<div id="selectedCategory">
<a href="#" class="categoryButton">
<span class="categoryText">dairy</span>
</a>
<a href="#" class="categoryButton">
<span class="categoryText">meats</span>
</a>
<a href="#" class="categoryButton">
<span class="categoryText">bakery</span>
</a>
<a href="#" class="categoryButton">
<span class="categoryText">fruit and veg</span>
</a>
</div>
</div>
<div id="categoryRightColumn">
<p id="categoryTitle">[ selected category ]</p>
<table id="productTable">
<tr>
<td class="lightBlue">
<img src="#" alt="product image"></img>
</td>
<td class="lightBlue">
[ product name ]
<br>
<span class="smallText">[ product description ]</span>
</br>
</td>
<td class="lightBlue">[ price ]</td>
<td class="lightBlue">
<form action="#" method="post">
<input type="submit" value="purchase button"></input>
</form>
</td>
</tr>
<tr>
<td class="white">
<img src="#" alt="product image"></img>
</td>
<td class="white">
[ product name ]
<br>
<span class="smallText">[ product description ]</span>
</br>
</td>
<td class="white">[ price ]</td>
<td class="white">
<form action="#" method="post">
<input type="submit" value="purchase button"></input>
</form>
</td>
</tr>
<tr>
<td class="lightBlue">
<img src="#" alt="product image"></img>
</td>
<td class="lightBlue">
[ product name ]
<br>
<span class="smallText">[ product description ]</span>
</br>
</td>
<td class="lightBlue">[ price ]</td>
<td class="lightBlue">
<form action="#" method="post">
<input type="submit" value="purchase button"></input>
</form>
</td>
</tr>
<tr>
<td class="white">
<img src="#" alt="product image"></img>
</td>
<td class="white">
[ product name ]
<br>
<span class="smallText">[ product description ]</span>
</br>
</td>
<td class="white">[ price ]</td>
<td class="white">
<form action="#" method="post">
<input type="submit" value="purchase button"></input>
</form>
</td>
</tr>
</table>
</div>
<div id="footer">
footer
</div>
</div>
</ui:define>
</ui:composition>
And the template page
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<ui:insert name="head"></ui:insert>
</h:head>
<h:body>
<ui:insert name="content" ></ui:insert>
</h:body>
</html>
the body element resides inside the html element, and if you want to set any element's width in percent, you should first define it's parent element's width.
html {
padding:0;
margin:0;
width:100%; /* 100% of window with, so the body width of 60% will work as expected */
}
You have to use position: relative or position: absolute command.