Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I position items/buttons at the top of my page without there being white space between the top of my page and the items?

I’m trying to make a bar of buttons at the top of my webpage that line up and cover the entire top of the screen. It’s mostly working fine except there is always a white space between the top and left of the buttons. I’ve tried using multiple different kinds of CSS tags to remove the white space. Position and top/left have worked for singular buttons but so far, I haven’t found anything that could position all of the buttons with just one or two classes or IDs. Here’s what I have so far:

HTML:

<div class="topButtons">
      <a href=#><button class="buttons"><i>Button 1</i></button></a> 
      <a href=#><button class="buttons"><i>Button 2</i></button></a> 
</div>

CSS:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.topButtons .buttons {
    padding: 2.5% 10%;
    background-color: #04AA6D;
    border: none;
    float: left;
    transition-duration: 0.4s;
    size: 2.5% 10%;
}

>Solution :

Browsers have default settings for some CSS properties.

In particular there may be default settings for margin.

Try putting:

* {
  margin: 0;
  padding: 0;
}

at the top of your CSS stylesheet and then if you want them, add them explicitly to elements as you go along.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading