मेरे पास <div>
के आसपास है जिसमें कुछ छवियां हैं, <h2>
और टेक्स्ट का अनुच्छेद भी है। <a>
सभी inline-block
हैं। जब भी H2 दो पंक्तियों तक फैलता है तो अगले <a>
ऑफ़सेट होता है। नीचे एक स्क्रीनशॉट है।एच 2 इनलाइन इनलाइन-ब्लॉक अजीब ऑफ़सेट
HTML:
<a href="#">
<div>
<div class="imgOverflow">
<img src="/hello/there">
</div>
<h2>This is the title</h2>
<p>This is a paragraph</p>
</div>
</a>
सीएसएस:
a {
display:inline-block;
font-size:16px;
border:1px solid grey;
width:260px;
margin:5px;
color:black;
overflow: hidden;
}
div {
display:block;
padding:5px;
width:250px;
height:300px;
}
p {
font-size:12px;
text-align:justify;
}
h2 {
margin:5px 0 10px 0;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
}
.imgOverflow {
margin:-5px 0 0 -5px;
width:260px;
padding:0;
overflow:hidden;
height:130px;
display:block;
}
किसी सीएसएस संपत्ति के कुछ प्रकार यह है कि बेहद मददगार होगा से बचने के लिए जानता है। धन्यवाद।
बस एक साइड-नोट: 'div' के अंदर 'divs' nesting खराब अभ्यास है। – Chris