Çözüldü CSS'te bir itemin bulunduğu pozisyonu ayarlamak

Bu konu çözüldü olarak işaretlenmiştir. Çözülmediğini düşünüyorsanız konuyu rapor edebilirsiniz.

deezwend

Hectopat
Katılım
28 Haziran 2021
Mesajlar
294
Çözümler
4
Daha fazla  
Cinsiyet
Erkek
Merhaba. CSS'te bir paragraf'ı bir butonun sol tarafına koymaya çalışıyorum fakat o butonu önceden margin-left ile konumlandırdığım için o margin'in kapladığı alana girdiğinden dolayı yazıyı tam olarak istediğim pozisyona koyamıyorum. Nasıl yapabilirim?

1660414110324.png



Kodlarım:
CSS:
body
{
    background-color: rgba(24,24,24,255);
}
.videotitle
{
    font-family: Roboto;
    font-size: 25px;
    font-weight: 400;
    margin-left: 75px;
    margin-top: 475px;
    transition: color 1s, font-size 1s, margin-top 1s;
    color: white;
}
.videotitle:hover
{
    color: rgb(172, 62, 62);
    margin-top: 480px;
    cursor: pointer;
    font-size: 26px;
}

.view-publishdate
{

    font-family: Roboto;
    font-size: 15px;
    color: rgb(164, 162, 162);
    margin-left: 75px;
    margin-top: -5px;
    width: 200px;
    transition: color 1s, font-size 1s, margin-top 1s;
}

.view-publishdate:hover
{
    font-size: 15.9px;
    cursor: pointer;
}

.channel-name
{
    background: blue;
    margin-left: 130px;
    margin-top: 25px;
    color: white;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 17px;
    font-weight: 500;
    width: 175px;
    transition: font-size 1s, margin-top 0.55s;
    cursor: pointer;
}

.channel-name:hover
{
    font-size: 18.5px;
    margin-top: 26.5px;
}

.about-video
{
    font-size: 1.2rem;
    margin-left: 45px;
    margin-top: 25px;
    color: white;
    font-family: Roboto, sans-serif;
    width: 450px;
    height: 66px;
    transition: font-size 1s, margin-top 0.55s;
    cursor: pointer;
    line-height: 1.6em;
}

.about-video:hover
{
    font-size: 1.3rem;
    margin-top: 25.5px;
}

.subscribe-button
{
    background-color: red;
    font-family: Roboto;
    font-weight: 500;
    font-size: 14px;
    color: white;
    width: 106px;
    height: 36px;
    margin-left: 538px;
    margin-bottom: 50px;
    border: none;
}

HTML:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>YT</title>
    <link rel="stylesheet" href="textqwe.css">
</head>
<body>
    <p class="videotitle">Talking Tech and Al with Google CEO Sundar Pichai.</p>
    <p class="view-publishdate">3.6M views &#183; 11 months ago</p>
    <br>
    <button class="subscribe-button">SUBSCRIBE</button>
    <p class="channel-name">Ricardo Rodriguez &check;</p>
    <br>
    <pre class="about-video">
Talking tech and Al on the heels of Google I/O.
Also a daily driver phone reveal from Google's CEO.
Shoutout to Sundar!
    </pre>
</body>
</html>
 
Çözüm
Subscribe button ile channel name'i ayrı bir container (div) içerisine alın sorna flex kullanıp yan yana getirin. Aralarındaki mesafe için, justify-content: space-between; kullanabilirsiniz.
Subscribe button ile channel name'i ayrı bir container (div) içerisine alın sorna flex kullanıp yan yana getirin. Aralarındaki mesafe için, justify-content: space-between; kullanabilirsiniz.
 
Çözüm

Bu konuyu görüntüleyen kullanıcılar

Technopat Haberler

Yeni konular

Geri
Yukarı