I have made some problem to solve. For example, I have two blocks with constant width and display: inline-block
( http://jsfiddle.net/mgs8jLwk/ ). How can I force left one to stay at top? Sorry if it is duplicate of some question.
PS Is there any way to make two or more columns without commenting spaces in html markup?
Add vertical-align: top
to your CSS rule for #one
:
#one
{
display: inline-block;
width: 50px;
height: 50px;
background: blue;
vertical-align: top;
}
Use " vertical-align:top;
" for " #one
" div.
#one {
display: inline-block;
width: 50px;
height: 50px;
background: blue;
vertical-align:top; /*FIX ADDED*/
}
<!-- COMMENT-->
to Remove Space Between DIVS : Add " font-size:0;
" to the parent element:
#wrapper {
margin: auto;
width: 300px;
font-size:0;
}
Here are few more options to get rid of the space between inline-block elements: http://css-tricks.com/fighting-the-space-between-inline-block-elements/
Hope this will help!
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.