Aligning text around images using HTML and CSS - html

I have the following issue involving the placement of text around an image using CSS and HTML. The way I've written it works as long as the text doesn't pass the image. The problem is that as soon as it "overflows" beyond the bottom of the image, it justifies all the way left and looks really sloppy.
How can I keep the text below the bottom of the image aligned with the previous text?
Note: I had to remove my original photo to prevent sharing personal information, and the replacement photo ended up being a little bit taller, so I had to copy and paste the text a few times to make it long enough to show what I'm talking about.
Here's the jsfiddle example including all my code: https://jsfiddle.net/dLa9jgcm/2/
.photo {
float: left;
height: 200px;
width: 200px;
margin-right: 20px;
overflow: hidden;
}
.photo img {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
width: 100%;
}
.info {}
.info h2,
#header h2 {
text-transform: uppercase;
letter-spacing: 2px;
margin-bottom: .3em;
}
.info h4,
#header h4 {
color: #999;
}
<div id="tab-data-wrap">
<!-- About Tab Data -->
<div id="about">
<section class="clearfix">
<div class="g2">
<div class="photo">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Olympic_rings_without_rims.svg/342px-Olympic_rings_without_rims.svg.png" alt="Olympic Rings">
</div>
<div class="info">
<h2>
Zeus
</h2>
<h4>
Associate Financial Advisor
</h4>
<p>Providing expert advice and guidance on investments and retirement planning in conjunction with high level service to individuals and families so that they have the peace-of-mind to pursue other important endeavors throughout their lives. Providing
expert advice and guidance on investments and retirement planning in conjunction with high level service to individuals and families so that they have the peace-of-mind to pursue other important endeavors throughout their lives. Providing
expert advice and guidance on investments and retirement planning in conjunction with high level service to individuals and families so that they have the peace-of-mind to pursue other important endeavors throughout their lives.</p>
<br> I am a Certified Financial Planner (CFP®).
</div>

Here u go JSFiddle link
.info{
float: left;
width: calc(100% - 220px);/*value should be equal to width of image along with margin*/
}

All you need to add is:
.g2 {
display: flex;
}
.photo {
min-width: 25%;
}
.photo{
float: left;
height: 200px;
width: 200px;
margin-right: 20px;
overflow: hidden;
}
.photo img{
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
width: 100%;
}
.info{
}
.info h2, #header h2{
text-transform: uppercase;
letter-spacing: 2px;
margin-bottom: .3em;
}
.info h4, #header h4{
color: #999;
}
.g2 {display: flex;}
.photo {
min-width: 25%;
}
<div id="tab-data-wrap">
<!-- About Tab Data -->
<div id="about">
<section class="clearfix">
<div class="g2">
<div class="photo">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Olympic_rings_without_rims.svg/342px-Olympic_rings_without_rims.svg.png" alt="Olympic Rings">
</div>
<div class="info">
<h2>
Zeus
</h2>
<h4>
Associate Financial Advisor
</h4>
<p>Providing expert advice and guidance on investments and retirement planning in conjunction with high level service to individuals and families so that they have the peace-of-mind to pursue other important endeavors throughout their lives. Providing expert advice and guidance on investments and retirement planning in conjunction with high level service to individuals and families so that they have the peace-of-mind to pursue other important endeavors throughout their lives. Providing expert advice and guidance on investments and retirement planning in conjunction with high level service to individuals and families so that they have the peace-of-mind to pursue other important endeavors throughout their lives.</p>
<br> I am a Certified Financial Planner (CFP®).
</div>
See it here (SO snippets seems down): https://jsfiddle.net/websiter/9d40ap7c/
Feel free to provide the image min-width in any unit you want if you want it fixed size.

Related

My title isn't in the center

I am completely positive that my code causes my title to be in the center of my textbox, however, it doesn't look like it is! Can someone check that my code is sound?
.container {
width: 95%;
margin: 0 auto;
}
.home-about-textbox {
background-color: #232323;
padding: 4em;
width: 100vw;
margin-left: -2.65%;
outline: 2px solid #00ff6c;
outline-offset: -2.5em;
color: #FFF;
}
.home-about-textbox h1 {
text-align: center;
color: #00ff6c;
}
<div class="container">
<section class="home-about">
<div class="home-about-textbox">
<h1>Who I am</h1>
<p>I'm a young website developer who focusses on primarily making websites that are proven to have a <strong>high conversion rate</strong> so that my clients can experience that feeling of <strong>ever increasing cash flow!</strong></p>
<p>I usually like to spend a lot of my freetime working on either: a client's website design, or my personal website design. I am never the 'second-best' when it comes to website design which is why I offer numerous <strong>free</strong> design revisions
upon submission!</p>
</div>
</section>
</div>
Image of the Textbox:
Removing width: 100vwfrom .home-about-textbox seems fixed problem, no?
.container {
width: 95%;
margin: 0 auto;
}
.home-about-textbox {
background-color: #232323;
padding: 4em;
margin-left: -2.65%;
outline: 2px solid #00ff6c;
outline-offset: -2.5em;
color: #FFF;
}
.home-about-textbox h1 {
text-align: center;
color: #00ff6c;
}
<div class="container">
<section class="home-about">
<div class="home-about-textbox">
<h1>Who I am</h1>
<p>I'm a young website developer who focusses on primarily making websites that are proven to have a <strong>high conversion rate</strong> so that my clients can experience that feeling of <strong>ever increasing cash flow!</strong></p>
<p>I usually like to spend a lot of my freetime working on either: a client's website design, or my personal website design. I am never the 'second-best' when it comes to website design which is why I offer numerous <strong>free</strong> design revisions
upon submission!</p>
</div>
</section>
</div>
Why not write the <p> or <div> inside a <center> tag. It causes anything to be centered. In order to avoid further problems isolote the element to be centered from other elements.

CSS boxes layout

I am trying to create boxes next to each other but I am not sure what I am missing or getting wrong?
I have tried border attributes but it seems not working properly, and I would like the vertical lines to be attached to the horizontal lines and the content of the boxes be equally disposed like showed in the screenshot from Balenciaga website.
Balenciaga Website Footer
* {
box-sizing: border-box;
color: #000;
margin: inherit;
}
html {
background-color: #dee1ec;
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
}
body {}
a {
text-decoration: none;
}
.header {
border-bottom: 1px solid #000;
border-top: 1px solid #000;
padding-bottom: 16px;
padding-top: 16px;
}
.christianmeloni {
display: inline-block;
padding-left: 12px;
}
.menu {
display: inline-block;
float: right;
padding-right: 12px;
}
.work:hover,
.about:hover,
.contact:hover {
text-decoration: underline;
}
.content {
margin-bottom: 12px;
margin-top: 12px;
padding-left: 12px;
padding-right: 12px;
}
.mission {}
.band {
border-bottom: 1px solid #000;
border-top: 1px solid #000;
padding-bottom: 22px;
padding-top: 22px;
}
.brand {
border-right: 1px solid #000;
display: inline-block;
min-height: 320px;
padding-right: 12px;
width: 20%;
}
.experience {
border-right: 1px solid #000;
display: inline-block;
min-height: 320px;
padding-left: 12px;
padding-right: 12px;
width: 20%;
}
.innovation {
display: inline-block;
min-height: 320px;
padding-left: 12px;
padding-right: 12px;
width: 20%;
}
.engagement {
border-left: 1px solid #000;
display: inline-block;
min-height: 320px;
padding-left: 12px;
padding-right: 12px;
width: 20%;
}
.strategy {
border-left: 1px solid #000;
display: inline-block;
min-height: 320px;
padding-left: 12px;
width: 20%;
}
.footer {
border-bottom: 1px solid #000;
border-top: 1px solid #000;
padding-bottom: 16px;
padding-top: 16px;
}
.credit {
display: inline-block;
padding-left: 12px;
}
.follow {
display: inline-block;
float: right;
padding-right: 12px;
}
.credit:hover,
.facebook:hover,
.twitter:hover,
.instagram:hover {
text-decoration: underline;
}
<header class="header">
<div class="christianmeloni">
<span>
CHRISTIAN MELONI
</span>
</div>
<div class="menu">
<span>
<a class="work" href="#">Work</a>
<a class="about" href="#">About</a>
<a class="contact" href="#">Contact</a>
</span>
</div>
</header>
<div class="content">
<div class="mission">
<div>
Transforming businesses by developing original products, services and experiences. Disruptive thinking for ambitious brands. Challenge the ordinary, to achieve the extraordinary. We’re always in motion.
</div>
<div>
Our experience is that working collaboratively produces the best results.
</div>
<div>
Known for a collaborative, problem-solving approach to design, with personal involvement by all principals in every project and continuous attention to the details. We’re a global brand and innovation consultancy. We help ambitious leaders define compelling
brand strategies, design powerful brand experiences and innovate new brand-led products and services. We challenge ourselves and our clients to push boundaries. We are a design and innovation company. We work with forward-looking companies to shape
modern brands for a purpose-driven future. Founded with a simple but compelling vision: to build a brand consultancy as strong in its strategic thinking as it was in its creativity. We can’t help but tell it how it is. We know the rules and know
when and how to break them. We have firm beliefs, big ideas, strong convictions. We look inside for ideas and outside for inspiration. We like to challenge and be challenged, to teach and be taught. We take our craft seriously – ourselves less so.
We play music by ear, we follow our intuition. This is our nature, our essence. We have a strong ‘one-office’ philosophy and operating model. Our global team of strategists, designers and programme managers work as one coherent team across our different
locations in order to bring the best of our knowledge, skills and experience to every one of our clients wherever they are in the world. We come from many different places, speak many different languages and bring diverse skills and perspectives.
But we operate as one office, bringing the best regardless of where we (or you) are.
</div>
</div>
</div>
<div class="band"></div>
<div class="content">
<div class="brand">
<div>
BRAND
</div>
<div>
Disruptive thinking starts with a great story. We help leaders discover and define the most powerful and authentic brand narrative that will inspire their people, engage their customers and disrupt their markets. We help them develop a concise set of
bold and innovative initiatives that challenge the status quo and make the brand vision a reality.
</div>
</div>
<div class="experience">
<div>
EXPERIENCE
</div>
<div>
Disruptive thinking delivers great customer experiences. We design powerful, creative and engaging brand experiences, online and offline, that challenge people to think, feel and behave differently towards the brand and turn passive customers into passionate
brand advocates.
</div>
</div>
<div class="innovation">
<div>
INNOVATION
</div>
<div>
Disruptive thinking requires innovation. We work closely with our clients to develop new brands, products and services that are rooted in, and bring to life, what makes them special. We think it’s this kind of brand-led innovation that proves sustainably
successful. The smartest thinkers come to us to collaborate with each other. Designers, strategists, writers, makers, innovators, and dreamers—together we keep brands agile. We build some of the world’s most agile brands—brands that thrive on change.
</div>
</div>
<div class="engagement">
<div>
ENGAGEMENT
</div>
<div>
Disruptive thinking requires innovation. We work closely with our clients to develop new brands, products and services that are rooted in, and bring to life, what makes them special. We think it’s this kind of brand-led innovation that proves sustainably
successful. The smartest thinkers come to us to collaborate with each other. Designers, strategists, writers, makers, innovators, and dreamers—together we keep brands agile. We build some of the world’s most agile brands—brands that thrive on change.
</div>
</div>
<div class="strategy">
<div>
STRATEGY
</div>
<div>
Disruptive thinking requires innovation. We work closely with our clients to develop new brands, products and services that are rooted in, and bring to life, what makes them special. We think it’s this kind of brand-led innovation that proves sustainably
successful. The smartest thinkers come to us to collaborate with each other. Designers, strategists, writers, makers, innovators, and dreamers—together we keep brands agile. We build some of the world’s most agile brands—brands that thrive on change.
</div>
</div>
</div>
<footer class="footer">
<div class="credit">
<span>
© 2017 Christian Meloni
</span>
</div>
<div class="follow">
<span>
<a class="facebook" href="https://www.facebook.com/christianmelonicom/">Facebook</a>
<a class="twitter" href="#">Twitter</a>
<a class="instagram" href="#">Instagram</a>
</span>
</div>
</footer>
Instead of relying on display: inline-block, which causes items to be aligned by the base line, you can use CSS flexbox instead. The advantage of using flexbox is that each item will be stretched to its parent container's height (no more ugly equal height hacks), and it is just extremely easy to implement:
.content {
padding-left: 12px;
padding-right: 12px;
display: flex; // This is what you really need
}
// This is just to give the individual columns sufficient space at the top and bottom
.content > div {
padding-top: 12px;
padding-bottom: 12px;
}
And simply remove all the min-height and display: inline-block from the direct descendants of the <div class="content"> element, and you are good to go.
See proof-of-concept below:
* {
box-sizing: border-box;
color: #000;
margin: inherit;
}
html {
background-color: #dee1ec;
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
}
body {
}
a {
text-decoration: none;
}
.header {
border-bottom: 1px solid #000;
border-top: 1px solid #000;
padding-bottom: 16px;
padding-top: 16px;
}
.christianmeloni {
display: inline-block;
padding-left: 12px;
}
.menu {
display: inline-block;
float: right;
padding-right: 12px;
}
.work:hover, .about:hover, .contact:hover {
text-decoration: underline;
}
.content {
padding-left: 12px;
padding-right: 12px;
display: flex;
}
.content > div {
padding-top: 12px;
padding-bottom: 12px;
}
.band {
border-bottom: 1px solid #000;
border-top: 1px solid #000;
padding-bottom: 22px;
padding-top: 22px;
}
.brand {
border-right: 1px solid #000;
padding-right: 12px;
width: 20%;
}
.experience {
border-right: 1px solid #000;
padding-left: 12px;
padding-right: 12px;
width: 20%;
}
.innovation{
padding-left: 12px;
padding-right: 12px;
width: 20%;
}
.engagement{
border-left: 1px solid #000;
padding-left: 12px;
padding-right: 12px;
width: 20%;
}
.strategy{
border-left: 1px solid #000;
padding-left: 12px;
width: 20%;
}
.footer {
border-bottom: 1px solid #000;
border-top: 1px solid #000;
padding-bottom: 16px;
padding-top: 16px;
}
.credit {
display: inline-block;
padding-left: 12px;
}
.follow {
display: inline-block;
float: right;
padding-right: 12px;
}
.credit:hover, .facebook:hover, .twitter:hover, .instagram:hover {
text-decoration: underline;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Christian Meloni</title>
<link href="christianmeloni.css" rel="stylesheet">
<link href="christianmeloni.ico" rel="icon">
</head>
<body>
<header class="header">
<div class="christianmeloni">
<span>
CHRISTIAN MELONI
</span>
</div>
<div class="menu">
<span>
<a class="work" href="#">Work</a>
<a class="about" href="#">About</a>
<a class="contact" href="#">Contact</a>
</span>
</div>
</header>
<div class="content">
<div class="mission">
<div>
Transforming businesses by developing original products, services and experiences.
Disruptive thinking for ambitious brands.
Challenge the ordinary, to achieve the extraordinary.
We’re always in motion.
</div>
<div>
Our experience is that working collaboratively produces the best results.
</div>
<div>
Known for a collaborative, problem-solving approach to design, with personal involvement by all principals in every project and continuous attention to the details.
We’re a global brand and innovation consultancy.
We help ambitious leaders define compelling brand strategies, design powerful brand experiences and innovate new brand-led products and services.
We challenge ourselves and our clients to push boundaries.
We are a design and innovation company. We work with forward-looking companies to shape modern brands for a purpose-driven future.
Founded with a simple but compelling vision: to build a brand consultancy as strong in its strategic thinking as it was in its creativity.
We can’t help but tell it how it is. We know the rules and know when and how to break them. We have firm beliefs, big ideas, strong convictions. We look inside for ideas and outside for inspiration. We like to challenge and be challenged, to teach and be taught. We take our craft seriously – ourselves less so. We play music by ear, we follow our intuition.
This is our nature, our essence.
We have a strong ‘one-office’ philosophy and operating model. Our global team of strategists, designers and programme managers work as one coherent team across our different locations in order to bring the best of our knowledge, skills and experience to every one of our clients wherever they are in the world.
We come from many different places, speak many different languages and bring diverse skills and perspectives. But we operate as one office, bringing the best regardless of where we (or you) are.
</div>
</div>
</div>
<div class="band"></div>
<div class="content">
<div class="brand">
<div>
BRAND
</div>
<div>
Disruptive thinking starts with a great story. We help leaders discover and define the most powerful and authentic brand narrative that will inspire their people, engage their customers and disrupt their markets. We help them develop a concise set of bold and innovative initiatives that challenge the status quo and make the brand vision a reality.
</div>
</div>
<div class="experience">
<div>
EXPERIENCE
</div>
<div>
Disruptive thinking delivers great customer experiences. We design powerful, creative and engaging brand experiences, online and offline, that challenge people to think, feel and behave differently towards the brand and turn passive customers into passionate brand advocates.
</div>
</div>
<div class="innovation">
<div>
INNOVATION
</div>
<div>
Disruptive thinking requires innovation. We work closely with our clients to develop new brands, products and services that are rooted in, and bring to life, what makes them special. We think it’s this kind of brand-led innovation that proves sustainably successful.
The smartest thinkers come to us to collaborate with each other. Designers, strategists, writers, makers, innovators, and dreamers—together we keep brands agile.
We build some of the world’s most agile brands—brands that thrive on change.
</div>
</div>
<div class="engagement">
<div>
ENGAGEMENT
</div>
<div>
Disruptive thinking requires innovation. We work closely with our clients to develop new brands, products and services that are rooted in, and bring to life, what makes them special. We think it’s this kind of brand-led innovation that proves sustainably successful.
The smartest thinkers come to us to collaborate with each other. Designers, strategists, writers, makers, innovators, and dreamers—together we keep brands agile.
We build some of the world’s most agile brands—brands that thrive on change.
</div>
</div>
<div class="strategy">
<div>
STRATEGY
</div>
<div>
Disruptive thinking requires innovation. We work closely with our clients to develop new brands, products and services that are rooted in, and bring to life, what makes them special. We think it’s this kind of brand-led innovation that proves sustainably successful.
The smartest thinkers come to us to collaborate with each other. Designers, strategists, writers, makers, innovators, and dreamers—together we keep brands agile.
We build some of the world’s most agile brands—brands that thrive on change.
</div>
</div>
</div>
<footer class="footer">
<div class="credit">
<span>
© 2017 Christian Meloni
</span>
</div>
<div class="follow">
<span>
<a class="facebook" href="https://www.facebook.com/christianmelonicom/">Facebook</a>
<a class="twitter" href="#">Twitter</a>
<a class="instagram" href="#">Instagram</a>
</span>
</div>
</footer>
</body>
</html>
I edited your snipet.
I used display: flex; on .content
Removed margin and padding to ad them on boxes (.subContent)
* {
box-sizing: border-box;
color: #000;
margin: inherit;
}
html {
background-color: #dee1ec;
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
}
body {}
a {
text-decoration: none;
}
.header {
border-bottom: 1px solid #000;
border-top: 1px solid #000;
padding-bottom: 16px;
padding-top: 16px;
}
.christianmeloni {
display: inline-block;
padding-left: 12px;
}
.menu {
display: inline-block;
float: right;
padding-right: 12px;
}
.work:hover,
.about:hover,
.contact:hover {
text-decoration: underline;
}
.content {
margin-bottom: 12px;
margin-top: 12px;
padding-left: 12px;
padding-right: 12px;
}
.mission {}
.band {
border-bottom: 1px solid #000;
border-top: 1px solid #000;
padding-bottom: 22px;
padding-top: 22px;
}
.brand {
border-right: 1px solid #000;
display: inline-block;
min-height: 320px;
padding-right: 12px;
width: 20%;
}
.experience {
border-right: 1px solid #000;
display: inline-block;
min-height: 320px;
padding-left: 12px;
padding-right: 12px;
width: 20%;
}
.innovation {
display: inline-block;
min-height: 320px;
padding-left: 12px;
padding-right: 12px;
width: 20%;
}
.engagement {
border-left: 1px solid #000;
display: inline-block;
min-height: 320px;
padding-left: 12px;
padding-right: 12px;
width: 20%;
}
.strategy {
border-left: 1px solid #000;
display: inline-block;
min-height: 320px;
padding-left: 12px;
width: 20%;
}
.footer {
border-bottom: 1px solid #000;
border-top: 1px solid #000;
padding-bottom: 16px;
padding-top: 16px;
}
.credit {
display: inline-block;
padding-left: 12px;
}
.follow {
display: inline-block;
float: right;
padding-right: 12px;
}
.credit:hover,
.facebook:hover,
.twitter:hover,
.instagram:hover {
text-decoration: underline;
}
.content {
margin: 0;
padding: 0;
display: flex;
}
.subContent {
padding : 12px;
}
<header class="header">
<div class="christianmeloni">
<span>
CHRISTIAN MELONI
</span>
</div>
<div class="menu">
<span>
<a class="work" href="#">Work</a>
<a class="about" href="#">About</a>
<a class="contact" href="#">Contact</a>
</span>
</div>
</header>
<div class="content">
<div class="subContent mission">
<div>
Transforming businesses by developing original products, services and experiences. Disruptive thinking for ambitious brands. Challenge the ordinary, to achieve the extraordinary. We’re always in motion.
</div>
<div>
Our experience is that working collaboratively produces the best results.
</div>
<div>
Known for a collaborative, problem-solving approach to design, with personal involvement by all principals in every project and continuous attention to the details. We’re a global brand and innovation consultancy. We help ambitious leaders define compelling
brand strategies, design powerful brand experiences and innovate new brand-led products and services. We challenge ourselves and our clients to push boundaries. We are a design and innovation company. We work with forward-looking companies to shape
modern brands for a purpose-driven future. Founded with a simple but compelling vision: to build a brand consultancy as strong in its strategic thinking as it was in its creativity. We can’t help but tell it how it is. We know the rules and know
when and how to break them. We have firm beliefs, big ideas, strong convictions. We look inside for ideas and outside for inspiration. We like to challenge and be challenged, to teach and be taught. We take our craft seriously – ourselves less so.
We play music by ear, we follow our intuition. This is our nature, our essence. We have a strong ‘one-office’ philosophy and operating model. Our global team of strategists, designers and programme managers work as one coherent team across our different
locations in order to bring the best of our knowledge, skills and experience to every one of our clients wherever they are in the world. We come from many different places, speak many different languages and bring diverse skills and perspectives.
But we operate as one office, bringing the best regardless of where we (or you) are.
</div>
</div>
</div>
<div class="band"></div>
<div class="content">
<div class="subContent brand">
<div>
BRAND
</div>
<div>
Disruptive thinking starts with a great story. We help leaders discover and define the most powerful and authentic brand narrative that will inspire their people, engage their customers and disrupt their markets. We help them develop a concise set of
bold and innovative initiatives that challenge the status quo and make the brand vision a reality.
</div>
</div>
<div class="subContent experience">
<div>
EXPERIENCE
</div>
<div>
Disruptive thinking delivers great customer experiences. We design powerful, creative and engaging brand experiences, online and offline, that challenge people to think, feel and behave differently towards the brand and turn passive customers into passionate
brand advocates.
</div>
</div>
<div class="subContent innovation">
<div>
INNOVATION
</div>
<div>
Disruptive thinking requires innovation. We work closely with our clients to develop new brands, products and services that are rooted in, and bring to life, what makes them special. We think it’s this kind of brand-led innovation that proves sustainably
successful. The smartest thinkers come to us to collaborate with each other. Designers, strategists, writers, makers, innovators, and dreamers—together we keep brands agile. We build some of the world’s most agile brands—brands that thrive on change.
</div>
</div>
<div class="subContent engagement">
<div>
ENGAGEMENT
</div>
<div>
Disruptive thinking requires innovation. We work closely with our clients to develop new brands, products and services that are rooted in, and bring to life, what makes them special. We think it’s this kind of brand-led innovation that proves sustainably
successful. The smartest thinkers come to us to collaborate with each other. Designers, strategists, writers, makers, innovators, and dreamers—together we keep brands agile. We build some of the world’s most agile brands—brands that thrive on change.
</div>
</div>
<div class="subContent strategy">
<div>
STRATEGY
</div>
<div>
Disruptive thinking requires innovation. We work closely with our clients to develop new brands, products and services that are rooted in, and bring to life, what makes them special. We think it’s this kind of brand-led innovation that proves sustainably
successful. The smartest thinkers come to us to collaborate with each other. Designers, strategists, writers, makers, innovators, and dreamers—together we keep brands agile. We build some of the world’s most agile brands—brands that thrive on change.
</div>
</div>
</div>
<footer class="footer">
<div class="credit">
<span>
© 2017 Christian Meloni
</span>
</div>
<div class="follow">
<span>
<a class="facebook" href="https://www.facebook.com/christianmelonicom/">Facebook</a>
<a class="twitter" href="#">Twitter</a>
<a class="instagram" href="#">Instagram</a>
</span>
</div>
</footer>

How to float pictures with text side by side

I am trying to do two things:
1) Make the three pictures float side by side
2) Create a border filled with the text in the p element below each picture.
Here is an idea of what I am trying to achieve.
Here is what I've done so far...
<div class="fitness-section">
<h1>Get fit</h1>
<img src="images/EssentialWorkouts.png" alt="essentialworkouts" class="essential">
<h5>Essential Workouts</h5>
<p>Going to a gym is definitely the best way to transform and build your body.
However, It is common for many people especially new-gymmers to feel nervous,
intimidated and lost in the gym. There are many effective and essential
workouts that are bound to get you ripped and buff in no time!</p>
Find out more
</div>
<div class="fitness-section">
<img src="images/Motivation.png" alt="motivation" class="motivation">
<p>Have you ever felt unmotivated and lost your will to gym? Fret not, there are
many inspirational quotes and articles here that will help you generate and
maintain a flow of positive attitude to keep you motivated to achieve your
fitness and goals in life!</p>
Find out more
</div>
<div class="fitness-section">
<h1>Get fit</h1>
<img src="images/Shoe.png" alt="shoe" class="shoe">
<p>Working out in the gym with a proper attire is an absolute neccessity to achieve
the best workout possible. Wearing attire that is too tight or too loose will
definitely affect your workouts. Discover and find out what you should and
should not be wearing in the gym.</p>
Find out more
</div>
Here's some work to start you off.
html, body {
box-sizing: border-box;
}
h1 {
text-align: center;
}
.wrapper {
text-align: center;
}
p {
text-align: left;
margin-top: 20px;
border: 1px solid #000;
padding: 10px;
height: 150px;
}
.fitness-section {
display: inline-block;
vertical-align: top;
padding: 10px;
margin-right: -4px;
width: 300px;
}
https://codepen.io/anon/pen/MvyeEN
I can recommend you, to use diffrent classes for your boxes
<div class="fitness-section div1">
<h1>Get fit</h1>
<img src="images/EssentialWorkouts.png" alt="essentialworkouts" class="essential">
<h5>Essential Workouts</h5>
<p>Going to a gym is definitely the best way to transform and build your body.
However, It is common for many people especially new-gymmers to feel nervous,
intimidated and lost in the gym. There are many effective and essential
workouts that are bound to get you ripped and buff in no time!</p>
Find out more
</div>
<div class="fitness-section div2">
<img src="images/Motivation.png" alt="motivation" class="motivation">
<p>Have you ever felt unmotivated and lost your will to gym? Fret not, there are
many inspirational quotes and articles here that will help you generate and
maintain a flow of positive attitude to keep you motivated to achieve your
fitness and goals in life!</p>
Find out more
</div>
<div class="fitness-section div2">
<h1>Get fit</h1>
<img src="images/Shoe.png" alt="shoe" class="shoe">
<p>Working out in the gym with a proper attire is an absolute neccessity to achieve
the best workout possible. Wearing attire that is too tight or too loose will
definitely affect your workouts. Discover and find out what you should and
should not be wearing in the gym.</p>
Find out more
</div>
And for style use this:
.fitness-section {
width: 30%;
}
.div1 {
float: left;
background-color: red;
margin: 15px 15px;
}
.div2 {
float: left;
background-color: blue;
margin: 15px 15px;
}
div3 {
float: right;
background-color:yellow;
margin: 15px 15px;
}

Keep div height the same despite resizing a window

When I resize the window text from multiple divs overlaps onto another.
I believe it is maybe because my height values apply for percent of the screen, not percent of the div as I would like. What I would like for now (unless someone has a better idea) is instead of vertical div size decreasing have it stay fixed, therefore preventing the text from being pushed onto another div.
I've seen similar posts but none of them seemed to specifically address my issue.
Any help would be greatly appreciated!
EDIT: I want the div height to stay the same despite reducing window size.
FINAL EDIT: I will deal with this issue when I finish my computer-compatible site and then work on making it mobile-compatible.
JsFiddle:
http://jsfiddle.net/v5aobbp3/
<div id="moreinfo" class="wrapperdiv">
<div id="topquote">
<br> <br>
<p id="quote"> “ Musical activity involves nearly every region of the brain that we know about, and nearly every neural subsystem ” </p>
<p id="quote2"> — Daniel Levitin, <em> This is Your Brain on Music, </em> p.299 </p>
</div>
<div id="benefits-main">
<div id="top-row">
<div id="leftfact">
<p class="benefits-title"> express yourself</p> <br>
<p id="bodytext"> Music is the best way for you to express yourself, unleash your creativity, and get inspired. Immerse yourself or your children in the world of music through musical education to produce an enhanced appreciation and understanding of this art </p>
</div>
<div id="centrefact">
<p class="benefits-title"> improved cognitive abilities </p> <br>
<p id="bodytext"> The auditory precision required in music study results in dramatic improvements in language abilities. Musically trained children are able to distinguish subtleties of speech, resulting in increased verbal, comprehension, reading, and communication skills. Students of music have better information processing, stronger neural connections, improved memory, and bigger brains in general.
</div>
<div id="rightfact">
<p class="benefits-title"> increased focus and academics</p>
<p id="bodytext"> Music gives its learners an increased attention span and stronger focus as well as self-discpline. Children who learn music have higher IQs and better motor coordination. Studies have found that music students significantly outperform academically compared to other students and are more motivated.
</div>
</div>
<div id="bottom-row">
<div id="leftfact2">
<p class="benefits-title"> empathy and social awareness </p> <br>
<p id="bodytext"> Musical education increases empathy in children as well as improves their emotional intelligence and interpretation of nuances of speech. Music is emotional and through this art students learn to connect with others on an emotional level. While performing with other musicians students increase their cooperation skills. </p>
</div>
<div id="centrefact2">
<p class="benefits-title"> self-confidence </p>
<p id="bodytext"> Performing as well as self-discipline give students a high level of confidence </p>
</div>
<div id="rightfact2">
<div id="button2">
<p class="button2text"> Learn More </p>
</div>
</div>
</div>
</div>
<div id="bottomquote">
<br>
<p id="musicquote" class="Einstein"> "The theory of relativity occurred to me by intuition, and music is the driving force behind this intuition. My parents had me study the violin from the time I was six. My new discovery is the result of musical perception.” </p> <br>
<p id="quote2" class="Einstein"> — Albert Einstein </p>
</div>
</div>
And some of the pertinent css:
div #moreinfo {
background-color: #F1F1F1;
/* #d3dfed; original colour */
color: black;
height: 150%;
margin-top: 0%;
/* position: relative; */
}
#moreinfo #benefits-main {
background-color: #d3dfed;
height: 60%;
width: 100%;
}
#benefits-main #top-row { height: 50%; } #benefits-main #bottom-row { height: 50%; }
#benefits-main .benefits-title { margin-top: 2%;}
#benefits-main #leftfact { height: 100%; width: 33%; float: left; background- color: #b7cbe2; } #benefits-main #leftfact2 { height: 100%; width: 33%; float: left;
background-color: #c5d5e7; /*background-color: white;*/}
#benefits-main #centrefact { height: 100%; width: 33%; float: left; background-color: #c5d5e7; /* background-color: white;*/} #benefits-main #centrefact2 {height: 100%; width: 33%; float: left;
background-color: #b7cbe2;}
#benefits-main #rightfact { height: 100%; width: 33%; float: left; background-color: #b7cbe2; /* #e1e9f3; */} #benefits-main #rightfact2 {height: 100%; width: 33%; float: left;
background-color: #c5d5e7; /* background-color: white;*/ }
#button2 {
height: 20%;
width: 40%;
background-color: #4a79b1;
margin-top: 28%;
margin-right: auto;
margin-left: auto;
font-weight: 300;}
#button2 p {
font-family: Avenir Next, sans-serif !important;
color: #FFFFFF !important;
font-weight: 200 !important;
padding-top: 7%;
}
.button2text {
color: white;
}
a.rcmlink:link { color: #EEEEEE; } a.rcmlink:visited { color: #EEEEEE; } a.rcmlink:active {color: #EEEEEE;}
#benefits-main #bodytext {
font-family: Helvetica, Arial, sans-serif;
font-size: 16px;
}
#moreinfo p {
margin-left: 10%;
margin-right: 10%;
color: #22384f;
font-size: 25px;
font-family: Montserrat , sans-serif;
}
div #topquote {
background-color: #d3dfed; /* #9bb7d6; */
height: 20%;
}
#topquote #quote {
/* position: absolute; /* top: 5%; */
text-align: center;
}
#topquote #quote2 {
text-align: center;
font-size: 20px;
font-family: Roboto;
bottom: 2%;
}
/* #topquote2 { background-color: #d3dfed; height: 10%; } */
div #bottomquote {
text-align: center;
height: 20%;
}
#quote2 {
font-size: 15px;
font-family: Roboto !important;
}
div #musicquote {
/* position: absolute; bottom: 2.5%; */
}
Putting heights on divs forces the text to overflow once they are too small to contain the text. If you let the divs height stay auto and controlled spacing around them with padding top/bottom then they would automatically get longer to fit the text as you resize the window.
Not sure if this really answers your question but I'm not exactly sure what you are asking?
I've pulled out just that row into a stripped down example. The most important CSS is this:
.row {
display: table;
table-layout: fixed;
width: 100%;
}
.fact {
display: table-cell;
}
html {
color: #22384F;
font-size: 12px;
font-family: sans-serif;
}
.row {
display: table;
table-layout: fixed;
width: 100%;
}
.fact {
display: table-cell;
padding: 20px;
background-color: #B7CBE2;
}
.fact:nth-child(even) {
background-color: #C5D5E7;
}
.benefits-title {
font-size: 25px;
font-family: Montserrat , sans-serif;
margin: 0;
}
<div class="row">
<div class="fact">
<p class="benefits-title"> express yourself</p> <br>
<p> Music is the best way for you to express yourself, unleash your creativity, and get inspired. Immerse yourself or your children in the world of music through musical education to produce an enhanced appreciation and understanding of this art </p>
</div>
<div class="fact">
<p class="benefits-title"> improved cognitive abilities </p> <br>
<p> The auditory precision required in music study results in dramatic improvements in language abilities. Musically trained children are able to distinguish subtleties of speech, resulting in increased verbal, comprehension, reading, and communication skills. Students of music have better information processing, stronger neural connections, improved memory, and bigger brains in general.
</p></div>
<div class="fact">
<p class="benefits-title"> increased focus and academics</p>
<p> Music gives its learners an increased attention span and stronger focus as well as self-discpline. Children who learn music have higher IQs and better motor coordination. Studies have found that music students significantly outperform academically compared to other students and are more motivated.
</p></div>
</div>
Using display: table-cell means that each div in your row will always have the same height. You want to avoid assigning your HTML elements heights at all unless you really know what you're doing: things can get messy very quickly.
You'll notice I've also changed things up a bit, removing your IDs and replacing them with classes. There's good reason for that: it keeps the specificity of your selectors low, which will make things much easier to maintain in the long run. It also lets you re-use styles and avoid having to come up with unique IDs (such as #leftfact2) when they aren't required.
Having the same ID repeated multiple times is also wrong, and will cause headaches if you want the page to validate or - more importantly - start adding JavaScript. I would recommend avoiding the use of IDs for styling altogether (that's somewhat controversial, but smarter people than me say the same thing).

Why is my aside so low on the webpage?

I am struggling with CSS. In this example, could anyone help me understand why the "aside" is not floating to the right just below the picture emplacement? Why is it so low in the page?
Thanks for your advice.
HTML
<body>
<nav id="top-menu">
<ul>
<li> Home </li>
<li> Charting </li>
<li> Map </li>
<li> Financials </li>
<li> Forum </li>
<li> About </li>
</ul>
</nav>
<div id="maindiv">
<header>
<img class="img-right" src="images/Inkscape_stocktails_240_240.png"
alt="Stocktail" width="240" height="240" />
<hgroup>
<h1> Welcome to Stocktails </h1>
</hgroup>
<p> The perfect blend for your investment portfolio </p>
</header>
<article class="story">
<h1> Start investing today with Stocktails </h1>
<p>
Stocktails is a collection of tools and resources to facilitate the investing process, from data retrieval, stock analysis and valuation, up to the construction and monitoring of your portfolio.
</p>
</article>
<article class="story">
<h1> The renaissance of value investing </h1>
<p>
As the world economy slowly emerges and recovers from the Great Recession,
appetite for stocks is still on the wane. Stung by three successive market crashes in recent memory (1987, 2000, 2008),
retail investors turned their attention away from common shares and towards presumably safer assets, such as property.
In parallel, institutional investors, from insurance companies to endowments, have greatly diversified their holdings towards private equity, hedge funds and hard assets.
</p>
<p>
<em>Stocks are down, but not out</em>. It is our belief that they may even be on the verge of a renaissance. As most alternative asset classes,
notably sovereign bonds and property, exhibit signs of a bubble, the pendulum is may be about to swing in the reverse direction.
<strong>Now is the time for the savvy investor to put stocks back at the core of his portfolio</strong>.
</p>
<blockquote>"I will tell you how to become rich. Close the doors. Be fearful when others are greedy. Be greedy when others are fearful." (<cite>Warren Buffet</cite>)</blockquote>
<p>
In addition to a reduced appetite for stocks, modern portfolio theory - that notably relies on the efficient markets hypothesis - led many investors to give up on stock picking
and to invest into passive funds instead (cf. <cite>A random walk down Wall-Street</cite>, by B. Malkiel). As investors buy under-valued shares and spurn or short-sell the richly-valued, prices will tend to align with risk,
making it more difficult to find value in the market. Eventually, the average participant stops scouting for value and resigns himself to purchasing the index.
But not all companies are created equal and opportunities are bound to reappear. It is precisely when the market capitulates that the discerning investor should step back in to pick value stocks.
</p>
<p>
Value investing also suffered from the action of central banks. The unprecedented level of liquidity introduced by quantitative easing in the US, the UK, the EU and Japan was key to prevent an outright depression.
It has also been a boon for most investors. The resulting suppression of interest rates lifted all boats, with little regard for the quality of the asset.
As the tide reverses, the overall performance of the market is bound to disappoint. But we also expect a large variation of performance between strong and weak companies. The stars will then be aligned for the value investor to find gems among the wreck.
</p>
</article>
<article class="story">
<h1> Top 10 investing tips from <cite>Warren Buffet</cite>, the Oracle of Omaha </h1>
<ul>
<li>"It's far better to buy a wonderful company at a fair price than a fair company at a wonderful price."</li>
<li>"Rule No. 1: never lose money; rule No. 2: don't forget rule No. 1"</li>
<li>"Our approach is very much profiting from lack of change rather than from change. With Wrigley chewing gum, it's the lack of change that appeals to me. I don't think it is going to be hurt by the Internet. That's the kind of business I like."</li>
<li>"I try to buy stock in businesses that are so wonderful that an idiot can run them. Because sooner or later, one will."</li>
<li>"The stock market is a no-called-strike game. You don't have to swing at everything – you can wait for your pitch. The problem when you're a money manager is that your fans keep yelling, "Swing, you bum!""</li>
<li>"Price is what you pay; value is what you get. Whether we're talking about socks or stocks, I like buying quality merchandise when it is marked down."</li>
<li>"Never count on making a good sale. Have the purchase price be so attractive that even a mediocre sale gives good results."</li>
<li>"If you understood a business perfectly and the future of the business, you would need very little in the way of a margin of safety."</li>
<li>"We've long felt that the only value of stock forecasters isto make fortune tellers look good. Even now, Charlie [Munger] and I continue to believe that short-term market forecasts are poison and should be kept locked up in a safe place, away from children and also from grown-ups who behave in the market like children."</li>
<li>"We don't get paid for activity, just for being right. As to how long we'll wait, we'll wait indefinitely."</li>
</ul>
</article>
<aside class="about">
<header>
<h1> How to use Stocktails </h1>
<p> A collection of tools to cover the entire investment process </p>
</header>
<section>
<hgroup>
<h1> Stock quotes </h1>
<h2> Price, Volume, Ratios, etc. </h2>
</hgroup>
<p> Keep track of your stocks' movements </p>
</section>
<section>
<hgroup>
<h1> Fundamentals </h1>
<h2> Yearly and quarterly financials </h2>
</hgroup>
<p> Stock valuation and analysis </p>
</section>
<section>
<hgroup>
<h1> Portfolio building </h1>
<h2> Optimize the performance of your assets </h2>
</hgroup>
<p> Sophisticated tools to diversify risk and boost performance </p>
</section>
<section>
<hgroup>
<h1> Discussion </h1>
<h2> Forum </h2>
</hgroup>
<p> Share your investing ideas with other savvy investors </p>
</section>
</aside>
<div class="clear"></div>
</div>
<footer>
<p>
Copyright © 2014.
</p>
</footer>
</body>
CSS
body {
background-color: #fffbef;
}
.story p {
line-height: 1.2;
text-align: justify;
}
h1, h2, h3, h4, h5, h6 {
font-family: sans-serif;
color: #093844;
}
.clear {
margin: 0;
padding: 0;
clear: both;
}
img.img-right {
display: block;
float: right;
border: none;
padding: 2px;
margin: 3px 6pt 3px 6px;
}
/* navigation menu */
nav#top-menu {
width: 100%;
height: 50px;
//background-color: #fff2c1;
margin: 0;
padding: 0;
}
#top-menu ul {
display: block;
list-style-type: none;
width: 600px;
margin: 0 auto;
padding: 0;
}
#top-menu ul li {
margin: 0;
padding: 0;
}
#top-menu ul li a {
display: block;
float: left;
max-height: 25px;
width: 100px;
margin: 0;
padding: 5px 0;
font-family: sans-serif;
font-size: 20px;
text-align: center;
text-decoration: none;
color: #52736b;
border-bottom: #fffbef solid 2px;
}
#top-menu ul li a:hover { border-bottom: #52736b solid 2px; }
/* header */
header h1 { margin-top: 0; }
header p {
font-family: sans-serif;
font-weight: bold;
font-style: italic;
font-size: 85%;
margin: .25ex 12pt;
color: #093844;
}
/* maindiv */
#maindiv {
width: 1250px;
margin: 0 auto;
padding: 10px;
background-color: #eec;
}
/* article */
article {
width: 950px;
float: left;
}
article h1 {
font-size: 110%;
margin-top: 12pt;
padding-top: 3pt;
border-top: 4px solid #52736b;
}
/* aside */
aside.about {
float: right;
width: 238px;
background-color: #b7c4b1;
margin: 3pt 6pt 3pt 6pt;
}
aside h1 { font-size: 110%; }
aside h2 { font-size: 90%; }
aside p {
margin: 0 12pt;
font-family: sans-serif;
font-style: italic;
font-size: 80%;
}
aside section h1 {
padding-top: 3pt;
border-top: 4px solid #4f5856;
}
aside header p {
font-size: 85%;
}
aside section {
padding: 5px 0 5px 0;
}
/* footer */
footer {
background: #4f5856;
clear: all;
}
footer p {
color: #8c8e7e;
font-size: 70%;
font-family: sans-serif;
text-align: center;
margin: 0;
padding: 10px 0;
}
LC
Because your articles are floated left and the position of your aside is low in the document, the rules of floats say that
The outer top of a floating box may not be higher than the outer top
of any block or floated box generated by an element earlier in the
source document.
The way around that is to move your aside element up higher in the document:
jsFiddle example
<article class="story"></article>
<article class="story"></article>
<aside class="about"></aside>
<article class="story"></article>
just add clear: both; and modify your html like in the demo
aside.about {
float: right;
width: 238px;
background-color: #b7c4b1;
margin: 3pt 6pt 3pt 6pt;
clear: both;
}
Html
<header></header>
<aside class="about"></aside><!-- moved -->
<article class="story"></article>
Demo