Button spacing

Asked

Viewed 10,413 times

3

I want to reduce the spacing of these buttons but I’m not getting it. I’ve tried to put margin and padding and nothing. I don’t want to use a list. How can I do?

Follow the html code:

<div id="buttonbar">
     <button id="volDn"><img src="images/video/menos.png" id="menos"/></button>
     <button id="volUp"><img src="images/video/mais.png" id="btn-mais"/></button>
     <button id="mute"><img src="images/video/som.png" id="btn-mudo"/></button>
 </div>   

The css:

#buttonbar{
    position: absolute;
    bottom: 0;
    right: 0;
}
  • 1

    You tried to use a negative margin?

  • "Hmmm" I won’t try to stand there

  • friend if I use padding or margin being negative or positive it repositions the image and does not touch the mirroring

  • what spacing do you mean? the distance between one and the other?

  • exactly they are very far apart one another wanted to join them more by remembering that they are inline or be one on the other side

  • 1

    #volDn{ margin-right

  • didn’t work out, didn’t move the spacing

Show 2 more comments

2 answers

5

You cannot remove the space because the browser places a space character between the buttons (due to a space, line break or indentation in the code itself). Here are two possible and easy-to-implement solutions.

1. Do not leave line break between buttons. The code may get polluted, but it is the simplest solution for very specific cases.

<button ...>...</button><button ...>...</button><button ...>...</button>

2. Utilise float on the buttons. You can add a float: left buttons and use the clearfix in container to not generate problems on page.

/* Utilize classes no lugar de ids para casos mais genéricos */
.buttonbar:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: " ";
    clear: both;
    height: 0;
}

.buttonbar > button {
    float: left;
}

4


Do the following, add this code to the CSS

#buttonbar button{

  margin:-2px;

}

The smaller the number closer to each other

  • 1

    "vlwwwwww" worked well Fight in 6 min I mark as answer accepted

  • @Kirito I’m glad it worked :D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.