CSS unecessary space in main when in mobile mode - html

This is what the site is like when in desktop mode:
Now in mobile mode:
You can see that there is now extra space on the bottom. I make sure to erase margins everywhere but the space still remained there.
Pertinent css code:
.grid-container{
display: grid;
grid-template-areas:
"header"
"main"
"footer";
grid-template-columns: 1fr;
grid-template-rows: 5rem 1fr 3rem;
height: 100%;
}
.main {
grid-area: main;
background-image: url("res/background_min.jpg");
overflow: hidden
}
/*Home Screen*/
.home{
display: flex;
}
.menu-list{
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
height: 100%;
}
.menu-list a {
padding: 0rem;
flex: 0 1 50rem;
margin: 1.5rem;
height: 100%;
width: 100%;
display: flex;
text-decoration: none;
color: white;
}
.menu-list li
{
display: flex;
list-style-type: none;
text-decoration: none;
align-items: center;
justify-content: center;
width: 100%;
height: 10%;
}
.menu-list p {
font-size: 2vw;
}
.section a {
color: #ffffff;
font-weight: bold;
font-size: 2vw;
text-decoration: none;
}
.about {
background-image: linear-gradient(to right, cyan, magenta);
}
.contacts {
background-image: linear-gradient(to right, fuchsia, turquoise);
}
.projects{
background-image: linear-gradient(to right, turquoise, fuchsia);
}
.question-box {
background-image: linear-gradient(to right, magenta, aqua);
}
.home-main-image{
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
max-width: 45%;
}
.home-main-image img{
max-width: 99%;
}
.fade-in {
animation: fadeIn ease 2s;
}
.button{
background-image: linear-gradient(to right, cyan, magenta);
border: none;
text-align: center;
color: white;
text-decoration: none;
font-size: 1vw;
padding: .5rem;
}
Menu list is the vertical column of buttons that should occupy most of the screen on the left, and home-main-image is the giant terminal logo plastered on the right.
Note that the issue happens with a real mobile device too.
Edit: For clarification, this is the extra space:
Edit: added react html:
App.js
function App() {
const [lang, setLang] = useLanguage();
const handleLanguageChange = () => {
if (lang.lang === 'eng'){
setLang('fr')
} else {
setLang('en')
}
}
return (
<BrowserRouter>
<div className="grid-container">
<header className="header">
<div className="brand">
<Link to="/" >
Eduardo Breton
</Link>
</div>
<div className="header-side">
{lang.subtitle}
</div>
<div className="header-right">
<button className="button" onClick={() => handleLanguageChange()}>{lang.traduction} </button>
</div>
<div>
</div>
</header>
<main className="main">
<div className="content">
<Route path="/" exact={true} component={HomeScreen} />
<Route path="/about" component={AboutScreen}/>
<Route path="/contact" component={ContactScreen}/>
<Route path="/project" component={ProjectScreen}/>
<Route path="/question" component={QuestionScreen}/>
</div>
</main>
<footer className="footer">
© 2020 Eduardo Breton
</footer>
</div>
</BrowserRouter>
);
}
HomeScreen.js:
const { Link } = require("react-router-dom");
function HomeScreen() {
const [lang, setLang] = useLanguage();
return <div className="home">
<ul className="menu-list">
<Link to="/about">
<li className="fade-in section about" >
{lang.about}
</li>
</Link>
<Link to="/contact">
<li className="fade-in section about" >
{lang.contact}
</li>
</Link>
<Link to="/project">
<li className="fade-in section about" >
{lang.projects}
</li>
</Link>
<Link to="/question">
<li className="fade-in section about" >
{lang.question}
</li>
</Link>
</ul>
<div className="home-main-image fade-in">
<img src={terminalImage} />
</div>
</div>
}
export default HomeScreen;
Checked answer with the discussion has fixed the issue, changing flex-direction to column on a media screen on main has allowed me to center correctly the contents:

the first thing you need to do is add a meta description for mobile view in the head. These in particular
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
Next you need to make your site responsive by adding media queries so that the home main image and your buttons become responsive. You should increase the size of the menu buttons and set them to
#media screen and (max-width:650px) {
.menu-list li {
flex-direction:column;
}
}
That way your buttons will be bigger, aligned in the center, AND in a column (this will look better on mobile). You should also change the flex direction of the main image. Also, try adding some padding between the buttons in mobile view, this should also help in taking up the space.

Related

How can I make my navigation bar links(About, Services, Projects) "stop running off the screen"-make it stop?

When I try to size down my desktop screen navigation size of 1440px(90em) to any lower width screen, my navigation bar links start dropping off the screen. I have tried using some media query combinations, but nothing to show for it.I haven't got much experience with frontend, so I am a little bit thin on this side. Any long-term fixes to this one?Any hint on this one will be highly appreciated.
HTML header code:
<!--header-->
<header>
<nav class="nav__bar">
<a href="#" class="logo">
<img src="./images/logo.svg" alt="Sunnyside logo">
</a>
<ul class="nav__links">
<li class="nav__item">
About
</li>
<li class="nav__item">
Services
</li>
<li class="nav__item">
Project
</li>
Contact
</ul>
<img src="./images/icon-hamburger.svg" alt="toggle menu icon" class="toggle__menu">
</nav>
</header>
CSS header styles:
header {
height: 5em;
position: absolute;
left: 0;
right: 0;
}
.nav__bar {
height: 100%;
width: 90em;
margin: auto;
display: flex;
justify-content: space-between;
align-items: center;
flex: 1 1 auto;
padding: 0 2em;
}
.nav__links {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
list-style: none;
}
.nav__item {
margin: 1em;
}
.nav__link {
text-decoration: none;
font-size: 1.125em;
color: hsl(0, 0%, 100%);
font-family: 'Barlow', sans-serif;
transition: all 350ms ease-in-out;
}
.nav__link:hover {
color: hsl(232, 10%, 55%);
}
.toggle__menu {
cursor: pointer;
display: none;
}
In your example code, you set the color of the link text to white... it's white on white. But that's not fully the problem... you should also remove width:90em from the .nav_bar... it's unnecessary. see this codepen https://codepen.io/aequalsb/pen/jOmyJNp
Just simply allow the <nav> to "be itself"... which is a block level element and naturally attempts to stretch out to fit available width.
padding in CSS Sizes the margin inside a button or element. Try using margin: (how many 'px' it's going off the screen); and I've had this problem before:
SOLUTION 1:
use margin-*left or top*: *px is going off screen*
<style>
#button {
width: 100px; /* the width of the button */
position: absolute;
left: 50%; /* always 50% when centering */
margin-left: -50px; /* minus half the size of the element */
}
</style>
<button id="button">Center of page</button>
SOLUTION 2
i've had this problem before, and in best situations, use position: absolute instead of relative if you are positioning the element.
<head>
<style>
.background {
position: relative;
}
.overlap {
position: absolute;
left: 30px;
}
</style>
</head>
</style>
</head>
<body>
<!-- background-element -->
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Circle_Rufous_Solid.svg/1200px-Circle_Rufous_Solid.svg.png" class="background" width="10.5%" />
<!-- Overlap element -->
<img src="https://cdn.onlinewebfonts.com/svg/img_24930.png" class="overlap" width="10%" />
</body>
SOLUTION 3
if none of the above works, consider using javascript: device tester command and redirect to an error page with unsupported devices.
This example will detect a handful of mobile-devices, and if so, it'll redirect to 𝘩𝘵𝘵𝘱://𝘨𝘰𝘰𝘨𝘭𝘦.𝘤𝘰𝘮
<script>
if( /Android|webOS|iPhone|iPad|Mahc|Macintosh|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
window.location.href = "http://google.com";
} else {
}
</script>
NOTE: if there is big problem you cannot solve, and none of these work, its best to do research or find some articles to find your answer. Then consider using stackoverflow.

Stop css grid from overlapping

i created this grid that should change its layout responsive on a mobile device. The problem is that the content tends to overlap one another and not take up full height. I tried giving it a full height width but it still wouldnt take up the full height of the page. and changing up the grid but I always encounter the same problem.
Code:
body
{
overflow-x: hidden;
display: grid;
grid-template-columns: repeat(4 , 1fr);
grid-template-rows: 2.4vw 50vw 10vw;
grid-gap: 1em;
}
*::-webkit-scrollbar {
display: none;
}
header ,footer
{
grid-column: 1 / span 5;
}
main
{
grid-column: 1 / span 3;
}
aside
{
grid-column: span 2;
}
/* Demo Specific Styles */
body {
margin: 0;
padding: 1 em 0;
}
header, main,aside,footer
{
display: flex;
align-items: center;
}
/*styling nav*/
nav{
width: 100%;
color: rgb(238, 234, 232);
background-color: #ff4654;
text-align: center;
}
nav ul li a{
text-decoration: none;
color: #000;
}
nav ul li{
list-style-type: none;
height: 40px;
line-height: 40px;
background-color: #ff4654;
}
nav> ul{
display: flex;
justify-content: space-around;
text-align: center;
}
nav ul li ul li{
display: none;
}
nav> ul >li:hover ul li{
display: block;
}
nav ul li{
flex-basis: 20%;
}
nav ul li:hover {
background-color: thistle;
}
/*footer*/
footer
{
display: flex;
justify-content: space-around;
bottom: 0;
width: 100%;
background-color:rgb(16, 24, 35);
color:rgb(238, 234, 232);
}
footer ul
{
list-style-type: none;
}
footer .information
{
display: flex;
justify-content: space-evenly;
}
footer a
{
color:rgb(222, 214, 211);
}
/*ability*/
.abilitylist
{
min-width: 75%;
max-width: 100%;
background-color: #000;
}
.abilitylist li
{
display: inline-flex;
}
.abilitytekst
{
display: none;
border:1px solid #f1f1f1;
color:#f1f1f1 ;
}
.ability
{
flex-basis: 20%;
}
.ability img:hover + .abilitytekst
{
display: block;
}
.ability
{
display: block;
}
/*sidebar*/
.sidebar
{
background-color: rgb(16, 24, 35);
}
.sidebar__content
{
color: rgb(238, 234, 232);
}
.sidebar__content h1
{
font-size: 2em;
text-align: center;
}
/*Responsive*/
#media only screen and (max-width: 480px)
{
/*small devices smartphone*/
main,
aside
{
grid-column: 1 / span 5;
}
}
<!DOCTYPE html>
<html>
<head>
<meta name = "viewport" content="width=device-width , initial-scale=1.0">
<meta name = "viewport" content ="heigth=device-height , initial-scale=1.0">
<link rel="stylesheet" href="css/Style2.css">
<link rel="icon" type="image/x-icon" href="img/valo_logo.ico" />
<title>sova</title>
</head>
<body>
<header>
<nav>
<ul>
<li>Home</li>
<li>Agents
<ul>
<li>Jett</li>
<li>Sova</li>
<li>Raze</li>
</ul>
</li>
<li>OverOns</li>
<li>Contact</li>
</ul>
</nav>
</header>
<main>
<div class = "abilitylist">
<ul class = "abilities">
<li class = "ability">
<img src = "img/sova/Sova_Q.png">
<div class = "abilitytekst">
Q-Shock Bolt EQUIP a bow with a shock bolt. FIRE to send the explosive forward,<br>
Rdetonating upon collision and damaging players nearby.<br>
HOLD FIRE to extend the range of the projectile.<br>
ALTERNATE FIRE to add up to two bounces to this arrow.
</div>
</li>
<li class = "ability">
<img src = "img/sova/Sova_E.png">
<div class = "abilitytekst">
E-Recon Bolt EQUIP a bow with a recon bolt. FIRE to send the recon bolt forward, activating upon collision<br>
and revealing the location of nearby enemies caught in the line of sight of the bolt.<br>
HOLD FIRE to extend the range of the projectile.<br>
ALTERNATE FIRE to add up to two bounces to this arrow.E-Tailwind INSTANTLY propel Jett in the direction she is moving.<br>
If Jett is standing still, she will propel forward.
</div>
</li>
<li class = "ability">
<img src = "img/sova/Sova_C.png">
<div class = "abilitytekst">
C-Owl Drone EQUIP an owl drone. FIRE to deploy and take control of movement of the drone.<br>
While in control of the drone, FIRE to shoot a marking dart. <br>
This dart will reveal the location of any player struck by the dart.
</div>
</li>
<li class = "ability">
<img src = "img/sova/Sova_X.png">
<div class = "abilitytekst">
X-Hunters Fury EQUIP a bow with three long-range wall-piercing energy blasts. FIRE to release an energy blast in a line<br>
in front of Sova, dealing damage and revealing the location of enemies<br>
caught in the line. This ability can be RE-USED up to two more times while the ability timer is active.
</div>
</li>
</ul>
</div>
</main>
<aside>
<div class="sidebar">
<div class="sidebar__content">
<span>
<h1>Sova</h1>
<img src="img/sova_avatar.jpg">
<h3>Role: Controller</h3>
<hr class = "lijn">
<h3>
Biography:<br>
Born from the eternal winter of Russia's tundra, Sova tracks, finds,
and eliminates enemies with ruthless efficiency and precision.
His custom bow and incredible scouting abilities ensure that even if you run, you cannot hide.
</h3>
</span>
</div>
</div>
</aside>
<footer class = "footer">
<div class = "Information">
<h1>Contact and Information</h1>
<ul>
<li>Contact us</li>
About us
<li></li>
</ul>
</div>
<div class = "agentsfooter">
<h1>Agent Guides</h1>
<ul>
<li>Jett guide</li>
<li>Raze guide</li>
<li>Sova guide</li>
</ul>
</div>
</footer>
</body>
</html>
I have made some changes just in the CSS (3 /*CHANGES*/).
body
{
overflow-x: hidden;
display: grid;
grid-template-columns: repeat(4 , 1fr);
grid-template-rows: 2.4vw 50vw 10vw;
grid-gap: 1em;
}
*::-webkit-scrollbar {
display: none;
}
header ,footer
{
grid-column: 1 / span 5;
}
main
{
grid-column: 1 / span 3;
}
aside
{
grid-column: span 2;
}
/* Demo Specific Styles */
body {
margin: 0;
padding: 1 em 0;
}
/*CHANGES*/
header, main
{
display: flex;
align-items: center;
}
/*styling nav*/
nav{
width: 100%;
color: rgb(238, 234, 232);
background-color: #ff4654;
text-align: center;
}
nav ul li a{
text-decoration: none;
color: #000;
}
nav ul li{
list-style-type: none;
height: 40px;
line-height: 40px;
background-color: #ff4654;
}
nav> ul{
display: flex;
justify-content: space-around;
text-align: center;
}
nav ul li ul li{
display: none;
}
nav> ul >li:hover ul li{
display: block;
}
nav ul li{
flex-basis: 20%;
}
nav ul li:hover {
background-color: thistle;
}
/*footer*/
footer
{
/*CHANGES*/
position: absolute;
bottom: 0px;
width: 100%;
background-color:rgb(16, 24, 35);
color:rgb(238, 234, 232);
display: flex;
justify-content: space-evenly;
}
footer ul
{
list-style-type: none;
}
/*CHANGES*/
footer div {
width: 45%;
}
footer a
{
color:rgb(222, 214, 211);
}
/*ability*/
.abilitylist
{
min-width: 75%;
max-width: 100%;
background-color: #000;
}
.abilitylist li
{
display: inline-flex;
}
.abilitytekst
{
display: none;
border:1px solid #f1f1f1;
color:#f1f1f1 ;
}
.ability
{
flex-basis: 20%;
}
.ability img:hover + .abilitytekst
{
display: block;
}
.ability
{
display: block;
}
/*sidebar*/
.sidebar
{
background-color: rgb(16, 24, 35);
}
.sidebar__content
{
color: rgb(238, 234, 232);
}
.sidebar__content h1
{
font-size: 2em;
text-align: center;
}
/*Responsive*/
#media only screen and (max-width: 480px)
{
/*small devices smartphone*/
main,
aside
{
grid-column: 1 / span 5;
}
}
<!DOCTYPE html>
<html>
<head>
<meta name = "viewport" content="width=device-width , initial-scale=1.0">
<meta name = "viewport" content ="heigth=device-height , initial-scale=1.0">
<link rel="stylesheet" href="css/Style2.css">
<link rel="icon" type="image/x-icon" href="img/valo_logo.ico" />
<title>sova</title>
</head>
<body>
<header>
<nav>
<ul>
<li>Home</li>
<li>Agents
<ul>
<li>Jett</li>
<li>Sova</li>
<li>Raze</li>
</ul>
</li>
<li>OverOns</li>
<li>Contact</li>
</ul>
</nav>
</header>
<main>
<div class = "abilitylist">
<ul class = "abilities">
<li class = "ability">
<img src = "img/sova/Sova_Q.png">
<div class = "abilitytekst">
Q-Shock Bolt EQUIP a bow with a shock bolt. FIRE to send the explosive forward,<br>
Rdetonating upon collision and damaging players nearby.<br>
HOLD FIRE to extend the range of the projectile.<br>
ALTERNATE FIRE to add up to two bounces to this arrow.
</div>
</li>
<li class = "ability">
<img src = "img/sova/Sova_E.png">
<div class = "abilitytekst">
E-Recon Bolt EQUIP a bow with a recon bolt. FIRE to send the recon bolt forward, activating upon collision<br>
and revealing the location of nearby enemies caught in the line of sight of the bolt.<br>
HOLD FIRE to extend the range of the projectile.<br>
ALTERNATE FIRE to add up to two bounces to this arrow.E-Tailwind INSTANTLY propel Jett in the direction she is moving.<br>
If Jett is standing still, she will propel forward.
</div>
</li>
<li class = "ability">
<img src = "img/sova/Sova_C.png">
<div class = "abilitytekst">
C-Owl Drone EQUIP an owl drone. FIRE to deploy and take control of movement of the drone.<br>
While in control of the drone, FIRE to shoot a marking dart. <br>
This dart will reveal the location of any player struck by the dart.
</div>
</li>
<li class = "ability">
<img src = "img/sova/Sova_X.png">
<div class = "abilitytekst">
X-Hunters Fury EQUIP a bow with three long-range wall-piercing energy blasts. FIRE to release an energy blast in a line<br>
in front of Sova, dealing damage and revealing the location of enemies<br>
caught in the line. This ability can be RE-USED up to two more times while the ability timer is active.
</div>
</li>
</ul>
</div>
</main>
<aside>
<div class="sidebar">
<div class="sidebar__content">
<span>
<h1>Sova</h1>
<img src="img/sova_avatar.jpg">
<h3>Role: Controller</h3>
<hr class = "lijn">
<h3>
Biography:<br>
Born from the eternal winter of Russia's tundra, Sova tracks, finds,
and eliminates enemies with ruthless efficiency and precision.
His custom bow and incredible scouting abilities ensure that even if you run, you cannot hide.
</h3>
</span>
</div>
</div>
</aside>
<footer class = "footer">
<div class = "Information">
<h1>Contact and Information</h1>
<ul>
<li>Contact us</li>
About us
<li></li>
</ul>
</div>
<div class = "agentsfooter">
<h1>Agent Guides</h1>
<ul>
<li>Jett guide</li>
<li>Raze guide</li>
<li>Sova guide</li>
</ul>
</div>
</footer>
</body>
</html>
I think that the snippet is not the best to test this html code, so you can click on this link too https://codepen.io/zerbene/pen/mdERRjQ

How to fix mat-list-item not taking full space of row

Hello guys I rendering an article.component.html inside my article-list-component.html in a list when I do it in plain HTML it renders just fine (see picture 1):
Title - author - Date
Here is my article-list.component.html
<ul>
<li *ngFor="let article of data_array">
<a [href]="article.url" class="undecorateda" target="_blank">
<app-article [data]='article'></app-article>
</a>
</li>
</ul>
but when I try to use angular-material list the component renders all to the left like this (see picture 2):
Title-author-Date
Here is my article-list.component html:
<mat-list>
<mat-list-item *ngFor="let article of data_array">
<a [href]="test">
<app-article [data]='article' (click)="printURL(article.url)"></app-article>
</a>
</mat-list-item>
</mat-list>
when I use the plain HTML in the article-list.component.html it renders as I want it to do, but if I use the material code inside article-list.component.html it doesn't render properly
this is the article.component.html
<div class='article-container'>
<div class='title-container'>
{{data.title}}
<div class='author-container'>
-{{data.author}}-
</div>
</div>
<div class='date-container'>
{{formatDay(data.created_at)}}
</div>
<div class="actions-container" id="deletebtn">
<button mat-icon-button color="warn" (click)="deleteArticle(data._id)">
<mat-icon>delete_forever</mat-icon>
</button>
</div>
</div>
this is the article.component.css file:
.article-container {
display: grid;
grid-auto-flow: column;
grid-template-columns: 10fr 2fr 1fr;
height: 50px;
background-color: #fff;
border-bottom: 1px solid #ccc;
align-items: center;
padding: 0 15px;
}
.article-container>* {
grid-row: 1/2;
}
.article-container #deletebtn {
display: none;
}
.article-container:hover {
background-color: #fafafa;
}
.article-container:hover #deletebtn {
display: block;
}
.title-container {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
color: #333;
font-size: 13pt;
}
.author-container {
color: #999;
font-size: 10pt;
margin-top: 3px;
}
.date-container {
color: #333;
font-size: 13pt;
}
.title-container div {
padding: 0 15px;
}
Basically what I want is to use material-angular list inside the article-list.component.html and that it render good like in picture 1
==========================================
If you add a width of 100% to the article component itself it should ensure the component takes the whole width and the list will the whole width as well.
:host {
width: 100%;
}
Take a look at this example here to see the list taking 100% of the width.

Locating 5 row of grid at the center (with picture)

I am using Next.js and SCSS and trying to locate 5 & 3 rows of images at the center of the page with responsive grid system.
I just need to slightly adjust images location to the right side but contents do not move at all.
here is the code :
Next.js
// So basically ui.container wraps up li.item which are images.
<ul className="container">
{stores.map(store => (
<li onClick={this.open} key={store.id} className="item">
<img
src={store.thumb}
onClick={() => this.storeDetail(store.id)}
/>
</li>
))}
</ul>
SCSS
section {
background: pink;
}
.store-list-title {
text-align: center;
padding-top: 2rem;
font-size: 3rem;
}
.container {
display: grid;
grid-gap: 1rem;
grid-template-columns: repeat(5, 200px);
}
Add justify-content:center for aligining center
.container {
display: grid;
grid-gap: 1rem;
grid-template-columns: repeat(5, 50px);
justify-content: center;
}
So the solution I found on youtube is using mixin function in SCSS.
It needs calculation so I am still looking at it to understand how it works.
I would be appreciated if someone explains how it works
item element and mixin
#mixin grid($cols, $mgn) {
float: left;
margin-right: $mgn;
margin-bottom: $mgn;
width: ((100% - (($cols - 1) * $mgn)) / $cols);
&:nth-child(#{$cols}n) {
margin-right: 0;
}
}
.item {
#include grid(5, 2%);
img {
width: 100%;
}
}
li tags
{stores.map(store => (
<li onClick={this.open} key={store.id} className="item">
<img
src={store.thumb}
onClick={() => this.storeDetail(store.id)}
alt={`${store.name} image`}
/>
</li>
))}

Styling list elements with Flexbox

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>