I created this layout, its almost there but I'm struggling with the images and text beside it. I want the entire box to flex at the same time, to keep the images and text responding at the same time.
What am I doing wrong? I think I am suffering from a mental block because this is my first time using flex.
.container {
max-width: 1750px;
}
.venture,
#event-content,
#news-content {
background-color: #eaeaea;
color: #444;
}
.catch {
color: #fff;
text-align: center;
margin: 1vmin 0vmin 0vmin 0vmin;
padding: 20px 50px;
background-color: #3366cc;
}
.tagline {
margin-top: 5%;
text-align: center;
font-weight: bold;
font-size: 130%;
}
#news-content a:link,
#news-content a:hover,
#news-content a:visited {
text-decoration: none;
color: #444;
font-family: FG Font;
font-size: 2vmin;
}
#news-content .btn.btn-primary {
background-color: #3366cc;
font-family: Arial;
border-color: #3366cc;
}
#news-content .tag {
background-color: #ef8b1e;
display: inline-block;
padding: 5px;
border-radius: 0px 0px 5px 5px;
font-size: 1.5vmin;
font-family: FG Font;
}
#news-content .title {
padding: 25px 10px 0px 10px;
}
#event-content .date {
background-color: #ef8b1e;
font-family: FG Font;
font-size: 3vmin;
display: inline-block;
text-align: center;
}
.main-wrapper {
display: flex;
flex-wrap: nowrap;
height: 70vh;
align-items: stretch;
}
.main-wrapper>div {
width: 50%;
min-height: 50vh;
}
.hero-img {
display: flex;
}
.hero-img>div {
margin: 1vmin;
align-self: stretch;
flex-basis: 50%;
}
.info-section {
display: flex;
flex-direction: column;
align-items: stretch;
}
.info-section .media-section {
margin: 1vmin 0vmin;
}
.info-section .venture {
position: relative;
padding: 3vmin 3vmin 2vmin 3vmin;
}
.media-section>div {
display: flex;
flex-direction: row;
}
.media-section>div>div {
flex-basis: 50%;
}
#news-content {
margin-right: .5vmin;
}
#event-content {
margin-left: .5vmin;
}
#news-content,
#event-content {
max-height: 150px;
}
<div class="container">
<div class="main-wrapper">
<div>
<div class="hero-img">
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Ship" /></div>
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Ship" /></div>
</div>
<div class="hero-img">
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Air" /></div>
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Helicopter" /></div>
</div>
</div>
<div>
<div class="info-section">
<div class="catch">
<h1>Lorem ipsum dolor sit amet, consectetur adipiscing elit</h1>
</div>
<div class="media-section">
<div>
<div id="news-content">
<div class="tag">In the News</div>
<div class="title">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
<a href="">
<div class="btn btn-primary">Link</div>
</a>
</div>
<div id="event-content">
<div class="date">
<div class="num">12</div>
<div class="month">DEC</div>
</div>
<div class="details">
<div class="title">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
<div class="info">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
</div>
</div>
</div>
</div>
<div class="venture">
<h2>Lorem ipsum dolor sit ametn<br>Lorem ipsum dolor sit amet</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquam diam non mollis sollicitudin. Curabitur sed felis ac urna laoreet finibus nec eu sem. Fusce cursus tortor eget lectus lacinia, id blandit dolor ultrices. Aliquam pellentesque
venenatis turpis, a viverra ante tincidunt vel. Quisque dui orci, viverra id ipsum eget, dictum mattis ante. Aliquam pellentesque massa et euismod efficitur. Aliquam vestibulum velit et lobortis feugiat. Curabitur vulputate quam efficitur,
pellentesque ex quis, tincidunt orci. Donec magna est, ultrices nec pretium nec, porta id nisl. Mauris vitae magna ac sem pellentesque hendrerit. Donec elit justo, pulvinar id leo posuere, venenatis mattis nisl. Maecenas tristique augue ut
odio tincidunt aliquam. Nullam volutpat lobortis eros.</p>
<div class="tagline">LOREM IPSUM</div>
</div>
</div>
</div>
</div>
</div>
Not sure if that you want, the entire container in same column can be done like that :
<pre>
<div class="container">
<div class="main-wrapper">
<div>
<div class="info-section">
<div>
<div class="hero-img">
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Ship" /></div>
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Ship" /></div>
</div>
<div class="hero-img">
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Air" /></div>
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Helicopter" /></div>
</div>
</div>
<div class="catch">
<h1>Lorem ipsum dolor sit amet, consectetur adipiscing elit</h1>
</div>
<div class="media-section">
<div>
<div id="news-content">
<div class="tag">In the News</div>
<div class="title">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
<a href="">
<div class="btn btn-primary">Link</div>
</a>
</div>
<div id="event-content">
<div class="date">
<div class="num">12</div>
<div class="month">DEC</div>
</div>
<div class="details">
<div class="title">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
<div class="info">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
</div>
</div>
</div>
</div>
<div class="venture">
<h2>Lorem ipsum dolor sit ametn<br>Lorem ipsum dolor sit amet</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquam diam non mollis sollicitudin. Curabitur sed felis ac urna laoreet finibus nec eu sem. Fusce cursus tortor eget lectus lacinia, id blandit dolor ultrices. Aliquam pellentesque
venenatis turpis, a viverra ante tincidunt vel. Quisque dui orci, viverra id ipsum eget, dictum mattis ante. Aliquam pellentesque massa et euismod efficitur. Aliquam vestibulum velit et lobortis feugiat. Curabitur vulputate quam efficitur,
pellentesque ex quis, tincidunt orci. Donec magna est, ultrices nec pretium nec, porta id nisl. Mauris vitae magna ac sem pellentesque hendrerit. Donec elit justo, pulvinar id leo posuere, venenatis mattis nisl. Maecenas tristique augue ut
odio tincidunt aliquam. Nullam volutpat lobortis eros.</p>
<div class="tagline">LOREM IPSUM</div>
</div>
</div>
</div>
</div>
</div>
</pre>
Related
The following is the given html code and I am not allowed to alter it by any means
#exceriseHead {
font-family: Arial, Helvetica, sans-serif;
font-size: 50px;
font-weight: bold;
border: 1px solid black;
background-color: greenyellow;
text-align: center;
color: black;
}
body {
color: gainsboro;
text-align: center;
}
p {
color: black
}
.exEnumeration {
color: green;
}
#exceriseFooter {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
border: 1px solid black;
background-color: greenyellow;
text-align: center;
color: black;
}
.contentcolumnContent {
display: flex;
}
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Abgabeseite 3</title>
<link rel="stylesheet" href="cssaufgabe2.css">
<!-- TODO: Import der CSS Datei -->
</head>
<body>
<h1>Übungsblatt 4</h1>
<div id="exceriseHead">
Aufgabe 3
</div>
<div class="contentcolumnContent">
<div class="exercisePart">
<div class="exEnumeration">
<h1>a.)</h1>
</div>
<div>
<!-- TODO: Beispieltext durch Aufgabentext ersetzen -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br> Aenean pellentesque aliquet imperdiet. Nam ut lacinia elit.<br> Fusce dictum lorem purus, a ullamcorper dolor dictum eu.<br> Proin a sapien ut mauris egestas fringilla eu eu magna. Ut<br> eu imperdiet leo, vel ultrices quam.</p>
</div>
</div>
<div class="exercisePart">
<div class="exEnumeration">
<h1>b.)</h1>
</div>
<div>
<!-- TODO: Beispieltext durch Aufgabentext ersetzen -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br> Aenean pellentesque aliquet imperdiet. <span class="code">Nam ut lacinia<br> elit. </span> Fusce dictum lorem purus, a ullamcorper dolor<br> dictum eu. Proin a sapien ut mauris egestas
fringilla eu eu<br> magna. Ut eu imperdiet leo, vel ultrices quam.</p>
</div>
</div>
<div class="exercisePart">
<div class="exEnumeration">
<h1>c.)</h1>
</div>
<div>
<!-- TODO: Beispieltext durch Aufgabentext ersetzen -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br> Aenean pellentesque aliquet imperdiet. Nam ut lacinia elit.<br> Fusce dictum lorem purus, a ullamcorper dolor dictum eu.<br> Proin a sapien ut mauris egestas fringilla eu eu magna. Ut<br> eu imperdiet leo, vel ultrices quam.</p>
</div>
</div>
</div>
<div id="exceriseFooter">
[Gruppenbezeichnung]
</div>
</body>
</html>
This is how it looks
This is how it should look like
Hi, I got an assignment to write a css sheet in order to make a given html page look like the image below. However I can't figure out, how to put the enumerations ( a.), b.)and c.)) in front of the text. I hope you can help me :(
The work is almost done: for the .exercisePart elements you need to set flex-grow and flex-shrink to 1. display: flex and align-items: center so the letter and the text can be side by side
A small gap to the outer flexbox container may improve readability.
#exceriseHead {
font-family: Arial, Helvetica, sans-serif;
font-size: 50px;
font-weight: bold;
border: 1px solid black;
background-color: greenyellow;
text-align: center;
color: black;
}
body {
color: gainsboro;
text-align: center;
}
p {
color: black
}
.exEnumeration {
color: green;
}
#exceriseFooter {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
border: 1px solid black;
background-color: greenyellow;
text-align: center;
color: black;
}
.contentcolumnContent {
display: flex;
gap: 1rem;
justify-content: space-between;
}
.exercisePart {
flex: 1 1 auto;
display: flex;
gap: .25rem;
align-items: center;
}
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Abgabeseite 3</title>
<link rel="stylesheet" href="cssaufgabe2.css">
<!-- TODO: Import der CSS Datei -->
</head>
<body>
<h1>Übungsblatt 4</h1>
<div id="exceriseHead">
Aufgabe 3
</div>
<div class="contentcolumnContent">
<div class="exercisePart">
<div class="exEnumeration">
<h1>a.)</h1>
</div>
<div>
<!-- TODO: Beispieltext durch Aufgabentext ersetzen -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br> Aenean pellentesque aliquet imperdiet. Nam ut lacinia elit.<br> Fusce dictum lorem purus, a ullamcorper dolor dictum eu.<br> Proin a sapien ut mauris egestas fringilla eu eu magna. Ut<br> eu imperdiet leo, vel ultrices quam.</p>
</div>
</div>
<div class="exercisePart">
<div class="exEnumeration">
<h1>b.)</h1>
</div>
<div>
<!-- TODO: Beispieltext durch Aufgabentext ersetzen -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br> Aenean pellentesque aliquet imperdiet. <span class="code">Nam ut lacinia<br> elit. </span> Fusce dictum lorem purus, a ullamcorper dolor<br> dictum eu. Proin a sapien ut mauris egestas
fringilla eu eu<br> magna. Ut eu imperdiet leo, vel ultrices quam.</p>
</div>
</div>
<div class="exercisePart">
<div class="exEnumeration">
<h1>c.)</h1>
</div>
<div>
<!-- TODO: Beispieltext durch Aufgabentext ersetzen -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br> Aenean pellentesque aliquet imperdiet. Nam ut lacinia elit.<br> Fusce dictum lorem purus, a ullamcorper dolor dictum eu.<br> Proin a sapien ut mauris egestas fringilla eu eu magna. Ut<br> eu imperdiet leo, vel ultrices quam.</p>
</div>
</div>
</div>
<div id="exceriseFooter">
[Gruppenbezeichnung]
</div>
</body>
</html>
The .exerciseParts contain two <div>s, which by default have display: block, meaning they take all the width they can from their container, thus stacking vertically.
In order to change that, you can make the .exercisePart flexbox containers:
.exercisePart {
display: flex;
}
That way by default all their children will stack horizontally and try and take the right amount of space.
I need an image (image container to be precise) to resize according to container height and maintain its aspect ratio. Longer the text = bigger the image. Right now its ether image getting out of container or just staying still.
article,
.information,
.image {
margin: 8px;
border: 2px solid black;
}
article {
display: flex;
}
.information {
flex-grow: 1;
}
.image {
font-size: 0;
}
<article>
<div class="information">
<h3>too much text. image must be resized to fill whole height and stay square</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer congue, turpis in sollicitudin fringilla, sapien augue consectetur augue, id lacinia nibh massa at justo. Praesent pellentesque nunc elementum cursus faucibus. Donec vel diam scelerisque,
pharetra velit a, pharetra quam. Ut tristique justo id justo pharetra, eget sollicitudin libero mattis.</p>
</div>
<div class="image">
<img src="https://via.placeholder.com/150" />
</div>
</article>
<hr/>
<article>
<div class="information">
<h3>too little text</h3>
<p>Lorem ipsum dolor sit amet</p>
</div>
<div class="image">
<img src="https://via.placeholder.com/150" />
</div>
</article>
article,
.information,
.image {
margin: 8px;
border: 2px solid black;
}
.image{
width:50%;
}
.image img{
height:100%;
width:100%;
}
article {
display: flex;
}
.information {
width:50%;
flex-shrink:0;
}
.image {
font-size: 0;
}
<article>
<div class="information">
<h3>too much text. image must be resized to fill whole height and stay square</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer congue, turpis in sollicitudin fringilla, sapien augue consectetur augue, id lacinia nibh massa at justo. Praesent pellentesque nunc elementum cursus faucibus. Donec vel diam scelerisque,
pharetra velit a, pharetra quam. Ut tristique justo id justo pharetra, eget sollicitudin libero mattis
pellentesque nunc elementum cursus faucibus. Donec vel diam scelerisque,
pharetra velit a, pharetra quam. Ut tristique justo id justo pharetra, eget sollicitudin libero mattis.</p>
</div>
<div class="image">
<img src="https://via.placeholder.com/150" />
</div>
</article>
<hr/>
<article>
<div class="information">
<h3>too little text</h3>
<p>Lorem ipsum dolor sit amet</p>
</div>
<div class="image">
<img src="https://via.placeholder.com/150" />
</div>
</article>
I'm trying to align content in a flex box centered (vertical and horizontal). In my example it works as long the screen is big enough.
Problems:
When the content is bigger than 100vh in the ".wrapper" class. The content will be cut of at the top.
When i set the ".wrapper" to "100vh" and I add the ".header" div, this div should be excluded from the "100vh" otherwise i will get a scrollbar for nothing.
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<title>FlexBox</title>
<meta name="infoription" content="">
<style>
* {
margin: 0;
padding: 0;
}
body {
background-color: #f8f9fa;
font-family: Roboto,Helvetica,Arial,Lucida,sans-serif;
color: #55595c;
}
.wrapper {
display: flex;
justify-content: center;
align-content: center;
height: 100vh;
flex-wrap: wrap;
}
.content {
background-color: #ffffff;
max-height: 350px;
max-width: 300px;
min-height: 350px;
min-width: 300px;
margin: 10px;
position: relative;
border: 1px solid #dfdfdf;
border-radius: 0.25rem;
}
.content:after {
/* background: none repeat scroll 0 0 transparent; */
bottom: 0;
content: "";
display: block;
height: 10px;
left: 50%;
position: absolute;
background: #55595c;
transition: width 0.4s ease 0s, left 0.4s ease 0s;
width: 0;
}
.content:hover:after {
width: 100%;
left: 0;
}
.thumb {
background-color: #55595c;
height: 150px;
border-top-left-radius: 0.25rem;
border-top-right-radius: 0.25rem;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
}
.info {
padding: 10px;
text-align: justify;
}
/* Responsive layout - screen is bigger than 1000px wide */
#media (min-width: 1000px) {
.bodysize {
width: 1000px;
margin: auto;
}
</style>
</head>
<body>
<div class="bodysize">
<div class="header">
<h1>Example Page</h1>
</div>
<div class="wrapper">
<div class="content">
<div class="thumb">
<h3>Thumbnail</h3>
</div>
<div class="info">
<h3>[1]</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean turpis felis, dapibus ac tellus at, imperdiet consectetur ante. Mauris vulputate arcu nibh, et convallis felis mattis id.</p>
</div>
</div>
<div class="content">
<div class="thumb">
<h3>Thumbnail</h3>
</div>
<div class="info">
<h3>[2]</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean turpis felis, dapibus ac tellus at, imperdiet consectetur ante. Mauris vulputate arcu nibh, et convallis felis mattis id.</p>
</div>
</div>
<div class="content">
<div class="thumb">
<h3>Thumbnail</h3>
</div>
<div class="info">
<h3>[3]</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean turpis felis, dapibus ac tellus at, imperdiet consectetur ante. Mauris vulputate arcu nibh, et convallis felis mattis id.</p>
</div>
</div>
<div class="content">
<div class="thumb">
<h3>Thumbnail</h3>
</div>
<div class="info">
<h3>[4]</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean turpis felis, dapibus ac tellus at, imperdiet consectetur ante. Mauris vulputate arcu nibh, et convallis felis mattis id.</p>
</div>
</div>
<div class="content">
<div class="thumb">
<h3>Thumbnail</h3>
</div>
<div class="info">
<h3>[5]</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean turpis felis, dapibus ac tellus at, imperdiet consectetur ante. Mauris vulputate arcu nibh, et convallis felis mattis id.</p>
</div>
</div>
<div class="content">
<div class="thumb">
<h3>Thumbnail</h3>
</div>
<div class="info">
<h3>[6]</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean turpis felis, dapibus ac tellus at, imperdiet consectetur ante. Mauris vulputate arcu nibh, et convallis felis mattis id.</p>
</div>
</div>
<div class="content">
<div class="thumb">
<h3>Thumbnail</h3>
</div>
<div class="info">
<h3>[7]</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean turpis felis, dapibus ac tellus at, imperdiet consectetur ante. Mauris vulputate arcu nibh, et convallis felis mattis id.</p>
</div>
</div>
<div class="content">
<div class="thumb">
<h3>Thumbnail</h3>
</div>
<div class="info">
<h3>[8]</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean turpis felis, dapibus ac tellus at, imperdiet consectetur ante. Mauris vulputate arcu nibh, et convallis felis mattis id.</p>
</div>
</div>
<div class="content">
<div class="thumb">
<h3>Thumbnail</h3>
</div>
<div class="info">
<h3>[9]</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean turpis felis, dapibus ac tellus at, imperdiet consectetur ante. Mauris vulputate arcu nibh, et convallis felis mattis id.</p>
</div>
</div>
</div>
</div>
</body>
</html>
Example pictures:
Problem 1 - scrollbar because of "height: 100vh;".
Problem 2 - content floating out of the browser top. also because of "height: 100vh;".
Questions:
1) How can I set a dynamic height so the wrapper always fills the rest of the available space?
2) If the content is smaller than than the wrapper height it should be centered vertical but if the content is bigger, there is not center needed.
Any ideas how I can fix this?
>>> SOLUTION <<<
I added the .bodysize, removed the height from the wrapper and added "flex-grow: 1" to the wrapper. .bodysize { display: flex; flex-flow: column; height: 100vh; }
Try to set height: auto; and max-height: 100vh; at your wrapper.
Otherwise, your wrapper always would have 100% height even having few elements inside. The scrollbar would should appear when the content exceeds 100vh.
.wrapper {
display: flex;
justify-content: center;
align-content: center;
height: auto;
max-height: 100vh;
flex-wrap: wrap;
}
How put 4 images and title and description side by side in a html box? No link, only text. As shown below:
Flex box is the way to go:
https://jsfiddle.net/s1mreoe8/1/
.flex{
display:flex;
}
Here is a guide : https://css-tricks.com/snippets/css/a-guide-to-flexbox/
.first {
float: left;
width: 50%;
}
.img {
float: left;
width:39%;
padding:10px;
}
.text
{
width:39%;
float: left;
padding:10px;
}
.img img {
width: 100%;
}
<div class="row">
<div class="first">
<div class="img">
<img src="http://www.fogosglobo.com.br/img/250x250-circle.png" alt="img">
</div>
<div class="text">
<p><strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. Nunc molestie, nibh eu molestie vestibulum, urna neque interdum orci, ut egestas diam massa vel magna. Mauris eget nunc nec sem ultrices varius.</p>
</div>
</div>
<div class="first">
<div class="img">
<img src="http://www.fogosglobo.com.br/img/250x250-circle.png" alt="img">
</div>
<div class="text">
<p><strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. Nunc molestie, nibh eu molestie vestibulum, urna neque interdum orci, ut egestas diam massa vel magna. Mauris eget nunc nec sem ultrices varius.</p>
</div>
</div>
</div>
I want to create a "card" for an element, it will have an image, a title, a sub-title and a description, what I want is that the card should be aligned to the left (attached to the left border) but when I float the text to the right I get this behavior.. And the position of the card depends on the max width I set the text. How can I fix this?
This is the JSFiddle to show the whole code:
This is the code I used to create the cards
<div class="first__section">
<div class="inner">
<div class="schede__container">
<div class="scheda__realizzazione">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
<div class="scheda__realizzazione">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
<div class="scheda__realizzazione">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
<div class="scheda__realizzazione">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
<div class="scheda__realizzazione">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
<div class="scheda__realizzazione">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
</div>
</div>
</div>
Try this
Html:
<div class="first__section">
<div class="inner">
<div class="schede__container">
<div class="scheda__realizzazione">
<div class="div-img">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
</div>
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
<div class="scheda__realizzazione">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
<div class="scheda__realizzazione">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
<div class="scheda__realizzazione">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
<div class="scheda__realizzazione">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
<div class="scheda__realizzazione">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
</div>
</div>
</div>
CSS:
.schede__container {
border-left:1px solid #343333;
}
.scheda__realizzazione {
text-align: left;
display:inline-block;
margin:40px 0 40px 20px;
padding:40px 0 40px 20px;
border-bottom:1px solid #343333;
}
.div-img {
float: left;
}
.scheda__content {
display: inline-block;
margin-left: 20px;
max-width: 313px;
vertical-align: top;
}
.scheda__content h1 {
color:#5C5A5B;
text-transform:uppercase;
font-size:20px;
}
.scheda__content h2 {
color:#5C5A5B;
font-size:20px;
margin-top: -6px;
}
.scheda__content p {
color:#5C5A5B;
text-transform: lowercase;
}
.first__section {
width:100%;
text-align:center;
background-color:white;
}
.inner {
max-width: 1024px;
margin: 0 auto;
position: relative;
}
demo http://jsfiddle.net/JentiDabhi/256oxh52/
You need to change some properties in the following CSS classes to achieve your target.
First of all put the image in separate div and content in separate div.
<div class="scheda__realizzazione">
<div class="div-img">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
</div>
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
Add width to your .div_img class that your images needs.
.div-img {
float: left;
width: 150px;
}
Secondly you only need to set the margin-left in the .scheda__content class and remove all other styles in it. margin-left : 150px; will do the trick for you but I set it to margin-left: 160px; for some clarity.
.scheda__content {
margin-left: 160px;
}
Working JSFiddle Demo Here.
.schede__container {
border-left: 1px solid #343333;
}
.scheda__realizzazione {
text-align: left;
display: inline-block;
margin: 40px 0 40px 20px;
padding: 40px 0 40px 20px;
border-bottom: 1px solid #343333;
}
.div-img {
float: left;
width: 150px;
}
.scheda__content {
margin-left: 160px;
}
.scheda__content h1 {
color: #5C5A5B;
text-transform: uppercase;
font-size: 20px;
}
.scheda__content h2 {
color: #5C5A5B;
font-size: 20px;
margin-top: -6px;
}
.scheda__content p {
color: #5C5A5B;
text-transform: lowercase;
}
.first__section {
width: 100%;
text-align: center;
background-color: white;
}
.inner {
max-width: 1024px;
margin: 0 auto;
position: relative;
}
<div class="first__section">
<div class="inner">
<div class="schede__container">
<div class="scheda__realizzazione">
<div class="div-img">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
</div>
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
<div class="scheda__realizzazione">
<div class="div-img">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
</div>
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div><div class="scheda__realizzazione">
<div class="div-img">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
</div>
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div><div class="scheda__realizzazione">
<div class="div-img">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
</div>
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div><div class="scheda__realizzazione">
<div class="div-img">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
</div>
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div><div class="scheda__realizzazione">
<div class="div-img">
<img class="scheda__img" src="http://placehold.it/150x150" alt="">
</div>
<div class="scheda__content">
<h1>test</h1>
<h2>test</h2>
<p>LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. MAECENAS SUSCIPIT LIBERO ARCU, EU LAOREET ORCI TINCIDUNT NEC. MORBI NEC JUSTO VEL NULLA SOLLICITUDIN ACCUMSAN VITAE QUIS ENIM.</p>
</div>
</div>
</div>
</div>
</div>