-2

I have a simple menu bar and just want to horizontal spacing between a text and hyperlink. Here is my code:

<div id="rectangle">
<p class="x">Home Page
 <a href="hello">Home</a> <a href="user">user</a></p>
</div>

In the style field, I have

p.x {
        color: white;
        font:25px arial,sans-serif;
        position:relative;
        left:20px;
    }

#rectangle {
        width: 100%;
        height: 70px;
        background: deepskyblue;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 20;
    }

I want to have space betwwen "Home Page" and "Home"/"user".

I appreciate if someone could help me.

user3014926
  • 1,061
  • 7
  • 18
  • 26
  • Its spaces in your html file. You can read about it here[enter link description here][1] [1]: http://stackoverflow.com/questions/12183341/how-to-remove-invisible-space-from-html – Astralian Jan 02 '14 at 23:05

2 Answers2

1

There are several solutions to that.

Try the CSS "margin" or "padding" property.

  1. Margin
  2. Padding
Josh Beam
  • 19,292
  • 3
  • 45
  • 68
0

You can give the <a> some horizontal margin. So you can simply do:

.x a:first-child {
  margin-left: 10px;
  }

However, you probably want to check out how to properly make navigation buttons if that's what you want. Using <nav> you can achieve this in html5.

Francisco Presencia
  • 8,732
  • 6
  • 46
  • 90