Как сделать фиксированное расстояние для картинки

Рейтинг: 0Ответов: 1Опубликовано: 23.02.2023

Как сделать так чтобы текст начинался справа от линии не в зависимости от того какого размера картинка введите сюда описание изображения

HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MyFirstSite_copy_2_2</title>
<link rel="stylesheet" href="style.css">
<header>

    <h1 class="headerTitle">Influencers</h1>

    <h4 class="headerLinks">
        <a href="#">Home</a>
        <a href="#">Contact</a>
        <a href="#">About</a>

    </h4>

</header>


<div class="about_person">

    <h2 class="personName">Egor Chulkov</h2>
    <p class="personQualification">German coach</p>

    <div class="person_info">

        <img class="person_img" src="Egor.png" alt="">    

        <div class="person_description">
            <h2>About Egor</h2>
            <p>Egor its a German language coach<br>
                Expirience:6 years
                Goethe certificat:C2
                Skype:1 hour
                Price:55$
            </p>
        </div>

    </div>

</div>

  <div class="about_person">

    <h2 class="personName">Michail Raduga</h2>
    <p class="personQualification">Faze state</p>

    <div class="person_info">

About Michail

Michail its a faze state practic.He also have a book and teach people how to get in luquid dream

Expirience:22 years

Book: Faze

Price:12.6$

    </div>

</div>

CSS

    body {
    background-color:#171717;
    color:white;
}

header {
    height: 100px;
    background-color: #303030;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-right:30px;
    margin-right: 5%;
    margin-left: 5%;
    box-shadow: 5px 3px 5px 2px #000000;
}


.headerTitle {
    position: absolute;
    margin-right: 40%;
}

a {
    color: white;
    text-decoration: none;
    margin-right: 16px;
}

a:hover {
    color: #808080;
}




.personName {
    padding-left: 4%;
    font-size: 32px;
    margin: 0;
    margin-top: 4%;
    margin-bottom: 0.5%;
}

.personQualification {
    padding-left: 4%;
    color:red;
    margin: 0;
    font-family: Arial;
    font-size: 20px;
}

.person_info {
    display: flex;
    justify-content: flex-start;
    background-color: #303030;
    margin-left: 4%;
    margin-right: 4%;
    margin-top: 0.5%;
}

.about_person img {
    width:50%;
    object-fit: contain;
    max-height: 450px;

}



.person_description * {
    margin: 0;
}

.person_description h2 {
    font-size: 28px;
    margin-left: 2%;
    margin-top: 1%;
}

.person_description p {
    font-size: 18px;
     margin-left: 2%;
}

Ответы

▲ 0

Необходимо задать максимальное расстояние width (ширина) картинки

.about_person img {
width: 100%;
max-width:50%;
object-fit: contain;
max-height: 450px;
}