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.
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.
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>
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).
I have a webpage that uses bootstrap accordion.
There is a line that divides sections. I have included a screenshot.
When the user clicks the 'Read More' the accordion opens.
The problem is that there are lines on the side for each section. When a section opens, the line follows the section, as it should. However, the thickness of the lines looks off. I can't figure out how to make this work so it looks the same opened or closed.
Code Shared on jsfiddle.net here
jQuery(".readmore").click(function () {
var thisid = jQuery(this).attr('id');
var id = thisid.split("-");
jQuery(".read-" + id[1] + "-text").slideDown();
jQuery(this).css("display", "none");
});
jQuery(".readclose").click(function () {
var thisid = jQuery(this).attr('id');
var id = thisid.split("-");
jQuery(".read-" + id[1] + "-text").slideUp();
jQuery("#read-" + id[1]).css("display", "block");
});
<div class="second-section">
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<div class="expect-head little-time">Big changes in little time</div>
<div class="expect-body hasborder-right">TeamUp was developed from over 30 years of coaching the world's top executives. We truly understand what it takes to achieve deep, meaningful life changes, even on a busy schedule.
<h3 class="readmore" id="read-1">> Read More</h3>
<div class="read-1-text" style="display:none;">Whether you choose to create a healthier lifestyle, deeper relationships, or seek more fulfillment in your career, TeamUp will take you there. You’ll discover your patterns of behavior and consciously choose which ones to keep and which ones to change. You'll experience your life from a new and refreshing perspective.
<h3 class="readclose" id="close-1">> Close</h3>
</div>
</div>
</div>
<div class="col-md-6">
<div class="expect-head results">Results that last a lifetime</div>
<div class="expect-body hasborder-left">This course is a all about taking action. The specific action to take is determined by you. There are no formulas or a one-size-fits-all. You define your own actions based upon what you want to do differently in your life.
<h3 class="readmore" id="read-2">> Read More</h3>
<div class="read-2-text" style="display:none;">You are creative and insightful. You probably already know what you want to change. Through your weekly interactions with your teammates, and the course material, you will turn your insights into action to achieve your personal growth goals.
<h3 class="readclose" id="close-2">> Close</h3>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="expect-head getsupport">Get Support from your team</div>
<div class="expect-body hasborder-right">Each week you'll have a 90-minute online conversation with your team members. They will listen, challenge and motivate you. You'll find the strength and courage to overcome any obstacles along the way.
<h3 class="readmore" id="read-3">> Read More</h3>
<div class="read-3-text" style="display:none;">You will also inspire change in the members of your team. You'll experience first hand how fulfilling it is contributing to others insights and personal growth. Working together is not only more effective...it's more fun.
<h3 class="readclose" id="close-3">> Close</h3>
</div>
</div>
</div>
<div class="col-md-6">
<div class="expect-head ontrack">We'll keep you on track</div>
<div class="expect-body hasborder-left">A dedicated coach facilitator will guide you, and your team throughout the course. All TeamUp facilitators have been throughly trained and mentored, maintaining the highest standards of confidentiality and integrity.
<h3 class="readmore" id="read-4">> Read More</h3>
<div class="read-4-text" style="display:none;">Our facilitators know what it takes to make long-lasting change, and will create a safe, inspirational learning environment where you can achieve profound personal growth.
<h3 class="readclose" id="close-4">> Close</h3>
</div>
</div>
</div>
</div>
</div>
</div>
.second-section {
border-bottom: 1px solid #666666;
}
.second-section h2 {
font-size: 56px;
text-align: center;
}
.second-section .container-fluid {
padding: 0;
}
.second-section .col-md-6 {
padding: 0;
width: 50%;
float:left;
}
.expect-head {
color: #000;
padding: 35px 50px;
text-align: left;
}
.expect-head h3 {
line-height: inherit;
}
.expect-body {
padding: 20px 50px;
min-height: 210px;
}
.expect-body b {
font-weight: 600;
}
.readmore, .readclose {
color: #FF7C00;
cursor: pointer;
display: block;
font-size: 18px;
font-weight: normal;
line-height: inherit;
margin-top: 30px;
}
.read-1-text, .read-2-text, .read-3-text, .read-4-text {
margin: 40px 0 0;
}
.hasborder-left {
border-left: 1px solid #666666;
}
.hasborder-right {
border-right: 1px solid #666666;
}
Any help appreciated.
It isn't that weird that this is happening, because you are putting two borders on the same place.
You say to your left div to output a border on the right and to output a border on the left of the most right div. This gives you two borders...
Therefore, you should remove one of them to get a singular border. If you want to have a thicker border, just change the pixel of the border you want to have.
See this for a demo: http://jsfiddle.net/8hp2X/2/
.hasborder-right {
border-right: 2px solid #666666;
}
As you can see, I have removed one of the borders, which results in a nice looking page.