I am working on a flexbox layout with 3 flexbox containers and where one of them has a nested flexbox layout inside of it. The one with the nested flexboxes seems to wrap/break too early, eventhou there is available for space for it to take up. I have tried so many different combinations of flex-grow and flex-shrink on the parent elements that I feel like I'm losing my mind, still I can't shake the feeling that there is a simple solution to this.
It works exactly as I want it when the size of the browser is ~ 1600px but as soon as it resizes to smaller it seems breaks the layout and wraps, even thou there is available space for it to continue maintain it's layout.
I can achieve what I want if I change the flex-grow setting on the parent but then the flexboxes doesn't align anymore, which I want. How do I keep both the alignment and the flexbox-growing?
Correct layout but breaking too early example https://jsfiddle.net/9g5dam6f/
Growing properly but not aligning correctly example https://jsfiddle.net/bctgv7ah/
Here is the code as well for the one that breaks too early, but is correctly aligned:
.content {
width: 100%;
overflow: hidden;
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
}
.col-info {
margin: 0 0px 20px;
box-sizing: border-box;
}
.columns {
display: flex;
padding: 1.2em;
flex-wrap: wrap;
box-sizing: border-box;
}
.col-45-info {
width: 40%;
background-color: hotpink;
}
.col-26-info {
width: 26.65%;
justify-content: end;
display: flex;
flex-grow: 0;
flex-shrink: 1;
flex-wrap: wrap;
background-color: purple;
}
.col-33-info {
width: 33.33%;
background-color: pink;
}
.col-50-info {
width: 51%;
display: flex;
flex-wrap: wrap;
gap: 2em;
background-color: grey;
opacity: 50%;
}
h1 {
font-family: Helvetica, sans-serif;
font-size: 21px;
text-align: left;
}
.columns h1 {
margin-bottom: 1rem;
}
.columns p {
font-size: 16px;
font-family: Helvetica, sans-serif;
line-height: 1.3;
}
li {
text-align: left;
font-size: 16px;
font-family: Helvetica, sans-serif;
list-style-type: none;
line-height: 1.17;
}
.columns a {
text-decoration: underline;
font-family: Helvetica, sans-serif;
color: black;
font-size: 16px;
width: 100%;
}
<div class="content">
<div class="columns">
<div class="col-info col-33-info">
<h1> TRAILBLAZER </h1>
<li>Art Direction </li>
<li>Creative Concept</li>
<li> Graphic Design </li>
<li> Web Design </li>
<li> Web Development </li>
<li> Visual Effects </li>
</div>
<div class="col-info col-45-info">
<p> Art direction and campaign for design collaboration between international brands Marimekko, Matty Bovan, Nomen Nescio, palmer//harding, Per Götesson, Zandra Rhodes, final-year fashion students at Beckmans College of Design and Stockholm Fashion
Week. <br> <br> The story of the Trailblazer is the story of the innovator. Inspired by the strong artistic approach of all brand and designers, we created a creative concept inspired by 90’s anime and manga that could fit each collections individuality,
and where each collection could be the hero in their own world, where they blaze a trail for others to walk on. <br> <br> The final develiberables included: A concept film, campaign photos, lookbook photos, website design and development, digital
and some material.
</p>
</div>
<div class="col-info col-26-info">
<div class="col col-50-info">
<li> <a target="_blank" href="https://trailblazer.beckmans.college/"> Visit the web </a> <br>
<a target="_blank" href="https://vimeo.com/510337626"> Watch the film </a> <br>
<a target="_blank" href="https://trailblazer.beckmans.college/"> ELLE Magazine </a> <br>
<a target="_blank" href="https://trailblazer.beckmans.college/"> ArtsThread </a>
</li>
</div>
<div class="col-50-info">
<li class="col" style="margin:0;">
Date
<br> Team </li>
<li class="col"> 2020 <br> Almir Jasarevic <br> Astrid Askert <br> Elisabet Lindén <br> Saba Mehrabanfar <br> Sofia Hjortberg
</li>
</div>
</div>
</div>
</div>
I got it working by using justify: space-between; and setting a fixed width for the sibling elements.
You can see the working example here: https://jsfiddle.net/yrwh062z/2/
Related
I have attached my HTML and CSS below, along with a screenshot of the webpage. The bulleted list is not formatting correctly. I want them to form a straight line in the middle with the bullets right beside the words and evenly lined up in the center. Also, my header and footer, both red, look so much wider than the rest of the webpage; how would I fix this?
/*
Landon Byrd
Fall 2021
Plain Red #f60d41
Rich Red #f6130d
Orioles Orange #f64d0d
Sunset Orange #f6870d
Golden Yellow #f6c10d
*/
/* Global settings */
h1 {
text-align: center;
font-family: Papyrus
}
h2 {
text-align: center;
color: #f6130d;
text-decoration: underline
}
.wrapper {
width: 85%;
margin: 0 auto;
max-width: 960px;
}
/* Nav Section */
.nav {
width: 85%;
margin: 0 auto;
background-color: #f6130d;
text-align: center;
}
.menu {
float: left;
width: 25%
}
/* Main section */
.banner {
justify-content: center;
background-color: #f6c10d;
text-align: center;
}
.bulletPoints {
text-align: center;
}
section {
background-color: #f6870d;
color: #f60d41;
font-style: italic;
margin: 25px 50px 75px;
}
body {
background-image: url("images/background.jpeg");
}
.image1 {
display: block;
margin-left: auto;
margin-right: auto;
}
figcaption {
text-align: center;
}
.row {
display: flex;
}
.column {
flex: 33.33%;
padding: 5px;
}
/* Footer section */
* {
box-sizing: border-box;
}
.footer {
text-align: center;
background-color: #f6130d;
color: #f6c10d;
}
.box {
float: left;
width: 33.33%
}
.footer::after {
content: "";
clear: both;
}
/* Copyright section */
.copyright {
text-align: center;
background-color: #f6130d;
color: #f6c10d;
}
<nav class="nav">
<div class="menu">
<p>Home</p>
</div>
<div class="menu">
<p>Shop</p>
</div>
<div class="menu">
<p>Events</p>
</div>
<div class="menu">
<p>Contact Us</p>
</div>
<br/>
<br/>
</nav>
<main class="wrapper">
<div class="banner">
<h1><span class="name">Augie's Custom T-shirts</span></h1>
<h2>Custom T-shirts for you or your party.</h2>
<div class="bulletPoints">
<ul>
<li>Birthday parties</li>
<li>Vacation groups</li>
<li>Bachelorette Parties</li>
<li>Family reunions</li>
<li>Work team rewards</li>
<li>Business promotions</li>
</ul>
</div>
<br/>
</div>
<p id="Catch">
Do you have an event coming up, and want everyone to get in the spirit? T-shirts can bring a group together, make everyone feel connected, and let everyone know what you're celebrating.
</p>
<p>T-shirts can also be a great gift to someone that acknowledges their special interest or hobby.</p>
<p>Choose from one of our unique designs, or let us put your own design on a shirt for you.</p>
<div class="row">
<div class="column">
<img src="images/gorilla.jpg" alt="Gorilla" style="width:100%">
</div>
<div class="column">
<img src="images/pink.jpg" alt="Pink" style="width:100%">
</div>
<div class="column">
<img src="images/skull.jpg" alt="Skull" style="width:100%">
</div>
</div>
<p><strong>How it works:</strong></p>
<p>Browse our selection of unique designs, select the size and colors of the shirts you would like, and place your order. We will ship your shirts within three business days for in-stock shirts, or five days for custom size and colors.</p>
<figure>
<img src="images/t-shirt-colors.jpeg" alt="T-shirt colors" class="image1">
<figcaption>Choose from are variety of t-shirt colors!</figcaption>
</figure>
<p>Have a design of your own? Can't find the right sentiment? Call or email us to discuss the possibilities or get some ideas for your event.</p>
<p>Please note there will be a one time $15 charge for any custom graphics design.</p>
<h2><em>Contact us today!</em></h2>
</main>
<footer class="footer">
<div class="box">
<p>Augie's Custom T-shirts</p>
<p>(478) 555-1212</p>
<p>augieB#augiesTees.com</p>
<br/>
</div>
<div class="box">
<p>Check out are Social Media for updates!</p>
<p>Facebook:</p>
<p>Instagram:</p>
<p>Twitter:</p>
</div>
<div class="box">
<p>Locations:</p>
<br/>
<p>100 Tanger Dr, Locust Grove, GA</p>
<p>2954 Watson Blvd Suite 100, Warner Robins, GA</p>
</div>
</footer>
<div class="copyright">
<h3> #copyright: Landon Byrd</h3>
<p>Fall 2021, All Rights Reserved</p>
</div>
<p>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" />
</a>
</p>
Just add:
.bulletPoints ul {
display:inline-block;
text-align:left;
}
This way the list width would same as the longest line, and it will be aligned to the center as you already gave the property to the container. Just need to align the list to the left (as to overwrite the center alignment inherited from parent.)
/*
Landon Byrd
Fall 2021
Plain Red #f60d41
Rich Red #f6130d
Orioles Orange #f64d0d
Sunset Orange #f6870d
Golden Yellow #f6c10d
*/
/* Global settings */
h1 {
text-align: center;
font-family: Papyrus
}
h2 {
text-align: center;
color: #f6130d;
text-decoration: underline
}
.wrapper {
width: 85%;
margin: 0 auto;
max-width: 960px;
}
/* Nav Section */
.nav {
width: 85%;
margin: 0 auto;
background-color: #f6130d;
text-align: center;
}
.menu {
float: left;
width: 25%
}
/* Main section */
.banner {
justify-content: center;
background-color: #f6c10d;
text-align: center;
}
.bulletPoints {
text-align: center;
}
section {
background-color: #f6870d;
color: #f60d41;
font-style: italic;
margin: 25px 50px 75px;
}
body {
background-image: url("images/background.jpeg");
}
.image1 {
display: block;
margin-left: auto;
margin-right: auto;
}
figcaption {
text-align: center;
}
.row {
display: flex;
}
.column {
flex: 33.33%;
padding: 5px;
}
/* Footer section */
* {
box-sizing: border-box;
}
.footer {
text-align: center;
background-color: #f6130d;
color: #f6c10d;
}
.box {
float: left;
width: 33.33%
}
.footer::after {
content: "";
clear: both;
}
/* Copyright section */
.copyright {
text-align: center;
background-color: #f6130d;
color: #f6c10d;
}
.bulletPoints ul {
display:inline-block;
text-align:left;
}
<nav class="nav">
<div class="menu">
<p>Home</p>
</div>
<div class="menu">
<p>Shop</p>
</div>
<div class="menu">
<p>Events</p>
</div>
<div class="menu">
<p>Contact Us</p>
</div>
<br/>
<br/>
</nav>
<main class="wrapper">
<div class="banner">
<h1><span class="name">Augie's Custom T-shirts</span></h1>
<h2>Custom T-shirts for you or your party.</h2>
<div class="bulletPoints">
<ul>
<li>Birthday parties</li>
<li>Vacation groups</li>
<li>Bachelorette Parties</li>
<li>Family reunions</li>
<li>Work team rewards</li>
<li>Business promotions</li>
</ul>
</div>
<br/>
</div>
<p id="Catch">
Do you have an event coming up, and want everyone to get in the spirit? T-shirts can bring a group together, make everyone feel connected, and let everyone know what you're celebrating.
</p>
<p>T-shirts can also be a great gift to someone that acknowledges their special interest or hobby.</p>
<p>Choose from one of our unique designs, or let us put your own design on a shirt for you.</p>
<div class="row">
<div class="column">
<img src="images/gorilla.jpg" alt="Gorilla" style="width:100%">
</div>
<div class="column">
<img src="images/pink.jpg" alt="Pink" style="width:100%">
</div>
<div class="column">
<img src="images/skull.jpg" alt="Skull" style="width:100%">
</div>
</div>
<p><strong>How it works:</strong></p>
<p>Browse our selection of unique designs, select the size and colors of the shirts you would like, and place your order. We will ship your shirts within three business days for in-stock shirts, or five days for custom size and colors.</p>
<figure>
<img src="images/t-shirt-colors.jpeg" alt="T-shirt colors" class="image1">
<figcaption>Choose from are variety of t-shirt colors!</figcaption>
</figure>
<p>Have a design of your own? Can't find the right sentiment? Call or email us to discuss the possibilities or get some ideas for your event.</p>
<p>Please note there will be a one time $15 charge for any custom graphics design.</p>
<h2><em>Contact us today!</em></h2>
</main>
<footer class="footer">
<div class="box">
<p>Augie's Custom T-shirts</p>
<p>(478) 555-1212</p>
<p>augieB#augiesTees.com</p>
<br/>
</div>
<div class="box">
<p>Check out are Social Media for updates!</p>
<p>Facebook:</p>
<p>Instagram:</p>
<p>Twitter:</p>
</div>
<div class="box">
<p>Locations:</p>
<br/>
<p>100 Tanger Dr, Locust Grove, GA</p>
<p>2954 Watson Blvd Suite 100, Warner Robins, GA</p>
</div>
</footer>
<div class="copyright">
<h3> #copyright: Landon Byrd</h3>
<p>Fall 2021, All Rights Reserved</p>
</div>
<p>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" />
</a>
</p>
That's how lists work in a centered element, I'm afraid. However, there is a solution!
The problem is that you have a div that spans the whole width of the page, within which you've asked for the text to be centered. And your browser has done exactly what you asked for. However, the rule for where the bullets are positioned is that they go to the left of the entire text line. So, when the line is centered, they are off to the left, as you see. (Basically, the text-align applies to the text but not to the bullets, which are technically outside the text itself.)
The solution is to remove the text-align: center and instead to position your bulletPoints div so that this container is centered while the list inside remains left-aligned. You could, for example, do something like this, although you'll need to fiddle with the width to make it suit the layout you want:
.bulletPoints {
width: 50%;
margin: 0 auto;
}
The result will be a list that has the text and bullets properly aligned, but that is centered in the view. This is achieved by the margin property: by setting the left and right margins to auto, you are telling the browser so make them the same, and the only way to do this on an element that's narrower than the available space is to center it.
However, this way of doing things does mean you need to be careful about the responsiveness of your design, and ensure that things display properly on very wide and very narrow windows. For example, on a phone, you won't want to set the width to 50%. So media-query will be your friend!
(Your problem with the red blocks is that you've written the code in a way that produces a result you don't like. To solve it, we need a clearer idea of what you actually want - probably best in a separate question because it's a completely different thing to the list. In general, though, you could wrap the page in a container div that you can set to a max width, which will stop these becoming very wide (or just wrap the content of the header and footer in a container, so the red is full width but the text is constrained). But we'll need a clearer idea of what you want to give a better solution, as I say!)
I can't get my twittercontainer to sit on the right of srun and mentor and I cant seem to change the height of twittercontainer please help. I just need to understand how to get this simply layout of essentially two divs in a column with another div to the right.
I have tried just about every which way I can think of.
<div class="newsbox">
<div class="newboxcontent">
<div class="srun">
<img src="resources/sponsoredrun.jpg" align="left">
<h1>Sponsored Run</h1>
<h2>Six of our supporters ran 10k in Richmond on March 24th 2012
in order to raise money to help us continue our work. They
had
a great deal of fun and raised £1400! </h2>
</div>
<div class="mentor">
<img src="resources/volunteermentors.jpg" align="left">
<h1>Sponsored Run 2</h1>
<h2>We are now accepting applications from those who would like
to take part in our next training course for volunteer
mentors which will take place in June 2012. Topics covered
will include: promoting choice and self awareness in young
people, reflective practice, confidentiality, anger and
aggression, substance misuse, the youth justice system,
</div>
<div class="twittercontainer">
<a class="twitter-timeline" href="https://twitter.com/BelongLondon?ref_src=twsrc%5Etfw">Tweets by BelongLondon</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
</div>
.newsbox {
display: flex;
flex-flow: column;
flex-grow: 1;
flex-wrap: wrap;
}
.newboxcontent {
flex-flow: column;
display: flex;
}
.srun {
padding right: 50px;
padding bottom: 50px;
}
.srun h2 {
font-size: 15px;
}
.srun img {
padding: 20px;
}
.mentor h2 {
font-size: 15px;
}
.mentor img {
padding: 20px;
}
.mentor {
padding-right: 50px;
padding top: 100px;
}
.twittercontainer{
width: 200px;
height: 100px;
}
I just want the <twittercontainer> (twitter feed) to sit on the
right of the two other divs and stretch to the same height.
Remove flex direction column from the outer most div .newsbox, you also dont want that wrapper to allow its children to wrap. As mentioned in some of the comments you were missing a few HTML closing tabs which usually introduces some unexpected result.
.newsbox {
display: flex;
}
.newboxcontent {
flex-flow: column;
display: flex;
}
.srun {
padding right: 50px;
padding bottom: 50px;
}
.srun h2 {
font-size: 15px;
}
.srun img {
padding: 20px;
}
.mentor h2 {
font-size: 15px;
}
.mentor img {
padding: 20px;
}
.mentor {
padding-right: 50px;
padding top: 100px;
}
.twittercontainer{
width: 200px;
height: 100px;
}
<div class="newsbox">
<div class="newboxcontent">
<div class="srun">
<img src="resources/sponsoredrun.jpg" align="left">
<h1>Sponsored Run</h1>
<h2>Six of our supporters ran 10k in Richmond on March 24th 2012 in order to raise money to help us continue our work. They had a great deal of fun and raised £1400!</h2>
</div>
<div class="mentor">
<img src="resources/volunteermentors.jpg" align="left">
<h1>Sponsored Run 2</h1>
<h2>We are now accepting applications from those who would like to take part in our next training course for volunteer mentors which will take place in June 2012. Topics covered will include: promoting choice and self awareness in young people, reflective practice, confidentiality, anger and aggression, substance misuse, the youth justice system</h2>
</div>
</div>
<div class="twittercontainer">
<a class="twitter-timeline" href="https://twitter.com/BelongLondon?ref_src=twsrc%5Etfw">Tweets by BelongLondon</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
</div>
I am trying to create a 3 column layout for a website design that contains an image at the top of each column followed by a h3 then some text. I have done this in the html but when I get to the CSS there are padding/margin coming from somewhere even when I set them both to 0.
Also for some reason the columns aren't aligned vertically correctly?
HTML:
<h3>Why You Should Choose Us For Financing Options.</h3>
<div class="card">
<img src="Heart.png" alt="Heart">
<h5>Lowest Industry Rates</h5>
<p>We take pride in our rates being the lowest in the industry!</p>
</div>
<div class="card">
<img src="Coin.png" alt="Coin">
<h5>Our Funding Is Fast</h5>
<p>After completing our form, you can expect to receive your funding within 48 hours!</p>
</div>
<div class="card">
<img src="File.png" alt="File">
<h5>We're Quick And Easy</h5>
<p>The form is easy to understand and can be completed in minutes!</p>
</div>
CSS:
header h3 {
font-family: 'Montserrat Light', sans-serif;
font-size: 25px;
color: #FFF;
margin-top: 60px;
}
.card {
display: inline-block;
width: 260px;
margin: 0;
padding: 0;
vertical-align: middle;
margin-top: 60px;
}
Image of desired outcome: https://i.gyazo.com/f4a2ef3a9680a1ee79eaafd889d368b7.png
Current outcome:
https://i.gyazo.com/fd2eafc6a980527a07811e409a9262bd.png
How about try this:
HTML:
<h3>Why You Should Choose Us For Financing Options.</h3>
<div id="fc">
<div class="card">
<img src="Heart.png" alt="Heart">
<h5>Lowest Industry Rates</h5>
<p>We take pride in our rates being the lowest in the industry!</p>
</div>
<div class="card">
<img src="Coin.png" alt="Coin">
<h5>Our Funding Is Fast</h5>
<p>After completing our form, you can expect to receive your funding within 48 hours!</p>
</div>
<div class="card">
<img src="File.png" alt="File">
<h5>We're Quick And Easy</h5>
<p>The form is easy to understand and can be completed in minutes!</p>
</div>
</div>
CSS:
header h3 {
font-family: 'Montserrat Light', sans-serif;
font-size: 25px;
color: #FFF;
margin-top: 60px;
}
#fc {
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
}
.card {
display: inline-block;
min-width: 260px;
margin: 0;
padding: 0;
vertical-align: middle;
margin-top: 60px;
}
Please help me. I need 3 li element like in image those I downloaded (icon+text), but they have wrong behavior.
I need like this
.icon-equipment {
background-image: url('http://infocem.info/wp-content/uploads/2017/05/1.png');
background-position: left center;
background-repeat: no-repeat;
padding-left: 20px; /* Adjust according to image size to push text across. */
}
ul {
list-style: none;
}
.advantages {
display: flex;
flex-flow: row wrap;
border: 1px solid purple;
height: 123px;
margin: 0;
padding: 0;
}
.advantages > * {
margin-left: 92px;
}
<ul class="advantages">
<li class="icon-equipment">Поставка оборудования<br> и запчастей<br><span>От 11 ведущих производителей</span><li>
<li class="icon-payment">Рассрочка платежа<br><span>До 45 дней с оформления заказа</span></li>
<li class="icon-delivery">Доставка товаров<br><span>Международная и междугородняя<br>в срок до 10 дней</span></li>
</ul>
The main thing to understand here is how to set-up a good hierarchy, so that you may have control over it. What I mean is, you have to separate your item into sections, which can be arranged easily using your model of choice (flexbox in this case).
Just take a look at the html that I have provided, see how it is structured. You have a container, within that container you have two elements, a left-side element (icon) and a right-side element (texts).
Styles are also a thing to notice, you will need some prefixing as well.
Since this is your first time on stackoverflow, I will give you this code ready for use. Usually you have to provide some code that you have been working on, and then seek assisstance for it. Whatever you do, please DO NOT expect this for future problems that you post here on Stack. Read the rules, follow the rules.
html {
font-family: 'Helvetica Neue', Arial, sans-serif;
}
.icon-equipment {
background-image: url('http://infocem.info/wp-content/uploads/2017/05/1.png');
background-position: left center;
background-repeat: no-repeat;
/* Adjust according to image size to push text across. */
}
ul {
list-style: none;
}
.advantages {
display: flex;
flex-flow: row wrap;
margin: 0;
padding: 0;
}
.advantages .advantages-item {
display: flex;
align-items: flex-start;
background: #000;
color: #fff;
padding: 1rem;
max-width: 300px;
margin-right: 1rem;
margin-bottom: 1rem;
}
.advantages .advantages-item:last-of-type {
margin-right: 0;
}
.advantages .advantages-item .item-right {
display: flex;
flex-direction: column;
padding-left: 1rem;
}
.advantages .advantages-item .item-right .right-text {
font-weight: bold;
text-transform: uppercase;
margin: 0;
margin-bottom: 1rem;
}
<ul class="advantages">
<li class="advantages-item">
<div class="item-left">
<div class="top-icon">
<img src="http://infocem.info/wp-content/uploads/2017/05/1.png" alt="" class="icon">
</div>
</div>
<div class="item-right">
<p class="right-text">Поставка оборудования и запчастей</p>
<span>От 11 ведущих производителей</span>
</div>
<li>
<li class="advantages-item">
<div class="item-left">
<div class="top-icon">
<img src="http://infocem.info/wp-content/uploads/2017/05/1.png" alt="" class="icon">
</div>
</div>
<div class="item-right">
<p class="right-text">Поставка оборудования и запчастей</p>
<span>От 11 ведущих производителей</span>
</div>
<li>
<li class="advantages-item">
<div class="item-left">
<div class="top-icon">
<img src="http://infocem.info/wp-content/uploads/2017/05/1.png" alt="" class="icon">
</div>
</div>
<div class="item-right">
<p class="right-text">Поставка оборудования и запчастей</p>
<span>От 11 ведущих производителей</span>
</div>
<li>
</ul>
A few tiny problems have been torturing me for weeks. After many researches and many trials I still can't figure out what to do.
On my online resume, the desktop display if perfect. On mobile though, there are many inconsistencies with font and images sizes.
Link of the page: t.btmx.fr
Problems
If you have an idea what's wrong or if there's something I should learn that would be very helpful :)!
Thank you very much!
Below is the code as asked by Paulie_D. I'm sorry if it's so long I don't know what to remove :(. First you'll find the CSS for small screens using media queries, then the "normal" CSS and then the HTML.
#
media screen and(max - width: 1000px) {
header {
font - size: 1em;
}
p {
font - size: 0.8em;
}
#
contact_button {
font - size: 1em;
}
#
personal - info - and - topskills {
display: flex;
flex - direction: column;
}
#
containermain {
display: flex;
flex - direction: column;
}
.topitem: nth - child(2) {
max - width: 100 % ;
}
.subelementspecial /* floating logo | title */ {
display: flex;
flex - direction: column;
}
}
header {
border-radius: 0.5em;
background-color: #AFC600;
opacity: 0.7;
margin: auto;
margin-bottom: 4em;
padding-bottom: 0.1em;
padding-top: 0.1em;
font-size: 0.8em;
text-align: center;
max-width: 1920px;
}
.bg1 {
background: url("medias/background.jpg") no-repeat top center;
}
.bg2 {
background: #232A2A;
}
#main-wrapper {
width: 100%;
background-attachment: scroll;
background-size: contain;
font-family: "texgyrescholaregular", Verdana, Georgia, serif;
}
#personal-info-and-topskills {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-content: space-around;
padding: 2em;
}
.topitem {
border-radius: 0.5em;
padding: 0 1.3em 0.6em 1.3em;
margin: 1em;
}
.topitem h2 {
margin-bottom: 1.5em;
}
.topitem:nth-child(2) {
opacity: 0.9;
min-width: 300px;
background-color: #3D3D39;
border-radius: 0.5em;
/* padding : top right bottom left */
flex-grow: 1;
flex-shrink: 0;
flex-basis: 200px;
max-width: 40em;
}
.topitem:nth-child(2) p {
color: white;
line-height: 2em;
}
.topitem:nth-child(2) strong {
color: #d8616f;
}
#contact_button {
background: #D3D699;
text-align: center;
color: black;
border-radius: 1em;
width: 40%;
margin: auto;
margin-bottom: 1em;
margin-top: 1em;
}
.topitem:nth-child(3) {
background: #C4D9D0;
flex-grow: 0;
flex-shrink: 0;
flex-basis: 400px;
}
.topitem:nth-child(3) h2 {
color: black
}
#languages {
width: 100%;
}
.topitem:nth-child(4) {
background: #e0cece;
flex-grow: 0;
flex-shrink: 0;
flex-basis: 350px;
}
.topitem:nth-child(4) h2 {
color: #b25960;
}
#containermain
/* contains experience, skills and education */
{
display: flex;
flex-wrap: wrap;
justify-content: center;
align-content: space-between;
align-items: flex-start;
padding: 2em;
}
.cmain-element {
background-color: #FCF8F5;
border-radius: 1em;
padding: 0 1.3em 0.6em 1.3em;
margin: 1em;
max-width: 1500px;
/*properties for all the childs*/
}
.cmain-element:nth-child(1) {
flex: 1;
}
.cmain-element:nth-child(2) {
flex: 1;
}
.float-logo-title {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
}
.work-place-time h3 {
margin-top: 0.1em;
}
.logo {
margin-right: 30px;
}
#hobbies-passions {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-content: space-around;
align-items: flex-start;
background-color: #FCF8F5;
border-radius: 5px;
width: 40em;
margin: auto;
margin-bottom: 3em;
}
#hobbies-img {
text-align: center;
}
footer {
display: flex;
height: 60px;
border-radius: 5px;
background-color: #546363;
opacity: 0.8;
margin: auto;
max-width: 1920px;
}
#footerbox {
width: 40%;
display: flex;
margin: auto;
justify-content: space-around;
}
#font-face {
font-family: 'texgyrescholaregular';
src: url('font/texgyreschola-regular-webfont.eot');
src: url('font/texgyreschola-regular-webfont.eot?#iefix') format('embedded-opentype'), url('font/texgyreschola-regular-webfont.woff') format('woff'), url('font/texgyreschola-regular-webfont.ttf') format('truetype'), url('font/texgyreschola-regular-webfont.svg#texgyrescholaregular') format('svg');
font-weight: normal;
font-style: normal;
}
h2 {
color: #DE7F89;
font-size: 1.5em;
line-height: 1.5em;
}
h3 {
font-size: 1.3em;
line-height: 1.5em;
}
h4 {
font-size: 1em;
line-height: 1.5em;
}
p {
font-size: 0.9em;
line-height: 1.5em;
}
ol,
ul {
font-size: 0.9em;
line-height: 1.5em;
/* for changing indent
padding-left: 30px;
*/
}
/*strong=default*/
a {
color: green;
text-decoration: none;
font-style: italic;
}
a:hover {
color: green;
}
a:active {
color: red;
}
a:visited {
color: purple;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="smallscreen.css" />
<meta charset="utf-8">
<title>Resume - Thibault Bétrémieux</title>
<link rel="icon" href="http://t.btmx.fr/wp-content/uploads/2016/07/favicon.png">
</head>
<div class="bg2">
<body>
<div class="bg1">
<div id="main-wrapper">
<header>
<h1>Thibault Bétrémieux - Resume as of 16<sup>th</sup> July 2016</h1>
</header>
<section id="personal-info-and-topskills">
<div class="topitem">
<p>
<a href="medias/thibault_betremieux_photo.jpg" target=_blank>
<img src="medias/thibault_betremieux_photo_mini.png" title="click to enlarge :) !" alt="Resume photo Thibault Bétrémieux" />
</a>
</p>
<!-- <a href.../> <Miniature/> </a> -->
<!-- target=_blank open in new link -->
</div>
<div class="topitem">
<h2>Personal information</h2>
<p><strong>About me: </strong>I am a young french expat living in Germany since two years, I speak four languages (French,English,German and Italian)</p>
<p><strong>Date of birth: </strong>24/12/1991</p>
<p><strong>Desired position: </strong>Online marketing or management in an international environment</p>
<p><strong>Place of residence:</strong> Bamberg, Bavaria (Germany)</p>
<a href="http://t.btmx.fr/contact">
<div id="contact_button">Contact me</div>
</a>
</div>
<div class="topitem">
<h2>Languages</h2>
<div id="languages">
<img src=medias/languages_450px.png alt="Languages">
</div>
</div>
<div class="topitem">
<h2>Computer skills</h2>
<h3>Microsoft Office</h3>
<ul>
<li>Word (including Mailing)</li>
<li>Excel (including charts and pivot tables)</li>
<li>PowerPoint (including masks)</li>
<li>Outlook</li>
</ul>
<h3>Internet</h3>
<ul>
<li>HTML5</li>
<li>CSS3</li>
<li>WordPress</li>
</ul>
</div>
</section>
<section id="containermain">
<div class="cmain-element">
<h2>Professional experience</h2>
<div class="float-logo-title">
<!-- is used to put the logo next to the title of work, place, and date-->
<div class="logo">
<p>
<img src="medias/aul_logo.png" alt="Logo Arbeit und Leben NRW" />
</p>
</div>
<div class="work-place-time">
<h3>Project manager (non renewable fixed-term contract)</h3>
<h4>Arbeit und Leben NRW, Düsseldorf, Germany</h4>
<p>05.2015 - 04-2016</p>
</div>
</div>
<ul>
<li>Organization and leading of Franco-German meetings for young people in vocational training – within the Program funded by the Franco-German Youth Office (OFAJ/DJFW) “Work in the partner country”</li>
<li>Animator of some of those meetings and training for the leading of intercultural exchanges</li>
<li>Development of partnerships between “Arbeit und Leben NRW”, socio-political organizations and/or vocational training centers</li>
</ul>
<div class="float-logo-title">
<div class="logo">
<p>
<img src="medias/dialoge_logo.png" alt="Logo Dialoge Sprachinstitut" />
</p>
</div>
<div class="work-place-time">
<h3>Assistant to the school direction (Master internship)</h3>
<h4>Dialoge Sprachinstitut GmbH, Lindau, Germany</h4>
<p>09.2013 - 01.2014</p>
</div>
</div>
<ul>
<li>CRM</li>
<li>Marketing: competition analysis and prospect survey research</li>
<li>Data exploitation and creation of documents for the ISO 9001 school certification</li>
<li>Various tasks for the school manager</li>
</ul>
<p>
<img src="medias/hsbc_trinkaus_logo.png" alt="HSBC Trinkaus logo" />
</p>
<!-- the logo is too large for any text to stand on its side -->
<h3>Assistant of the Team “Support to insolvency administrators” (Bachelor internship)</h3>
<h4>HSBC Trinkaus & Burkhardt AG (Corporate cients), Düsseldorf, Germany</h4>
<p>05.2012 – 08.2012</p>
<ul>
<li>Insight into equity backing principles, insolvency re-financing and trust accounts administration</li>
<li>Assistance to the team for opening trust accounts and for monitoring steps of insolvency proceedings</li>
<li>Daily queries for new insolvency cases in dedicated data bases</li>
</ul>
</div>
<div class="cmain-element">
<h2>Education</h2>
<h3>Specialization in E-Commerce and online Marketing</h3>
<h4>Conservatoire National des Arts et Métiers, Paris (Online training), France</h4>
<p>10.2014 - 04.2016</p>
<ul>
<li>“Online advertising and communication “(ESC127) - Grade: 1</li>
<li>"E-Commerce “(ESC128) - Grade: 1</li>
<li>“Collection and processing of digital marketing data “(ESC129) - Grade: 1</li>
<li>“Decision-making statistics in marketing “(ESC104) - Grade: 2,2</li>
<li>“Electronic marketing – digital marketing “(ESC123) - Grade: 1</li>
</ul>
<h3>Double degree: Master of Arts “Internationale Wirtschaftsbeziehungen” (International Economic Relations) – Grade 1,9</h3>
<h4>Albert-Ludwigs-Universität Freiburg, Freiburg im Breisgau, Germany</h4>
<p>10. 2012 - 09. 2014</p>
<p><strong>Masterarbeit: “Legislative environment of the bio-food sector”</strong> (Master’s thesis, 2014, 77p.) in German.</p>
<p>The founding texts (Codex Alimentarius and IFOAM Guidelines) and the laws of organic food; their relationships with the most famous bio private labels, internationally and in some regions and countries deeply involved in the organic food sector
(EU, USA, Switzerland, Germany, France, Austria ...).</p>
<h3>Double degree: Master of Arts „Commerce et Affaires internationales“ (International Business) – Grade 1,9</h3>
<h4>Université Paris Est Créteil (U-PEC), Créteil, France</h4>
<p>10.2012 - 09. 2014</p>
<p><strong>Theoretical work for preparing my internship: “Quality and training”</strong> (Sept. 2013, 35 p.) in French.</p>
<p>EFQM (European Foundation for Quality Management) excellence model and quality management with examples relative to training. Management process of a training action, from creation to evaluation and its improvement in the context of a quality
approach.
</p>
<h3>Bachelor of Arts „Commerce et Affaires Internationales“ (International Business) – Grade 1,6</h3>
<h4>Université Paris Est Créteil (U-PEC), Créteil, France</h4>
<p>10.2009 - 08.2012</p>
<p>Diploma with four languages (French, English, German, Italian)</p>
<h3>Baccalauréat</h3>
<h4>Lycée d’Arsonval, Saint Maur des Fossés</h4>
<p>06.2009</p>
<p>Scientific Baccalauréat in engineering sciences</p>
</div>
</section>
<section id="hobbies-passions">
<div id="hobbies-img">
<h2>Hobbies and passions</h2>
<p>
<img src="medias/hobbies_passions_1.png" alt="My hobbies and passions" />
</p>
<p>
<img src="medias/hobbies_passions_2.png" alt="My hobbies and passions" />
</p>
</div>
</section>
<footer>
<div id="footerbox">
<div class="footerelement">
<a href="https://linkedin.com/in/thibaultbetremieux">
<img src="medias/footer/linkedin_logo_40px.png" alt="Thibault Bétrémieux Linkedin">
</a>
</div>
<div class="footerelement">
<a href="https://www.xing.com/profile/Thibault_Betremieux">
<img src="medias/footer/xing_logo_40px.png" alt="Thibault Bétrémieux Xing">
</a>
</div>
<div class="footerelement">
<a href="http://t.btmx.fr/category/tech">
<img src="medias/footer/wp_articles_40px.png" alt="Thibault Bétrémieux Wordpress articles">
</a>
</div>
</div>
</footer>
</div>
</div>
<!--BG1 -->
</div>
<!--BG2 -->
</body>
</html>
Notes:
Perhaps this can help (it's the structure of the website):
i.stack.imgur.com/BEHxr.png
(I can post only 2 links max please copy paste and sorry...)
What I've tried so far:
for the text: redifining all font-sizes with media-queries for screens smaller than 1000px. For some reason, I have to define font-size for subitems (Box-> Item -> Subitems) because changing h2 or p etc. doesn't affect them. I have to use crazy values like 1.7em for them to look alright on mobile. But then if I'm on desktop with a reduced window (at less than 1000px), 1.7em looks huge :( !!
for the images: setting the image as background of the parent's (if I'm not mistaken) box seemed like a promising solution, however when I did that, the image was overflowing the box on the mobile :( ! I've also tried putting width=100% on parent or child but it didn't work.
other things that didn't make any sense or things I can't remember :P
I managed to resolve all problems by using the following code which gives a scale to the page:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Take care :)!