I've set up my code using flex so that it works responsively (it's looking how I'd like on devices sub 960 in width so any changes to desktop happen within the css query at the bottom of my CSS file). potentially a very simple question but on views wider than 960 the 8 tiles aren't a consistent width (one .row containing 4 .tiles) - I tried adding a width of 25% which I thought would make them always evenly span the width of the page but that didn't work. Within that the .content (expanding content) seems to extend further that the row to the right which I cant understand?
any ideas would be really appreciated!
working fiddle: https://jsfiddle.net/simoncunningham/zsLxuo26/7/
any advice would appreciated!
<div class="box">
<div class="tile" onclick="openTab('b1');">
<img class="icon-spacing" src="./Icons/Banking.svg" />
<p>Banking</p>
<img class="arrow-down" src="./Icons/arrow-down.png" />
</div>
<div id="b1" class="content" style="display: none; background: black">
<span onclick="this.parentElement.style.display='none'" class="closebtn"
>×</span
>
<div class="description">
<h3>Banking</h3>
<p>
The largest category covering investment and management platforms,
sales and trading analysis toosl, personal finance management &
crypto exchanges.
</p>
<ul>
<li>Personal Finance Management (PFM)</li>
<li>Investment Data and Information Services</li>
<li>Trading and Investment Platforms</li>
<li>WealthTech Operations</li>
<li>Distributed Ledger Technologies & Cryptocurrencies</li>
<li>Robo Advisors</li>
</ul>
</div>
</div>
<div class="tile" onclick="openTab('b2');">
<img class="icon-spacing" src="./Icons/RegTech.svg" />
<p>RegTech</p>
<img class="arrow-down" src="./Icons/arrow-down.png" />
</div>
<div id="b2" class="content" style="display: none; background: black">
<span onclick="this.parentElement.style.display='none'" class="closebtn"
>×</span
>
<div class="description">
<h3>RegTech</h3>
<p>
The largest category covering investment and management platforms,
sales and trading analysis toosl, personal finance management &
crypto exchanges.
</p>
<ul>
<li>Personal Finance Management (PFM)</li>
<li>Investment Data and Information Services</li>
<li>Trading and Investment Platforms</li>
<li>WealthTech Operations</li>
<li>Distributed Ledger Technologies & Cryptocurrencies</li>
<li>Robo Advisors</li>
</ul>
</div>
</div>
<div class="tile" onclick="openTab('b3');">
<img class="icon-spacing" src="./Icons/InsurTech.svg" />
<p>InsurTech</p>
<img class="arrow-down" src="./Icons/arrow-down.png" />
</div>
<div id="b3" class="content" style="display: none; background: black">
<span onclick="this.parentElement.style.display='none'" class="closebtn"
>×</span
>
<div class="description">
<h3>InsurTech</h3>
<p>
The largest category covering investment and management platforms,
sales and trading analysis toosl, personal finance management &
crypto exchanges.
</p>
<ul>
<li>Personal Finance Management (PFM)</li>
<li>Investment Data and Information Services</li>
<li>Trading and Investment Platforms</li>
<li>WealthTech Operations</li>
<li>Distributed Ledger Technologies & Cryptocurrencies</li>
<li>Robo Advisors</li>
</ul>
</div>
</div>
<div class="tile" onclick="openTab('b4');">
<img class="icon-spacing" src="./Icons/Lending.svg" />
<p>Lending</p>
<img class="arrow-down" src="./Icons/arrow-down.png" />
</div>
<div id="b4" class="content" style="display: none; background: black">
<span onclick="this.parentElement.style.display='none'" class="closebtn"
>×</span
>
<div class="description">
<h3>Lending</h3>
<p>
The largest category covering investment and management platforms,
sales and trading analysis toosl, personal finance management &
crypto exchanges.
</p>
<ul>
<li>Personal Finance Management (PFM)</li>
<li>Investment Data and Information Services</li>
<li>Trading and Investment Platforms</li>
<li>WealthTech Operations</li>
<li>Distributed Ledger Technologies & Cryptocurrencies</li>
<li>Robo Advisors</li>
</ul>
</div>
</div>
</div>
<div class="box">
<div class="tile" onclick="openTab('b5');">
<img class="icon-spacing" src="./Icons/Accounting.svg" />
<p>Accounting</p>
<img class="arrow-down" src="./Icons/arrow-down.png" />
</div>
<div id="b5" class="content" style="display: none; background: black">
<span onclick="this.parentElement.style.display='none'" class="closebtn"
>×</span
>
<div class="description">
<h3>Accounting</h3>
<p>
The largest category covering investment and management platforms,
sales and trading analysis toosl, personal finance management &
crypto exchanges.
</p>
<ul>
<li>Personal Finance Management (PFM)</li>
<li>Investment Data and Information Services</li>
<li>Trading and Investment Platforms</li>
<li>WealthTech Operations</li>
<li>Distributed Ledger Technologies & Cryptocurrencies</li>
<li>Robo Advisors</li>
</ul>
</div>
</div>
<div class="tile" onclick="openTab('b6');">
<img class="icon-spacing" src="./Icons/Payments.svg" />
<p>Payments</p>
<img class="arrow-down" src="./Icons/arrow-down.png" />
</div>
<div id="b6" class="content" style="display: none; background: black">
<span onclick="this.parentElement.style.display='none'" class="closebtn"
>×</span
>
<div class="description">
<h3>Payments</h3>
<p>
The largest category covering investment and management platforms,
sales and trading analysis toosl, personal finance management &
crypto exchanges.
</p>
<ul>
<li>Personal Finance Management (PFM)</li>
<li>Investment Data and Information Services</li>
<li>Trading and Investment Platforms</li>
<li>WealthTech Operations</li>
<li>Distributed Ledger Technologies & Cryptocurrencies</li>
<li>Robo Advisors</li>
</ul>
</div>
</div>
<div class="tile" onclick="openTab('b7');">
<img class="icon-spacing" src="./Icons/Quote.svg" />
<p>Quote</p>
<img class="arrow-down" src="./Icons/arrow-down.png" />
</div>
<div id="b7" class="content" style="display: none; background: black">
<span onclick="this.parentElement.style.display='none'" class="closebtn"
>×</span
>
<div class="description">
<h3>Quote</h3>
<p>
The largest category covering investment and management platforms,
sales and trading analysis toosl, personal finance management &
crypto exchanges.
</p>
<ul>
<li>Personal Finance Management (PFM)</li>
<li>Investment Data and Information Services</li>
<li>Trading and Investment Platforms</li>
<li>WealthTech Operations</li>
<li>Distributed Ledger Technologies & Cryptocurrencies</li>
<li>Robo Advisors</li>
</ul>
</div>
</div>
<div class="tile" onclick="openTab('b8');">
<img class="icon-spacing" src="./Icons/WealthTech.svg" />
<p>WealthTech</p>
<img class="arrow-down" src="./Icons/arrow-down.png" />
</div>
<div id="b8" class="content" style="display: none; background: black">
<span onclick="this.parentElement.style.display='none'" class="closebtn"
>×</span
>
<div class="description">
<h3>WealthTech</h3>
<p>
The largest category covering investment and management platforms,
sales and trading analysis toosl, personal finance management &
crypto exchanges.
</p>
<ul>
<li>Personal Finance Management (PFM)</li>
<li>Investment Data and Information Services</li>
<li>Trading and Investment Platforms</li>
<li>WealthTech Operations</li>
<li>Distributed Ledger Technologies & Cryptocurrencies</li>
<li>Robo Advisors</li>
</ul>
</div>
</div>
</div>
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.box {
display: flex;
flex-wrap: wrap;
flex-direction: row;
}
.tile {
flex: 1 0 auto;
order: 0;
/* For visual only */
background-color: black;
border: 1px solid grey;
height: 150px;
text-align: center;
font-size: 16px;
color: white;
cursor: pointer;
}
.active-tile {
flex: 1 0 auto;
order: 0;
/* For visual only */
text-align: center;
border: 1px solid #000;
background-color: green;
height: 125px;
cursor: pointer;
}
.content {
order: 1;
flex: 1 0 100%;
/* For visual only */
padding: 20px;
color: white;
text-align: center;
border: 1px solid #000;
background-color: #228b22;
}
.description {
text-align: left;
}
.icon-spacing {
margin-top: 24px;
}
/* Clear floats after the tiles */
.box:after {
content: '';
display: table;
clear: both;
}
.closebtn {
float: right;
color: white;
cursor: pointer;
}
.arrow-down {
width: 25px;
height: 25px;
}
.arrow-up {
width: 25px;
height: 25px;
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
}
/*
"Desktop" and above
*/
#media (max-width: 961px) {
.box {
flex-direction: column;
}
.content {
order: 0;
}
}
function openTab(tabName) {
var i, x;
x = document.getElementsByClassName('content');
for (i = 0; i < x.length; i++) {
x[i].style.display = 'none';
}
document.getElementById(tabName).style.display = 'block';
// Get all the tabs into a collection
// (don't use .getElementsByClassName()!)
let tabs = document.querySelectorAll('.tile');
// Set up a click event handler on each of the tabs
tabs.forEach(function (tab) {
tab.addEventListener('click', function (event) {
// Loop over all the tabs and remove the active class
tabs.forEach(function (tab) {
tab.classList.remove('active-tile');
tab.children[2].classList.remove('arrow-up');
});
// Set the background of the clicked tab
this.classList.add('active-tile');
tab.children[2].classList.add('arrow-up');
});
});
}
Your problem (when you try width: 25% on tiles) is that 100% is calculated without taking into account the border and the padding.
.tile has a border of 1px, so 25% * 4 + 8 * 1px is more than 100%.
.content has a border of 1px, and a padding of 20px, so 100% + 2 * 1px + 2 * 20px is more than 100%.
To solve the issue you can just change the way your box is calculated by including the border and the padding when you assign the width:
.tile, .content {
box-sizing: border-box;
}
.tile {
width: 25%;
}
You can learn more about box-sizing and its values on the MDN documentation page.
Try add the following to the ".tile" class: flex-basis: 20%;
Related
I created a cv using HTML and CSS. But I tried to apply a CSS border around it but it didn't work.
The cv here is displayed in the center of the web page.
The HTML and CSS codes of the CV are shown below.
When adding the Border, if you want, change the HTML and CSS codes that I have already coded.
body {
font-family: sans-serif, Arial, Helvetica, sans-serif;
margin-top: 0;
}
/*********Header Section************/
#name {
text-align: center;
color: white;
}
#tp-no {
text-align: center;
padding-top: 5px;
color: white;
}
#mail {
text-align: center;
margin-top: -3px;
color: white;
}
header {
line-height: 4px;
}
#name .color-name {
color: #14a800;
}
header {
padding-top: 10px;
margin: auto;
max-width: 700px;
background-color: #3c4041f1;
height: 6rem;
}
/*********main-details-sec************/
#main-details-sec {
margin-top: 3em;
}
.column {
float: left;
width: 50%;
}
#main-details-sec {
content: "";
display: table;
clear: both;
margin: auto;
max-width: 600px;
}
.ol-list {
line-height: 25px;
}
.education {
color: #14a800;
}
.personal {
color: #14a800;
}
.school {
color: #14a800;
}
.contact {
color: #14a800;
}
span {
font-weight: bold;
}
/*********second-details-sec************/
#second-details-sec {
margin: auto;
max-width: 600px;
}
.other-edu {
color: #14a800;
}
.Extra {
color: #14a800;
}
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>My CV</title>
</head>
<body>
<header>
<h1 id="name"> <span class="color-name">Pathum</span> Sandeepa</h1>
<h4 id="tp-no">+94 76 XXXX XXX</h4>
<h4 id="mail">pathumXXXXXXX#gmail.com</h4>
</header>
<div id="main-details-sec">
<!--Education Details-->
<div class="column">
<h2 class="education">Education</h2>
<h4 class="exam-ol">G.C.E (O/L) Examination (XXXX)</h4>
<ul class="ol-list">
<li>Mathematics <span>X</span></li>
<li>ICT <span>X</span></li>
<li>Sinhala <span>X</span></li>
<li>Buddhist <span>X</span></li>
<li>History <span>X</span></li>
<li>Science <span>X</span></li>
<li>Life Skill & Civic Education <span>X</span></li>
<li>Art <span>X</span></li>
<li>English <span>X</span></li>
</ul>
<h4 class="exam-al">G.C.E (A/L) Examination (XXXX)</h4>
<ul class="al-list">
<li>Science for Technology <span>X</span></li>
<li>Information & Communication Technology <span>X</span></li>
<li>Engineering Technology <span>X</span></li>
</ul>
</div>
<!--Personal Details-->
<div class="column">
<div class="personal-details">
<h2 class="personal">Personal Details</h2>
<ul class="personal-list">
<li id="personal-data"> Full Name - Pathum XXXXXXX XXXXXXXXXXXXXX</li>
<li id="personal-data"> Name with initials - X.X. Pathum XXXXXXXX</li>
<li id="personal-data"> Date of Birth - XXXX.XX.XX</li>
<li id="personal-data"> Gender - Male</li>
<li id="personal-data"> NIC No - XXXXXXXXXX</li>
<li id="personal-data"> Marital Status - Single</li>
</ul>
</div>
<!--School-->
<div class="school-details">
<h2 class="school">School</h2>
<ul class="school-list">
<li id="school-data">XP/XT XXXXXXXXXX XXXX Vidyalaya</li>
<li id="school-data">X.X.X.XXXXXXXXX Central College, XXXXXXXX</li>
</ul>
</div>
<!--Contact-->
<div class="contact-details">
<h2 class="contact">Contact</h2>
<ul class="contact-list">
<li id="school-data">Mobile No- XXXXXXXX</li>
<li id="school-data">Gmail- pathumXXXXXXXXXXX.com</li>
<li id="school-data">Address- XXXXXXXX, XXXXXXXXXX</li>
</ul>
</div>
</div>
</div>
<div id="second-details-sec">
<div class="other-edu-details">
<h2 class="other-edu">Other Education Qualification</h2>
<ul class="other-edu-list">
<li id="other-edu-data">I followed Certificate Computer Course <strong>(MS Office Packege Certificate/Adobe Photoshop Certificate)</strong></li>
<li id="other-edu-data">I have successfully completed The <strong>Preparing to Manage Human Rescources Certificate Course</strong> conducted by Coursera</li>
<li id="other-edu-data">I successfully completed <strong>The Fundamentals of Digital Marketing Certificate</strong> from Google Digital Garage</li>
<li id="other-edu-data">I successfully completed <strong>Certificate in Cyber Security & Networking Course</strong> conducted by Department of Computing NextGen Campus</li>
<li id="other-edu-data">I have studied the <strong>Computer Certificate in Hardware Course</strong> issued by Aono Naoko Vocational Computer Training Institute and obtained the certificate</li>
</ul>
</div>
<div class="Extra-details">
<h2 class="Extra">Extra Curricular Activities</h2>
<ul class="Extra-list">
<li id="Extra-data">I have Dhamma School exam Certificates</li>
<li id="Extra-data">I have won school Art Competitions and obtained art certificates</li>
</ul>
</div>
</div>
</body>
</html>
Preview:
You can add it to the body, just make sure you set the width and height values (I just used fit-content). You can then adjust your spacing on your left column so it's not touching the border.
Also, IDs should be unique, so I change those to classes.
I'd also recommend looking into flexboxes instead of using floats for your columns. https://css-tricks.com/snippets/css/a-guide-to-flexbox/
body {
font-family: sans-serif, Arial, Helvetica, sans-serif;
margin: 0 auto;
width: fit-content;
height: fit-content;
border: 1px solid black;
}
/*********Header Section************/
#name {
text-align: center;
color: white;
}
#tp-no {
text-align: center;
padding-top: 5px;
color: white;
}
#mail {
text-align: center;
margin-top: -3px;
color: white;
}
header {
line-height: 4px;
}
#name .color-name {
color: #14a800;
}
header {
padding-top: 10px;
margin: auto;
max-width: 700px;
background-color: #3c4041f1;
height: 6rem;
}
/*********main-details-sec************/
#main-details-sec {
margin-top: 3em;
}
.column {
float: left;
width: 50%;
}
#main-details-sec {
content: "";
display: table;
clear: both;
margin: auto;
max-width: 600px;
}
.ol-list {
line-height: 25px;
}
.education {
color: #14a800;
}
.personal {
color: #14a800;
}
.school {
color: #14a800;
}
.contact {
color: #14a800;
}
span {
font-weight: bold;
}
/*********second-details-sec************/
#second-details-sec {
margin: auto;
max-width: 600px;
}
.other-edu {
color: #14a800;
}
.Extra {
color: #14a800;
}
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>My CV</title>
</head>
<body>
<header>
<h1 id="name"> <span class="color-name">Pathum</span> Sandeepa</h1>
<h4 id="tp-no">+94 76 XXXX XXX</h4>
<h4 id="mail">pathumXXXXXXX#gmail.com</h4>
</header>
<div id="main-details-sec">
<!--Education Details-->
<div class="column">
<h2 class="education">Education</h2>
<h4 class="exam-ol">G.C.E (O/L) Examination (XXXX)</h4>
<ul class="ol-list">
<li>Mathematics <span>X</span></li>
<li>ICT <span>X</span></li>
<li>Sinhala <span>X</span></li>
<li>Buddhist <span>X</span></li>
<li>History <span>X</span></li>
<li>Science <span>X</span></li>
<li>Life Skill & Civic Education <span>X</span></li>
<li>Art <span>X</span></li>
<li>English <span>X</span></li>
</ul>
<h4 class="exam-al">G.C.E (A/L) Examination (XXXX)</h4>
<ul class="al-list">
<li>Science for Technology <span>X</span></li>
<li>Information & Communication Technology <span>X</span></li>
<li>Engineering Technology <span>X</span></li>
</ul>
</div>
<!--Personal Details-->
<div class="column">
<div class="personal-details">
<h2 class="personal">Personal Details</h2>
<ul class="personal-list">
<li class="personal-data"> Full Name - Pathum XXXXXXX XXXXXXXXXXXXXX</li>
<li class="personal-data"> Name with initials - X.X. Pathum XXXXXXXX</li>
<li class="personal-data"> Date of Birth - XXXX.XX.XX</li>
<li class="personal-data"> Gender - Male</li>
<li class="personal-data"> NIC No - XXXXXXXXXX</li>
<li class="personal-data"> Marital Status - Single</li>
</ul>
</div>
<!--School-->
<div class="school-details">
<h2 class="school">School</h2>
<ul class="school-list">
<li class="school-data">XP/XT XXXXXXXXXX XXXX Vidyalaya</li>
<li class="school-data">X.X.X.XXXXXXXXX Central College, XXXXXXXX</li>
</ul>
</div>
<!--Contact-->
<div class="contact-details">
<h2 class="contact">Contact</h2>
<ul class="contact-list">
<li class="school-data">Mobile No- XXXXXXXX</li>
<li class="school-data">Gmail- pathumXXXXXXXXXXX.com</li>
<li class="school-data">Address- XXXXXXXX, XXXXXXXXXX</li>
</ul>
</div>
</div>
</div>
<div id="second-details-sec">
<div class="other-edu-details">
<h2 class="other-edu">Other Education Qualification</h2>
<ul class="other-edu-list">
<li class="other-edu-data">I followed Certificate Computer Course <strong>(MS Office Packege Certificate/Adobe Photoshop Certificate)</strong></li>
<li class="other-edu-data">I have successfully completed The <strong>Preparing to Manage Human Rescources Certificate Course</strong> conducted by Coursera</li>
<li class="other-edu-data">I successfully completed <strong>The Fundamentals of Digital Marketing Certificate</strong> from Google Digital Garage</li>
<li class="other-edu-data">I successfully completed <strong>Certificate in Cyber Security & Networking Course</strong> conducted by Department of Computing NextGen Campus</li>
<li class="other-edu-data">I have studied the <strong>Computer Certificate in Hardware Course</strong> issued by Aono Naoko Vocational Computer Training Institute and obtained the certificate</li>
</ul>
</div>
<div class="Extra-details">
<h2 class="Extra">Extra Curricular Activities</h2>
<ul class="Extra-list">
<li class="Extra-data">I have Dhamma School exam Certificates</li>
<li class="Extra-data">I have won school Art Competitions and obtained art certificates</li>
</ul>
</div>
</div>
</body>
</html>
Do you mean something like this?
body{
font-family: sans-serif,Arial, Helvetica, sans-serif;
margin-top: 0;
}
#allcv {
border: 2px solid red;
max-width: 700px;
margin: 0 auto;
}
/*********Header Section************/
#name{
text-align: center;
color: white;
}
#tp-no{
text-align: center;
padding-top: 5px;
color: white;
}
#mail{
text-align: center;
margin-top: -3px;
color: white;
}
header{
line-height: 4px;
}
#name .color-name{
color: #14a800 ;
}
header{
padding-top: 10px;
margin: auto;
max-width: 700px;
background-color: #3c4041f1;
height: 6rem;
}
/*********main-details-sec************/
#main-details-sec{
margin-top: 3em;
}
.column{
float: left;
width: 50%;
}
#main-details-sec{
content: "";
display: table;
clear: both;
margin: auto;
max-width: 600px;
}
.ol-list{
line-height: 25px;
}
.education {
color: #14a800 ;
}
.personal{
color: #14a800 ;
}
.school{
color: #14a800 ;
}
.contact{
color: #14a800 ;
}
span{
font-weight: bold;
}
/*********second-details-sec************/
#second-details-sec{
margin: auto;
max-width: 600px;
}
.other-edu{
color: #14a800 ;
}
.Extra{
color: #14a800 ;
}
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>My CV</title>
</head>
<body>
<header>
<h1 id="name"> <span class="color-name">Pathum</span> Sandeepa</h1>
<h4 id="tp-no">+94 76 XXXX XXX</h4>
<h4 id="mail">pathumXXXXXXX#gmail.com</h4>
</header>
<div id="allcv">
<div id="main-details-sec">
<!--Education Details-->
<div class="column">
<h2 class="education">Education</h2>
<h4 class="exam-ol">G.C.E (O/L) Examination (XXXX)</h4>
<ul class="ol-list">
<li>Mathematics <span>X</span></li>
<li>ICT <span>X</span></li>
<li>Sinhala <span>X</span></li>
<li>Buddhist <span>X</span></li>
<li>History <span>X</span></li>
<li>Science <span>X</span></li>
<li>Life Skill & Civic Education <span>X</span></li>
<li>Art <span>X</span></li>
<li>English <span>X</span></li>
</ul>
<h4 class="exam-al">G.C.E (A/L) Examination (XXXX)</h4>
<ul class="al-list">
<li>Science for Technology <span>X</span></li>
<li>Information & Communication Technology <span>X</span></li>
<li>Engineering Technology <span>X</span></li>
</ul>
</div>
<!--Personal Details-->
<div class="column">
<div class="personal-details">
<h2 class="personal">Personal Details</h2>
<ul class="personal-list">
<li id="personal-data"> Full Name - Pathum XXXXXXX XXXXXXXXXXXXXX</li>
<li id="personal-data"> Name with initials - X.X. Pathum XXXXXXXX</li>
<li id="personal-data"> Date of Birth - XXXX.XX.XX</li>
<li id="personal-data"> Gender - Male</li>
<li id="personal-data"> NIC No - XXXXXXXXXX</li>
<li id="personal-data"> Marital Status - Single</li>
</ul>
</div>
<!--School-->
<div class="school-details">
<h2 class="school">School</h2>
<ul class="school-list">
<li id="school-data">XP/XT XXXXXXXXXX XXXX Vidyalaya</li>
<li id="school-data">X.X.X.XXXXXXXXX Central College, XXXXXXXX</li>
</ul>
</div>
<!--Contact-->
<div class="contact-details">
<h2 class="contact">Contact</h2>
<ul class="contact-list">
<li id="school-data">Mobile No- XXXXXXXX</li>
<li id="school-data">Gmail- pathumXXXXXXXXXXX.com</li>
<li id="school-data">Address- XXXXXXXX, XXXXXXXXXX</li>
</ul>
</div>
</div>
</div>
<div id="second-details-sec">
<div class="other-edu-details">
<h2 class="other-edu">Other Education Qualification</h2>
<ul class="other-edu-list">
<li id="other-edu-data">I followed Certificate Computer Course <strong>(MS Office Packege Certificate/Adobe Photoshop Certificate)</strong></li>
<li id="other-edu-data">I have successfully completed The <strong>Preparing to Manage Human Rescources Certificate Course</strong> conducted by Coursera</li>
<li id="other-edu-data">I successfully completed <strong>The Fundamentals of Digital Marketing Certificate</strong> from Google Digital Garage</li>
<li id="other-edu-data">I successfully completed <strong>Certificate in Cyber Security & Networking Course</strong> conducted by Department of Computing NextGen Campus</li>
<li id="other-edu-data">I have studied the <strong>Computer Certificate in Hardware Course</strong> issued by Aono Naoko Vocational Computer Training Institute and obtained the certificate</li>
</ul>
</div>
<div class="Extra-details">
<h2 class="Extra">Extra Curricular Activities</h2>
<ul class="Extra-list">
<li id="Extra-data">I have Dhamma School exam Certificates</li>
<li id="Extra-data">I have won school Art Competitions and obtained art certificates</li>
</ul>
</div>
</div>
</div>
I created another div called allcv that cluster every other div (except header) and center in the middle of page. If you want, you can put the header inside that div to.
Hope I helped.
this part has been bothering me for half an hour, and I dont know how to solve. So, how do I remove the lightgrey space between heading and div? Should I be using margin and padding to do it?
Below is my code:
<!-- Description -->
<h3 style="background-color:white; font-size:20px;">
Within three years, production area had more than tripled to meet growing demands. The year
1999 marked the completion of our current plant of 65,000
square feet, fully equipped with state-of-the-art technology, as well as the start of our
Surface Mount Technology process. Implementation of new
lead-free production lines began in early 2003. Our success is the result of the joint-efforts
of our innovative and quality-focused engineering team,
whose expertise range from design to debugging, and the dedication of the rest of our staff.
</h3>
<!-- ------------------------------ -->
<div style="width: 100%; display: table;margin:0px; padding:0px; background-color:#D6EAF8 ">
<div style="display: table-row">
<!-- ------------------------------------------------------------------ -->
<!-- Why Us -->
<div style="margin:0px; padding:0px; display: table-cell">
<h3 style="padding-left:620px">Why Us?</h3>
<ul style="padding-left:640px">
<li><a href="http://www.scope.com.my/2014/SMSB2014/qpolicy.htm" style="background-
color:#D6EAF8 ; color:black">Policy</a></li>
<li><a href="http://www.scope.com.my/2014/SMSB2014/manufacturing_capability.htm"
style="background-color:#D6EAF8 ; color:black">Capability</a></li>
<li><a href="https://www.scope.com.my/career.html" style="background-color:#D6EAF8 ;
color:black">Careers</a></li>
</ul>
</div>
<!-- Follow Us -->
<div style="margin:0px; padding:0px; display: table-cell">
<h3 style="padding-right:500px">Follow Us</h3>
<ul style="padding-left:20px">
<li><a href="https://www.facebook.com/pages/SCOPE-Manufacturers-M-Sdn-Bhd/304477286279886"
style="background-color:#D6EAF8 ; color:black">
<img src="icon1.jpg" alt=""> Facebook</a></li>
<li><img src="icon2.jpg" alt=""> Twitter</li>
<li><img src="icon3.jpg" alt=""> Linkedin</li>
</ul>
</div>
<!-- ------------------------------------------------------------------- -->
</div>
</div>
It's margin-bottom of h3, make it as h3 {margin-bottom: 0}
you should remove margin bottom: h3
<h3 style="background-color:white; font-size:20px;margin-bottom:0;">
All you really need is to apply margin-bottom:0; to the first h3:
<h3 style="background-color:white; font-size:20px; margin-bottom:0;">
Although, I'd like to offer you a solution without so much inline-CSS as well. Read more on What's so bad about in-line CSS?.
I've effectively moved duplicate styling into classes and included some id's to define your styling. All styling is included in pure CSS and could be included as an external style sheet.
See the JSFiddle
.h3_Summary {
background-color: white;
font-size: 20px;
margin-bottom: 0;
}
.div_outer {
width: 100%;
display: table;
margin: 0px;
padding: 0px;
background-color: #D6EAF8;
}
.div_inner {
display: table-row;
}
.div_container {
margin: 0px;
padding: 0px;
display: table-cell;
}
#h3_whyUs {
padding-left: 620px;
}
.ul_first {
padding-left: 640px;
}
ul li a {
background-color: #D6EAF8;
color: black;
}
#h3_followUs {
padding-right: 500px;
}
.ul_second {
padding-left: 20px;
}
<!-- Description -->
<h3 class="h3_Summary">
Within three years, production area had more than tripled to meet growing demands. The year
1999 marked the completion of our current plant of 65,000
square feet, fully equipped with state-of-the-art technology, as well as the start of our
Surface Mount Technology process. Implementation of new
lead-free production lines began in early 2003. Our success is the result of the joint-efforts
of our innovative and quality-focused engineering team,
whose expertise range from design to debugging, and the dedication of the rest of our staff.
</h3>
<!-- ------------------------------ -->
<div class="div_outer">
<div class="div_inner">
<!-- ------------------------------------------------------------------ -->
<!-- Why Us -->
<div class="div_container">
<h3 id="h3_whyUs">Why Us?</h3>
<ul class="ul_first">
<li>Policy</li>
<li>Capability</li>
<li>Careers</li>
</ul>
</div>
<!-- Follow Us -->
<div class="div_container">
<h3 id="h3_followUs">Follow Us</h3>
<ul class="ul_second">
<li><a href="https://www.facebook.com/pages/SCOPE-Manufacturers-M-Sdn-Bhd/304477286279886">
<img src="icon1.jpg" alt=""> Facebook</a></li>
<li><img src="icon2.jpg" alt=""> Twitter</li>
<li><img src="icon3.jpg" alt=""> Linkedin</li>
</ul>
</div>
<!-- ------------------------------------------------------------------- -->
</div>
</div>
Let me know if you want any clarification! Goodluck with it! :)
Add following css lines to your style sheet.
h3 { margin-bottom: 0; }
This question already has answers here:
How can I horizontally center an element?
(133 answers)
How can I vertically center a div element for all browsers using CSS?
(48 answers)
How do you easily horizontally center a <div> using CSS? [duplicate]
(22 answers)
How can I center text (horizontally and vertically) inside a div block?
(27 answers)
Closed 4 years ago.
The middle body text won't center, and I don't know why. Also, if you have any other recommendations, they would be greatly appreciated! This is for a project and I just need a little help. I am using the margin:auto property, but it doesn't seem to work.
body {
margin:10px;
background-color:white;
}
/* Unordered List */
ul {
border:1px solid green;
width:750px;
}
/* Lists styles */
li {
font-weight:bold;
}
.test-div {
width:500px;
height:250px;
background-color:#f2f2f2;
display:block;
margin-left:auto;
margin-right:auto;
}
#body-text {
width:500px;
display:block;
margin-right:auto;
margin-left:auto;
}
/* Divider is 1.5 times shorter than header - 750/1.5 = 500 */
.divider {
background-color:black;
width:500px;
height:1px;
}
.text-center {
display:block;
margin-right:0px auto;
margin-left:0px auto;
}
.centered {
display:block;
margin-right:auto;
margin-left:auto;
text-align:center;
}
.link {
text-decoration:none;
margin-left::auto;
margin-right:auto;
}
.link:hover {
text-decoration:none;
color:#00008B;
}
#footer {
text-align:center;
width:800px;
height:500px;
padding:25px;
border:2px solid green;
margin:0 auto;
}
.filler {
height:100px;
}
ul .divider {
margin-right:auto;
margin-left:auto;
}
<head>
</head>
<script>
</script>
<div class="text-center" style="display:block;margin-left:auto;margin-right:auto;background-color:#f2f2f2;width:750px;height:450px;border-radius:15px;">
<img src="https://blog.adioma.com/wp-content/uploads/2016/02/how-elon-musk-started-infographic-700x466.png" alt="Elon Musk Wealth Sahre Joke" style="width:480px;height:380px;margin-left:10; margin-top:20px"/>
<br>
<em style="font-size:11px;"> Elon musk wealth Share - Joke </em>
</div>
<div id="body-text">
<ul class="text-center" style="list-style-type:none;">
<br>
<div class="centered" style="width:300px;height:40;border:1px solid black;padding-top:10px;">
<h1 style="font-family:monospace"> <em> A Life of Work </em> </h1>
<p> <u> A Timeline of Elon Musk's Life life </u> </p>
</div>
<br>
<li>June 28, 1971 - Born in South Africa </li>
<br>
<div class="divider"> </div>
<br>
<li> Taught himself how to code at age 12</li>
<br>
<div class="divider"> </div>
<br>
<li> Creates and writes a video game called Blastar; sells it for the equivalent of $500 </li>
<br>
<div class="divider"> </div>
<br>
<li> 1988: Graduates from Pretoria Boys High School with distinctions in science and computer studies </li>
<br>
<div class="divider"> </div>
<br>
<li>1989 to 1991: Attends college at Queen’s University in Kingston, Ontario. Then transfers to the University of Pennsylvania; completed a BS in Economics (Wharton) and a BA with a major in physics </li>
<br>
<div class=divider> </div>
<br>
<li> 1995: Moves to Silicon Valley; defers graduate program in applied physics and materials science at Stanford University to join the Internet boom </li>
<br>
<div class="divider"> </div>
<br>
<li> February 1999: Sells Zip2 to Compaq, the personal computer company, for $307 million, of which $22 million went to Musk. Then forms X.com, which in 2000 morphs into PayPal </li>
<br>
<div class="divider"> </div>
<br>
<li> July 2002: eBay acquires PayPal for $1.5 billion in stock, of which $165 million goes to Musk </li>
<br>
<div class="divider"> </div>
<br>
<li> 2002: Becomes an American citizen </li>
<br>
<div class="divider"> </div>
<br>
<li> 2002: Founds SpaceX9 </li>
<br>
<div class="divider"> </div>
<br>
<li> 2004: Invests in Tesla Motors </li>
<br>
<div class="divider"> </div>
<br>
<li> 2007: SpaceX wins $1.6 billion contract to bring cargo to the International Space Station </li>
<br>
<div class="divider"> </div>
<br>
<li> October 2008: Becomes Tesla’s CEO </li>
<br>
<div class="divider"> </div>
<br>
<li> Jun 29, 2010: Tesla IPO </li>
<br>
<div class="divider"> </div>
<br>
<li> May 2012: SpaceX becomes the first commercial vehicle to deliver a load of supplies to the International Space Station. </li>
<br>
<div class="divider"> </div>
<br>
<li> June 2012: Tesla begins deliveries of the all-electric Model S </li>
<br>
<div class="divider"> </div>
<br>
<li> August 2013: Releases sketch and concept of the Hyperloop </li>
<br>
<div class="divider"> </div>
</ul> <!-- END of list -->
<div class="filler"> </div>
</div> <!-- END Body Text -->
<!-- Footer -->
<div id="footer">
<div style="width:600px; height:4px; background-color:black;margin:0 auto">
</div>
<div class="filler"> </div>
<!-- Credits START -->
<h4> <b><em> Credits </em><b> </h4>
<div style="border:1px solid lightgrey;width:550px; margin:0 auto">
<p style="font-size:14px;margin-left:auto; margin-right:auto;color:grey;"> Note this events are not updated to current times. All timeline facts are from </p> <a style="font-size:12px;" class="link" href="http://www.mercurynews.com/2014/04/10/timeline-elon-musks-accomplishments/"> http://www.mercurynews.com/2014/04/10/timeline-elon-musks-accomplishments/ </a>
</div>
<p style="font-size:10px;text-align:center"> <u> Page made by Jacob Bruce </u> </p>
This centers everything BUT the middle text, any solutions?
Add text-align: center; to your <li> tags.
li {
text-align:center;
}
For body text I have added
#body-text ul > li {
text-align:center;
}
Hope this will help You.
Attached snippet.
Let me know if any other issue .
body {
margin:10px;
background-color:white;
}
/* Unordered List */
ul {
border:1px solid green;
width:750px;
}
/* Lists styles */
li {
font-weight:bold;
}
.test-div {
width:500px;
height:250px;
background-color:#f2f2f2;
display:block;
margin-left:auto;
margin-right:auto;
}
#body-text {
width:500px;
display:block;
margin-right:auto;
margin-left:auto;
}
#body-text ul > li {
text-align:center;
}
/* Divider is 1.5 times shorter than header - 750/1.5 = 500 */
.divider {
background-color:black;
width:500px;
height:1px;
}
.text-center {
display:block;
margin-right:0px auto;
margin-left:0px auto;
}
.centered {
display:block;
margin-right:auto;
margin-left:auto;
text-align:center;
}
.link {
text-decoration:none;
margin-left::auto;
margin-right:auto;
}
.link:hover {
text-decoration:none;
color:#00008B;
}
#footer {
text-align:center;
width:800px;
height:500px;
padding:25px;
border:2px solid green;
margin:0 auto;
}
.filler {
height:100px;
}
ul .divider {
margin-right:auto;
margin-left:auto;
}
<head>
</head>
<script>
</script>
<div class="text-center" style="display:block;margin-left:auto;margin-right:auto;background-color:#f2f2f2;width:750px;height:450px;border-radius:15px;">
<img src="https://blog.adioma.com/wp-content/uploads/2016/02/how-elon-musk-started-infographic-700x466.png" alt="Elon Musk Wealth Sahre Joke" style="width:480px;height:380px;margin-left:10; margin-top:20px;"/>
<br>
<em style="font-size:11px;"> Elon musk wealth Share - Joke </em>
</div>
<div id="body-text">
<ul class="text-center" style="list-style-type:none;">
<br>
<div class="centered" style="width:300px;height:40;border:1px solid black;padding-top:10px;">
<h1 style="font-family:monospace"> <em> A Life of Work </em> </h1>
<p> <u> A Timeline of Elon Musk's Life life </u> </p>
</div>
<br>
<li>June 28, 1971 - Born in South Africa </li>
<br>
<div class="divider"> </div>
<br>
<li> Taught himself how to code at age 12</li>
<br>
<div class="divider"> </div>
<br>
<li> Creates and writes a video game called Blastar; sells it for the equivalent of $500 </li>
<br>
<div class="divider"> </div>
<br>
<li> 1988: Graduates from Pretoria Boys High School with distinctions in science and computer studies </li>
<br>
<div class="divider"> </div>
<br>
<li>1989 to 1991: Attends college at Queen’s University in Kingston, Ontario. Then transfers to the University of Pennsylvania; completed a BS in Economics (Wharton) and a BA with a major in physics </li>
<br>
<div class=divider> </div>
<br>
<li> 1995: Moves to Silicon Valley; defers graduate program in applied physics and materials science at Stanford University to join the Internet boom </li>
<br>
<div class="divider"> </div>
<br>
<li> February 1999: Sells Zip2 to Compaq, the personal computer company, for $307 million, of which $22 million went to Musk. Then forms X.com, which in 2000 morphs into PayPal </li>
<br>
<div class="divider"> </div>
<br>
<li> July 2002: eBay acquires PayPal for $1.5 billion in stock, of which $165 million goes to Musk </li>
<br>
<div class="divider"> </div>
<br>
<li> 2002: Becomes an American citizen </li>
<br>
<div class="divider"> </div>
<br>
<li> 2002: Founds SpaceX9 </li>
<br>
<div class="divider"> </div>
<br>
<li> 2004: Invests in Tesla Motors </li>
<br>
<div class="divider"> </div>
<br>
<li> 2007: SpaceX wins $1.6 billion contract to bring cargo to the International Space Station </li>
<br>
<div class="divider"> </div>
<br>
<li> October 2008: Becomes Tesla’s CEO </li>
<br>
<div class="divider"> </div>
<br>
<li> Jun 29, 2010: Tesla IPO </li>
<br>
<div class="divider"> </div>
<br>
<li> May 2012: SpaceX becomes the first commercial vehicle to deliver a load of supplies to the International Space Station. </li>
<br>
<div class="divider"> </div>
<br>
<li> June 2012: Tesla begins deliveries of the all-electric Model S </li>
<br>
<div class="divider"> </div>
<br>
<li> August 2013: Releases sketch and concept of the Hyperloop </li>
<br>
<div class="divider"> </div>
</ul> <!-- END of list -->
<div class="filler"> </div>
</div> <!-- END Body Text -->
<!-- Footer -->
<div id="footer">
<div style="width:600px; height:4px; background-color:black;margin:0 auto">
</div>
<div class="filler"> </div>
<!-- Credits START -->
<h4> <b><em> Credits </em><b> </h4>
<div style="border:1px solid lightgrey;width:550px; margin:0 auto">
<p style="font-size:14px;margin-left:auto; margin-right:auto;color:grey;"> Note this events are not updated to current times. All timeline facts are from </p> <a style="font-size:12px;" class="link" href="http://www.mercurynews.com/2014/04/10/timeline-elon-musks-accomplishments/"> http://www.mercurynews.com/2014/04/10/timeline-elon-musks-accomplishments/ </a>
</div>
<p style="font-size:10px;text-align:center"> <u> Page made by Jacob Bruce </u> </p>
Change your #body-text width to width: 750px; and remove your .ul width property.
#body-text {
width: 750px;
...
}
.ul {
border:1px solid green;
}
you should use flex css property:
your html will look like this (you now need to remove unused classes from markup):
<div class="container"> <!-- !!!!!!!!!! ADD THIS !!!!!!!!!!! -->
<div class="text-center"> <!-- !!!!!REMOVE INLINE STYLE HERE!!!! -->
<img src="https://blog.adioma.com/wp-content/uploads/2016/02/how-elon-musk-started-infographic-700x466.png" alt="Elon Musk Wealth Sahre Joke" style="width:480px;height:380px;margin-left:10; margin-top:20px"/>
<br>
<em style="font-size:11px;"> Elon musk wealth Share - Joke </em>
</div>
<div id="body-text">
<ul class="text-center" style="list-style-type:none;">
<br>
<div class="centered" style="width:300px;height:40;border:1px solid black;padding-top:10px;">
<h1 style="font-family:monospace"> <em> A Life of Work </em> </h1>
<p> <u> A Timeline of Elon Musk's Life life </u> </p>
</div>
<br>
<li>June 28, 1971 - Born in South Africa </li>
<br>
<div class="divider"> </div>
<br>
<li> Taught himself how to code at age 12</li>
<br>
<div class="divider"> </div>
<br>
<li> Creates and writes a video game called Blastar; sells it for the equivalent of $500 </li>
<br>
<div class="divider"> </div>
<br>
<li> 1988: Graduates from Pretoria Boys High School with distinctions in science and computer studies </li>
<br>
<div class="divider"> </div>
<br>
<li>1989 to 1991: Attends college at Queen’s University in Kingston, Ontario. Then transfers to the University of Pennsylvania; completed a BS in Economics (Wharton) and a BA with a major in physics </li>
<br>
<div class=divider> </div>
<br>
<li> 1995: Moves to Silicon Valley; defers graduate program in applied physics and materials science at Stanford University to join the Internet boom </li>
<br>
<div class="divider"> </div>
<br>
<li> February 1999: Sells Zip2 to Compaq, the personal computer company, for $307 million, of which $22 million went to Musk. Then forms X.com, which in 2000 morphs into PayPal </li>
<br>
<div class="divider"> </div>
<br>
<li> July 2002: eBay acquires PayPal for $1.5 billion in stock, of which $165 million goes to Musk </li>
<br>
<div class="divider"> </div>
<br>
<li> 2002: Becomes an American citizen </li>
<br>
<div class="divider"> </div>
<br>
<li> 2002: Founds SpaceX9 </li>
<br>
<div class="divider"> </div>
<br>
<li> 2004: Invests in Tesla Motors </li>
<br>
<div class="divider"> </div>
<br>
<li> 2007: SpaceX wins $1.6 billion contract to bring cargo to the International Space Station </li>
<br>
<div class="divider"> </div>
<br>
<li> October 2008: Becomes Tesla’s CEO </li>
<br>
<div class="divider"> </div>
<br>
<li> Jun 29, 2010: Tesla IPO </li>
<br>
<div class="divider"> </div>
<br>
<li> May 2012: SpaceX becomes the first commercial vehicle to deliver a load of supplies to the International Space Station. </li>
<br>
<div class="divider"> </div>
<br>
<li> June 2012: Tesla begins deliveries of the all-electric Model S </li>
<br>
<div class="divider"> </div>
<br>
<li> August 2013: Releases sketch and concept of the Hyperloop </li>
<br>
<div class="divider"> </div>
</ul> <!-- END of list -->
<div class="filler"> </div>
</div> <!-- END Body Text -->
<div> <!-- !!!!!!!!!! ADD THIS !!!!!!!!!!! -->
<!-- Footer -->
<div id="footer">
<div style="width:600px; height:4px; background-color:black;margin:0 auto">
</div>
<div class="filler"> </div>
<!-- Credits START -->
<h4> <b><em> Credits </em><b> </h4>
<div style="border:1px solid lightgrey;width:550px; margin:0 auto">
<p style="font-size:14px;margin-left:auto; margin-right:auto;color:grey;"> Note this events are not updated to current times. All timeline facts are from </p> <a style="font-size:12px;" class="link" href="http://www.mercurynews.com/2014/04/10/timeline-elon-musks-accomplishments/"> http://www.mercurynews.com/2014/04/10/timeline-elon-musks-accomplishments/ </a>
</div>
<p style="font-size:10px;text-align:center"> <u> Page made by Jacob Bruce </u> </p>
`
for css:
body {
margin:10px;
background-color:white;
}
/* Unordered List */
ul {
border:1px solid green;
width:750px;
}
/* Lists styles */
li {
font-weight:bold;
}
.test-div {
width:500px;
height:250px;
background-color:#f2f2f2;
display:block;
margin-left:auto;
margin-right:auto;
}
/*#body-text {*/
/* width:500px; */
/* display:block; */
/* margin-right:auto; */
/* margin-left:auto; */
/*}*/
/* Divider is 1.5 times shorter than header - 750/1.5 = 500 */
.divider {
background-color:black;
width:500px;
height:1px;
}
/*.text-center {
display:block;
margin-right:0px auto;
margin-left:0px auto;
}*/
/*.centered {
display:block;
margin-right:auto;
margin-left:auto;
text-align:center;
} */
/* THIS IS FLEX */
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.link {
text-decoration:none;
margin-left::auto;
margin-right:auto;
}
.link:hover {
text-decoration:none;
color:#00008B;
}
#footer {
text-align:center;
width:800px;
height:500px;
padding:25px;
border:2px solid green;
margin:0 auto;
}
.filler {
height:100px;
}
ul .divider {
margin-right:auto;
margin-left:auto;
}
a useful guide to flex: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
I am currently working on this website redesign and I am having this issue when I scroll down the screen on mobile devices the content area width will shrink.
It only does this when I am using an actual mobile device, if I used Chrome's built in mobile device tester ti works as expected.
I have tried setting a min width for the div to 100%, but it didn't stop the issue.
Just as a note, this is my first time doing a full site build from scratch and am still relatively new to web development.
I have added a working example of the site, except for the navbar JavaScript and the images for the page.
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
$(document).ready(function() {
//Page Layout change events
if (isMobile.any()) {
$('#super-container').removeClass("super-container").addClass("super-container-mobile");
$('#header-row').removeClass("column-row").addClass("column-row-mobile");
$('#header').removeClass("header-container").addClass("header-container-mobile");
$('#main-row').removeClass("row").addClass("row-mobile");
$('#footer-row').removeClass("row").addClass("row-mobile");
$('#main-content').removeClass("main-content-container").addClass("main-content-container-mobile");
$('#RightBar').removeClass("right-bar").addClass("right-bar-mobile");
$('#footer-row').removeClass("footer").addClass("footer-mobile");
} else {
var viewWidth = $(window).width();
if (viewWidth < 870) {
$('#header').removeClass("header-container").addClass("header-container-smaller");
$('#main-content').removeClass("main-content-container").addClass("main-content-container-smaller");
$('#RightBar').removeClass("right-bar").addClass("right-bar-smaller");
$('#footer-row').removeClass("footer").addClass("footer-smaller");
}
}
});
.super-container-mobile {
width: 100%;
height: 100%;
margin: 0 auto;
text-align: justify;
}
.column-row-mobile {
width: auto;
height: 100%;
margin: 0 auto;
background-color: #2E4986;
}
.header-container-mobile {
display: block;
width: 100%;
height: auto;
margin: 0 auto;
text-align: center;
background-color: #2E4986;
color: #fff;
margin-top: .25em;
}
.row-mobile {
display: block;
width: 100%;
height: 100%;
margin: 0 auto;
min-width: 100%;
}
.main-content-container-mobile {
display: block;
width: 100%;
height: 100%;
margin: 0 auto;
color: #000;
}
.right-bar-mobile {
display: block;
width: 70%;
height: 100%;
margin: 0 auto;
min-width: 70%;
font-size: 1.75em;
color: #FFF;
}
.right-bar-mobile .rightbar-well {
font-size: .75em;
}
.right-bar-mobile .right-bar-header {
font-size: 1em;
}
.footer-mobile {
width: 100%;
height: 100%;
margin: 0 auto;
background-color: #2E4986;
color: #FFF;
font-size: .75em;
}
.footer-mobile p {
padding: .5em;
}
.content-cell-mobile {
display: block;
width: 95%;
height: 100%;
margin: 0 auto;
margin-top: 1.25em;
text-align: center;
min-width: 95%;
}
.content-cell-mobile .main-content-body {
font-size: 1.1em;
}
.main-content-header-mobile {
color: #000;
font-size: 1.3em;
text-decoration: underline;
}
.right-bar-header-mobile {
font-size: 1.8em;
color: #FFF;
}
.rightbar-well {
padding: 1em;
background-color: #2E4986;
border-radius: 1em;
text-align: center;
color: #ffffff;
background-color: #2E4986;
box-shadow: 0 0 8px #212121;
margin-top: .75em;
margin-bottom: .75em;
}
.rightbar-well a {
color: #ffffff;
}
.body-img {
height: 8em;
width: auto;
}
.body-img:hover {
transform: scale(1.5, 1.5);
transform-origin: 0 0;
}
.company-header {
font-size: 3em;
font-weight: 600;
}
.sub-header {
margin-top: .1em;
font-size: 1.25em;
}
.header-line {
width: 65%;
margin: 0 auto;
height: .05em;
background-color: #FFF;
margin-top: .2em;
border-radius: 2px;
box-shadow: 2px 2px 31px 1px rgba(148, 148, 148, 1);
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Header-Master">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Community Action, Inc.</title>
<style>
.fixed-inv {
margin: 0 auto;
width: auto;
display: none;
}
.fixed-vis {
margin: 0 auto;
width: auto;
}
.Links {
font-size: 1.1em;
}
.Links-mobile {
font-size: 1.75em;
}
</style>
</head>
<body id="mainbody">
<!-- Super Container that holds all of the row containers -->
<div id="super-container" class="super-container-mobile">
<!--Header Row container -->
<div id="header-row" class="column-row-mobile">
<div id="header" class="header-container-mobile">
<div class="logo-container">
<img alt="CAI Logo" src="./Images/Basic-logo.png" class="header-img" id="logo">
</div>
<div id="header-text">
<div>
<span class="company-header">Community Action, Inc</span>
</div>
<div style="margin-top: .5em;">
<span class="sub-header">Primarily Serving Clarion and Jefferson Counties, Pennsylvania</span>
</div>
</div>
</div>
<div class="header-line"></div>
<div id="nav" class="stellarnav light mobile"><i class="fa fa-bars"></i> Menu
<ul>
<li>Home</li>
<li class="has-sub">About
<ul>
<li class="has-sub">Annual Report
<ul>
<li>2014 - 2015</li>
<li>2013 - 2014</li>
<li>2012 - 2013</li>
<li>2011 - 2012</li>
<li>2010 - 2011</li>
<li>2009 - 2010</li>
<li>2008 - 2009</li>
<li>2007 - 2008</li>
<li>2006 - 2007</li>
<li>2005 - 2006</li>
<li>2004 - 2005</li>
<li>2003 - 2004</li>
<li>2002 - 2003</li>
<li>2001 - 2002</li>
</ul><a class="dd-toggle" href="#"><i class="fa fa-plus"></i></a></li>
<li>Bylaws</li>
<li>Charitable Organization Certificate</li>
<li>History</li>
<li>Project Guide</li>
<li class="has-sub">Strategic Plan
<ul>
<li>Strategic Plan</li>
<li>Strategic Plan Summary</li>
</ul><a class="dd-toggle" href="#"><i class="fa fa-plus"></i></a></li>
<li>Resources</li>
<li>Board</li>
<li>Financials</li>
</ul><a class="dd-toggle" href="#"><i class="fa fa-plus"></i></a></li>
<li class="has-sub">News
<ul>
<li>Newsletters</li>
<li>News Releases</li>
</ul><a class="dd-toggle" href="#"><i class="fa fa-plus"></i></a></li>
<li>Projects</li>
<li>Locations</li>
<li>Employment</li>
<li>Emergencies</li>
<li class="has-sub">Staff Only
<ul>
<li>Administration</li>
<li>Outlook Web App</li>
<li>Staff Portal</li>
</ul><a class="dd-toggle" href="#"><i class="fa fa-plus"></i></a></li>
<li>Contact Us</li>
</ul>
</div>
</div>
<br>
<br>
<!-- Main Row container -->
<div id="main-row" class="row-mobile">
<div id="main-content" class="main-content-container-mobile">
<div id="MainContentpnl">
<div class="content-cell-mobile">
<div class="main-content-header-mobile">Job Announcements</div>
<div class="Links-mobile">Accountant<br>Community Services Assistant<br>Information Technology Support Specialist<br>
Information Technology Manager<br></div>
</div>
<div class="content-cell-mobile"><span class="main-content-header-mobile">Free Home Weatherization</span>
<div class="clear"></div>
<div class="left-align">
<div class="main-content-body">
<p>Community Action, Inc. is accepting weatherization applications from Clarion, Indiana, and Jefferson County residents. Weatherization is a free government funded service intended to make your home more energy efficient and comfortable
by stopping ai...</p>Read More</div>
</div>
</div>
<div class="content-cell-mobile"><span class="main-content-header-mobile">Community Action, Inc. Names INDIANA County Senior Corps-RSVP June Volunteer of the Month</span>
<div class="clear"></div>
<div class="left-align">
<div class="main-content-img">
<img src="./Images/New_Release/1548_Image.jpeg" alt="Community Action, Inc. announced Lawrence Rager of Indiana was selected to be the Indiana County Senior Corps-RSVP Volunteer of the Month for June." class="body-img">
</div>
<div class="main-content-body">
<p>Community Action, Inc. announced Lawrence Rager of Indiana was selected to be the Indiana County Senior Corps-RSVP Volunteer of the Month for June. Lawrence has been a member of the Senior Corps-RSVP since October 2014 volunteering for
the Community ...</p>Read More</div>
</div>
</div>
<div class="content-cell-mobile"><span class="main-content-header-mobile">Community Action, Inc. Names INDIANA County Senior Corps-RSVP August Volunteer of the Month </span>
<div class="clear"></div>
<div class="left-align">
<div class="main-content-img">
<img src="./Images/New_Release/1553_Image.jpeg" alt="Eleanor Haney of Indiana was selected to be the Indiana County Senior Corps-RSVP Volunteer of the Month for August." class="body-img">
</div>
<div class="main-content-body">
<p>Community Action, Inc. announced Eleanor Haney of Indiana was selected to be the Indiana County Senior Corps-RSVP Volunteer of the Month for August. Eleanor has been a member of the Senior Corps-RSVP since April 2001 volunteering for Aging
Services, ...</p>Read More</div>
</div>
</div>
<div class="content-cell-mobile"><span class="main-content-header-mobile">Community Action, Inc. Names JEFFERSON County Senior Corps-RSVP August Volunteer of the Month </span>
<div class="clear"></div>
<div class="left-align">
<div class="main-content-img">
<img src="./Images/New_Release/1554_Image.jpeg" alt="Tom Brandon of Brookville was selected to be the Jefferson County Senior Corps-RSVP Volunteer of the Month for August." class="body-img">
</div>
<div class="main-content-body">
<p>Community Action, Inc. announced Tom Brandon of Brookville was selected to be the Jefferson County Senior Corps-RSVP Volunteer of the Month for August. Tom has been a member of the Senior Corps-RSVP since October 2013 volunteering for
Jefferson Count...</p>Read More</div>
</div>
</div>
<div class="content-cell-mobile"><span class="main-content-header-mobile">Community Action, Inc. Names CLARION County Senior Corps-RSVP August Volunteer of the Month </span>
<div class="clear"></div>
<div class="left-align">
<div class="main-content-img">
<img src="./Images/New_Release/1556_Image.jpeg" alt="Betty Siegel of Leeper was selected to be the Clarion County Senior Corps-RSVP Volunteer of the Month for August." class="body-img">
</div>
<div class="main-content-body">
<p>Community Action, Inc. announced Betty Siegel of Leeper was selected to be the Clarion County Senior Corps-RSVP Volunteer of the Month for August. Betty has been a member of the Senior Corps-RSVP since February 2010 volunteering for Clarion
Area Agen...</p>Read More</div>
</div>
</div>
<div class="content-cell-mobile"><span class="main-content-header-mobile">Community Action, Inc. Names JEFFERSON County Senior Corps-RSVP July Volunteer of the Month </span>
<div class="clear"></div>
<div class="left-align">
<div class="main-content-img">
<img src="./Images/New_Release/1546_Image.jpeg" alt="Louise Deyarmin of Punxsutawney was selected to be the Jefferson County Senior Corps-RSVP Volunteer of the Month for July." class="body-img">
</div>
<div class="main-content-body">
<p>Community Action, Inc. announced Louise Deyarmin of Punxsutawney was selected to be the Jefferson County Senior Corps-RSVP Volunteer of the Month for July. Louise has been a member of the Senior Corps-RSVP since August 2014 volunteering
for the Punxs...</p>Read More</div>
</div>
</div>
<div class="content-cell-mobile"><span class="main-content-header-mobile">Community Action, Inc. Names INDIANA County Senior Corps-RSVP July Volunteer of the Month </span>
<div class="clear"></div>
<div class="left-align">
<div class="main-content-img">
<img src="./Images/New_Release/1551_Image.jpeg" alt="Carole Bell of Indiana was selected to be the Indiana County Senior Corps-RSVP Volunteer of the Month for July." class="body-img">
</div>
<div class="main-content-body">
<p>Community Action, Inc. announced Carole Bell of Indiana was selected to be the Indiana County Senior Corps-RSVP Volunteer of the Month for July. Carole has been a member of the Senior Corps-RSVP since January 2015 volunteering for Aging
Services, Inc...</p>Read More</div>
</div>
</div>
<div class="content-cell-mobile"><span class="main-content-header-mobile">Community Action, Inc. Names CLARION County Senior Corps-RSVP July Volunteer of the Month </span>
<div class="clear"></div>
<div class="left-align">
<div class="main-content-img">
<img src="./Images/New_Release/1552_Image.jpeg" alt="Carol Brooks of New Bethlehem was selected to be the Clarion County Senior Corps-RSVP Volunteer of the Month for July." class="body-img">
</div>
<div class="main-content-body">
<p>Community Action, Inc. announced Carol Brooks of New Bethlehem was selected to be the Clarion County Senior Corps-RSVP Volunteer of the Month for July. Carol has been a member of the Senior Corps-RSVP since February 2010 volunteering for
the New Beth...</p>Read More</div>
</div>
</div>
<div class="content-cell-mobile"><span class="main-content-header-mobile">Be the Source of Change! Volunteer Today!</span>
<div class="clear"></div>
<div class="left-align">
<div class="main-content-body">
<p>Community Action, Inc.'s Career Development Project needs classroom volunteers and tutors to assist instructors and mentor students who want to improve their reading and math skills. For more information, please contact the Career Development
Projec...
</p>Read More</div>
</div>
</div>
<div class="content-cell-mobile"><span class="main-content-header-mobile">I Got My GED, You Can Too</span>
<div class="clear"></div>
<div class="left-align">
<div class="main-content-body">
<p>I achieved my GED through Community Action, Inc.’s Career Development Project, and my life has really turned around for the better. I made a quick decision to quit school when I was in the eleventh grade. I tried Cyber School, but it didn’t
work ou...</p>Read More</div>
</div>
</div>
</div>
</div>
<div id="RightBar" class="right-bar-mobile">
<div class="rightbar-well">
<span class="right-bar-header">Mission Statement</span><br><br>Community Action, Inc. will be a community catalyst to provide and coordinate activities which promote family self-sufficiency and advance community prosperity.
</div><br><br>
<div class="rightbar-well">
<span class="right-bar-header">Vision Statement</span><br><br>Community Action, Inc. will be recognized as a premier organization dedicated to solving social and economic problems of the community.
</div><br><br>
<div class="rightbar-well">
<span class="right-bar-header">Contact Information</span><br><br>
<div><a title="Community Action, Inc." href="http://www.jccap.org/Map_Main.aspx">Community Action, Inc.</a></div>
<div>105 Grace Way</div>
<div>Punxsutawney, PA 15767-1209</div>
<div>Phone: (814) 938-3302</div>
<div>Toll Free: 1-800-648-3381</div>
<div>contact#jccap.org</div>
</div><br><br>
<div class="padding rightbar-well text-center">
<span class="rightbar-headerText">Newsletters</span><br><br>Crossroads Connection - Fall 2013<br>Crossroads - September 2012<br>
Senior Corps RSVP - July 2012<br>Crossroads - October 2011<br>Senior Corps RSVP - August 2011<br>
</div><br><br>
<div class="padding rightbar-well text-center">
<span class="rightbar-headerText">Newsletters</span><br><br>Whistleblower Policy<br>Home Improvement Contractor's Certificate<br>
Community Action Needs Volunteers<br>Non-Discrimination Delivery of Services Policy<br>
Equal Employment Opportunity & Affirmative Action Policy Statement<br>
</div><br><br></div>
</div>
<!-- Footer Row container -->
<div id="footer-row" class="row-mobile footer-mobile">
<p class="footer-padding">
All persons are provided services without regard to race, color, religious creed, age, sex, ancestry, union membership, sexual orientation, gender identity, national or ethnic origin, disability and without regard to whether the person is a victim of
a violent crime (including domestic violence). Equal Opportunity Employer.
<br>
<br> This site was financed in part by a grant from the federal Department of Health and Human Services under the Administration of the Commonwealth of Pennsylvania, Department of Community and Economic Development.
<br>
<br> The official registration and financial information of Community Action, Inc. may be obtained from the Pennsylvania Department of State by calling toll free, within Pennsylvania, 1-800-732-0999. Registration does not imply endorsement.
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</body>
</html>
What I can tell you with just what you showed is that when you are working with multiple devices, for responsive design, you should not forget the viewport tag:
<meta name="viewport" content="width=device-width, initial-scale=1">
Place it inside your <head> tag
Its because you are not maintaining the margins of your body and also not maintaining the text justification.
.super-container-mobile {
width: 90%;
height: 100%;
margin: auto 10px;
text-align: justify;}
I can't figure out how to center my image containers inside of my columns. Also for some reason the middle picture does not display even though everything is set up exactly how the other two are, is there some reason this is occurring?
Also, for whatever reason my columns do not format correctly when using google chrome. I thought the -webkit- was suppose to fix this?
.columns {
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
column-gap: 20px;
}
.columns-format {
display: inline-block;
width: auto;
}
.image-container {
display: inline-block;
border: 1px solid #ddd;
border-radius: 4px;
padding: 5px;
transition: 0.3s;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
margin: auto;
}
.image-container hover {
box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
<div class="columns">
<div class="columns-format">
<h4>Professionals</h4>
<p>As Northeast Ohio Landscapers, Landscaping Company has been caring for customers and their properties throughout Cuyahoga County since 1981.</p>
<p>Our core values:
<ul>
<li>Bring a positive attitude with you each and every day</li>
<li>Work hard, pitch in, be helpful and productive</li>
<li>Be fair and respectful with all people in all encounters</li>
</ul>
</p>
<div class="image-container">
<a target="_blank" href="images/stairwell.jpg">
<img src="images/stairwell.jpg" width="250px" height="200px">
</a>
</div>
</div>
<div class="columns-format">
<h4>Services</h4>
<p>Whether you are new to Cuyahoga County, switching landscape service providers, or need to add a service to your existing account, Landscaping Company makes it easy for you.</p>
<p>Experienced in every facet of the landscape industry, we fulfil our one goal - total care philosophy by meeting your every need in the following areas:</p>
<p>Residential Landscape</p>
<p>Maintenance Landscape</p>
<p>Design/Installation</p>
<p>Plant Health Care</p>
<div class="image-container">
<a target="_blank" href="images/flowers.jpg">
<img src="images/flowers.jpg" width="250px" height="200px">
</a>
</div>
</div>
<div class="columns-format">
<h4>Mission</h4>
<p>When it comes to Residential Landscape Maintenance in Northeast Ohio, we have a pretty simple mission.</p>
<p>Our mission is to unite people in positive relationships to improve lives.</p>
<p>This includes not only our great customers but also our fantastic employees and vendors that we work with each and every day.</p>
<p>If we are not improving your life then we are not living up to our mission.</p>
</div>
<div class="image-container">
<a target="_blank" href="images/lighting.jpg">
<img src="images/lighting.jpg" width="250px" height="200px">
</a>
</div>
</div>
May I suggest you use flexbox instead of columns.
columns is more meant to make texts and images to dynamically spread over a certain amount of columns and your sample looks more as 3 columns that should have its content contained within each column, which columns does not do.
To make your images/columns not overlap, you either give the columns-format a minimum width (in below sample), set the image size to percent, wrap the columns, etc.
.columns {
display: flex;
justify-content: space-between;
}
.columns-format {
display: inline-block;
width: 30%;
min-width: 300px;
}
.image-container {
text-align: center;
}
.image-container a {
display: inline-block;
border: 1px solid #ddd;
border-radius: 4px;
padding: 5px;
transition: box-shadow 0.3s;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
.image-container a:hover {
box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
}
<div class="columns">
<div class="columns-format">
<h4>Professionals</h4>
<p>As Northeast Ohio Landscapers, Landscaping Company has been caring for customers and their properties throughout Cuyahoga County since 1981.</p>
<p>Our core values:</p>
<ul>
<li>Bring a positive attitude with you each and every day</li>
<li>Work hard, pitch in, be helpful and productive</li>
<li>Be fair and respectful with all people in all encounters</li>
</ul>
<div class="image-container">
<a target="_blank" href="images/stairwell.jpg">
<img src="images/stairwell.jpg" width="250px" height="200px">
</a>
</div>
</div>
<div class="columns-format">
<h4>Services</h4>
<p>Whether you are new to Cuyahoga County, switching landscape service providers, or need to add a service to your existing account, Landscaping Company makes it easy for you.</p>
<p>Experienced in every facet of the landscape industry, we fulfil our one goal - total care philosophy by meeting your every need in the following areas:</p>
<p>Residential Landscape</p>
<p>Maintenance Landscape</p>
<p>Design/Installation</p>
<p>Plant Health Care</p>
<div class="image-container">
<a target="_blank" href="images/flowers.jpg">
<img src="images/flowers.jpg" width="250px" height="200px">
</a>
</div>
</div>
<div class="columns-format">
<h4>Mission</h4>
<p>When it comes to Residential Landscape Maintenance in Northeast Ohio, we have a pretty simple mission.</p>
<p>Our mission is to unite people in positive relationships to improve lives.</p>
<p>This includes not only our great customers but also our fantastic employees and vendors that we work with each and every day.</p>
<p>If we are not improving your life then we are not living up to our mission.</p>
<div class="image-container">
<a target="_blank" href="images/lighting.jpg">
<img src="images/lighting.jpg" width="250px" height="200px">
</a>
</div>
</div>
</div>
Add another class in section -
<div class="columns-format">
<div class='text-container'>
<h4>Professionals</h4>
<p>As Northeast Ohio Landscapers, Landscaping Company has been caring for customers and their properties throughout Cuyahoga County since 1981.</p>
<p>Our core values:
<ul>
<li>Bring a positive attitude with you each and every day</li>
<li>Work hard, pitch in, be helpful and productive</li>
<li>Be fair and respectful with all people in all encounters</li>
</ul>
</p>
</div>
<div class="image-container">
<a target="_blank" href="images/stairwell.jpg">
<img src="images/stairwell.jpg" width="250px" height="200px">
</a>
</div>
</div>
and put css
.text-container{text-align: left;}
add two line in css of columns-format
.columns-format {
display: inline-block;
width: auto;
float: left;
text-align: center;
}
Is this output R u expecting?
check the output in Link to Jsbin
.columns {
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
column-gap: 20px;
}
.columns-format {
text-align:center;
margin:auto;
}
.image-container {
display: inline-block;
border: 1px solid #ddd;
border-radius: 4px;
padding: 5px;
transition: 0.3s;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
margin: auto;
text-align:center;
}
.image-container hover {
box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class="columns">
<div class="columns-format">
<h4>Professionals</h4>
<p>As Northeast Ohio Landscapers, Landscaping Company has been caring for customers and their properties throughout Cuyahoga County since 1981.</p>
<p>Our core values:
<ul>
<li>Bring a positive attitude with you each and every day</li>
<li>Work hard, pitch in, be helpful and productive</li>
<li>Be fair and respectful with all people in all encounters</li>
</ul>
</p>
<div class="image-container">
<a target="_blank" href="images/stairwell.jpg">
<img src="images/stairwell.jpg" width="250px" height="200px">
</a>
</div>
</div>
<div class="columns-format">
<h4>Services</h4>
<p>Whether you are new to Cuyahoga County, switching landscape service providers, or need to add a service to your existing account, Landscaping Company makes it easy for you.</p>
<p>Experienced in every facet of the landscape industry, we fulfil our one goal - total care philosophy by meeting your every need in the following areas:</p>
<p>Residential Landscape</p>
<p>Maintenance Landscape</p>
<p>Design/Installation</p>
<p>Plant Health Care</p>
<div class="image-container">
<a target="_blank" href="images/flowers.jpg">
<img src="images/flowers.jpg" width="250px" height="200px">
</a>
</div>
</div>
<div class="columns-format">
<h4>Mission</h4>
<p>When it comes to Residential Landscape Maintenance in Northeast Ohio, we have a pretty simple mission.</p>
<p>Our mission is to unite people in positive relationships to improve lives.</p>
<p>This includes not only our great customers but also our fantastic employees and vendors that we work with each and every day.</p>
<p>If we are not improving your life then we are not living up to our mission.</p>
</div>
<div class="image-container">
<a target="_blank" href="images/lighting.jpg">
<img src="images/lighting.jpg" width="250px" height="200px">
</a>
</div>
</div>
</body>
</html>
You need a surrounding div around before your inline-block image container. Something like adding the class
.centered{
text-align:center
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.columns {
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
column-gap: 20px;
}
.columns-format {
display: inline-block;
width: auto;
}
.image-container {
display: inline-block;
border: 1px solid #ddd;
border-radius: 4px;
padding: 5px;
transition: 0.3s;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
margin: 0 auto;
}
.image-container hover {
box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
}
.centered{
text-align:center;
}
</style>
</head>
<body>
<div class="columns">
<div class="columns-format">
<h4>Professionals</h4>
<p>As Northeast Ohio Landscapers, Landscaping Company has been caring for customers and their properties throughout Cuyahoga County since 1981.</p>
<p>Our core values:
<ul>
<li>Bring a positive attitude with you each and every day</li>
<li>Work hard, pitch in, be helpful and productive</li>
<li>Be fair and respectful with all people in all encounters</li>
</ul>
</p>
<div class = "centered">
<div class="image-container">
<a target="_blank" href="images/stairwell.jpg">
<img src="http://placehold.it/200x200" width="250px" height="200px">
</a>
</div>
</div>
</div>
<div class="columns-format">
<h4>Services</h4>
<p>Whether you are new to Cuyahoga County, switching landscape service providers, or need to add a service to your existing account, Landscaping Company makes it easy for you.</p>
<p>Experienced in every facet of the landscape industry, we fulfil our one goal - total care philosophy by meeting your every need in the following areas:</p>
<p>Residential Landscape</p>
<p>Maintenance Landscape</p>
<p>Design/Installation</p>
<p>Plant Health Care</p>
<div class = "centered">
<div class="image-container">
<a target="_blank" href="images/flowers.jpg">
<img src="http://placehold.it/200x200" width="250px" height="200px">
</a>
</div>
</div>
</div>
<div class="columns-format">
<h4>Mission</h4>
<p>When it comes to Residential Landscape Maintenance in Northeast Ohio, we have a pretty simple mission.</p>
<p>Our mission is to unite people in positive relationships to improve lives.</p>
<p>This includes not only our great customers but also our fantastic employees and vendors that we work with each and every day.</p>
<p>If we are not improving your life then we are not living up to our mission.</p>
</div>
<div class = "centered">
<div class="image-container">
<a target="_blank" href="images/lighting.jpg">
<img src="http://placehold.it/200x200" width="250px" height="200px">
</a>
</div>
</div>
</div>
</body>
</html>
just add display: flex to .column-formats and give flex-direction column and you are good to go
.columns {
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
column-gap: 20px;
}
.columns-format {
display: flex;
width: auto;
flex-direction:column
}
.image-container {
display: inline-block;
border: 1px solid #ddd;
border-radius: 4px;
padding: 5px;
transition: 0.3s;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
margin: auto;
}
.image-container hover {
box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
<div class="columns">
<div class="columns-format">
<h4>Professionals</h4>
<p>As Northeast Ohio Landscapers, Landscaping Company has been caring for customers and their properties throughout Cuyahoga County since 1981.</p>
<p>Our core values:
<ul>
<li>Bring a positive attitude with you each and every day</li>
<li>Work hard, pitch in, be helpful and productive</li>
<li>Be fair and respectful with all people in all encounters</li>
</ul>
</p>
<div class="image-container">
<a target="_blank" href="images/stairwell.jpg">
<img src="images/stairwell.jpg" width="250px" height="200px">
</a>
</div>
</div>
<div class="columns-format">
<h4>Services</h4>
<p>Whether you are new to Cuyahoga County, switching landscape service providers, or need to add a service to your existing account, Landscaping Company makes it easy for you.</p>
<p>Experienced in every facet of the landscape industry, we fulfil our one goal - total care philosophy by meeting your every need in the following areas:</p>
<p>Residential Landscape</p>
<p>Maintenance Landscape</p>
<p>Design/Installation</p>
<p>Plant Health Care</p>
<div class="image-container">
<a target="_blank" href="images/flowers.jpg">
<img src="images/flowers.jpg" width="250px" height="200px">
</a>
</div>
</div>
<div class="columns-format">
<h4>Mission</h4>
<p>When it comes to Residential Landscape Maintenance in Northeast Ohio, we have a pretty simple mission.</p>
<p>Our mission is to unite people in positive relationships to improve lives.</p>
<p>This includes not only our great customers but also our fantastic employees and vendors that we work with each and every day.</p>
<p>If we are not improving your life then we are not living up to our mission.</p>
<div class="image-container">
<a target="_blank" href="images/lighting.jpg">
<img src="images/lighting.jpg" width="250px" height="200px">
</a>
</div>
</div>
</div>