I'm trying to make some html form with help of bootstrap. Some of my inputs must have no gap from left or right side. But bootstrap .col-XX-Y blocks have gutter via paddings from left and right. So my idea was to use negative margin for my input elements, and display: block. And here I'm stuck. Please refer to this codepen example. I was faced with several strange things for me:
Why input with
display: block
doesn't fill all it's parent container, likediv
does? It fills the container only with:width:100%;
(commentwidth
for red-bordered input in codepen example)Why if I'm apply negative
margin-left
to compensate parent container's left padding, my input shifts to the left, but keeps it's original width (like ifleft
css property was used). Doesn't it have to behave like a block element (e.g.div
): shifts to the left and keep filling of all width of it's parent, excluding right padding?When I'm apply negative right margin for my
input
to compensate parent's right padding, then nothing happens (look my example, compare orange div with red input). Why? What about of a behavior like block element?
If this is normal behavior, can you give me some link to html standard docs with explanations of that.