I've seen a lot of these questions asked but none answered my question. I'm trying to align 2 divs side by side. The divs have the same class as they are pulled dynamically with php. I can't figure out how to align it! Here's the code:
<div class="holder">
<a href="#" class="item">
</a>
<a href="#" class="item">
</a>
</div>
.holder {
float:left;
width:40%;
margin: 0 10px 0 0;
}
.item {
padding:7px;
display:block;
text-decoration:none;
margin:0 0 15px;
}
Use display:inline-block
.item {
padding:7px;
display:inline-block;
text-decoration:none;
margin:0 0 15px;
}
or display:inline
.item {
padding:7px;
display:inline;
text-decoration:none;
margin:0 0 15px;
}
.holder {
float:left;
width:40%;
margin: 0 10px 0 0;
}
.item {
padding:7px;display:inline;
text-decoration:none;
margin:0 0 15px;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.