2016-04-01 13 views
0

Bir görüntünün bir div'in sağ üst köşesinde olmasını sağlamak istiyorum, bunu nasıl başarabilirim? Lütfen yardım edin. I want to style this to reflect this screenshotBir divanın sağ üst köşesinde olması için bir görüntü tasarlayın

<html> 
<head> 
    <style> 
     .first{ 
      width: 200px; 
      height: 200px; 
      color: blue; 
      border: blue; 
      border-style: solid; 
      border-color: blue; 
      background: blue; 
     } 
    </style> 
</head> 

<body> 
<div class="first">testing this forum 
</div> 
</body> 
</html> 

cevap

1

div { 
 
    height: 175px; 
 
    width: 175px; 
 
    background: blue; 
 
    position: relative; 
 
    /* Additionally padding? */ 
 
} 
 

 
div > img { 
 
    height: 25px; 
 
    width: 25px; 
 
    position: absolute; 
 
    top: 0px; right: 0px; 
 
    /* Change top < 0 and right < 0 to be outside */ 
 
}
<div> 
 
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque velit elit, tempus non suscipit id, pretium a mi. Aliquam erat volutpat. 
 
    <img src="http://maciejczyzewski.me/assets/images/prints/head.jpeg" /> 
 
</div>

İlgili konular