HTML / CSS help me PLEASE

Status
This thread has been locked.

EpicFooF

Digital Artist
Premium
Feedback score
13
Posts
1,438
Reactions
520
Resources
2
hi, I started learn how to use html and css and I need help now.

image.png

I want to have small space between them, and I want them to stick to the right side.
How do I do that?!?!

HTML:
<html>
<head>
    <title>epicFooF</title>
    <style type="text/css">
    body {
        background-color: #00cacc;
    }
    .menu li {
        list-style-type: none;
        float: left;
        width: 20%;
        position: relative;
        text-align: right;
        font-family: "Trebuchet MS";
        font-size: 30px;
        box-sizing: border-box;
    }
    .menu li {
        color: white;
    }
    </style>

</head>
<body>
    <div class="container">
         <ul class="menu">
             <li><a href="">Home</li>
             <li><a href="">About</li>
             <li><a href="">Portfolio</li>
             <li><a href="">Pricing</li>
             <li><a href="">Contact</li>
         </ul>
    </div>

Tnx for anyone who will try to help me ! :)
 
Last edited:
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

TomConn

A slimey guy
Premium
Feedback score
0
Posts
329
Reactions
102
Resources
0
Hmm... I don't know if you're already using the site, or know it but: http://www.w3schools.com/html/html_layout.asp is a great help to stuff like this.

Also - I've heard from one of my friends that you can usually re-use / copy nearly anything into the next line you write.
So it's just a guess but maybe you could take:

Code:
<body>
<div class="container">
<ul class="menu">
.menu li {
float: left;
}

Again: If it dosen't work - I'm not a genius on this, but I recommend you to maybe ask on the website I linked you to ;)
 

EpicFooF

Digital Artist
Premium
Feedback score
13
Posts
1,438
Reactions
520
Resources
2
Hmm... I don't know if you're already using the site, or know it but: http://www.w3schools.com/html/html_layout.asp is a great help to stuff like this.

Also - I've heard from one of my friends that you can usually re-use / copy nearly anything into the next line you write.
So it's just a guess but maybe you could take:

Code:
<body>
<div class="container">
<ul class="menu">
.menu li {
float: left;
}

Again: If it dosen't work - I'm not a genius on this, but I recommend you to maybe ask on the website I linked you to ;)
I have already done that but it doesnt work, anyways, tnx and I will go to that website, tnx.
 

morganjp

Retired Staff Member
Supreme
Feedback score
6
Posts
494
Reactions
755
Resources
0
Personally I find the best way is to display your list items as inline blocks. Although there a million methods of doing this, and there's no right or wrong way - so choose whatever suits you best and whichever you find the easiest to understand.
HTML:
<html>
<head>
    <title>epicFooF</title>
    <style type="text/css">
    body {
        background-color: #00cacc;
    }
    .menu li {
        display: inline-block; /* Display as inline block */
        list-style-type: none;
        width: 20%;
        height: 50px; /* Set a height for each block */
        margin-right: 30px; /* Spacing to the right in pixels */
        position: relative;
        text-align: right;
        font-family: "Trebuchet MS";
        font-size: 30px;
        box-sizing: border-box;
        color: white;
    }
    </style>

</head>
<body>
    <div class="container">
         <ul class="menu">
             <li><a href="">Home</li>
             <li><a href="">About</li>
             <li><a href="">Portfolio</li>
             <li><a href="">Pricing</li>
             <li><a href="">Contact</li>
         </ul>
    </div>
 

Mahan

Premium
Feedback score
13
Posts
243
Reactions
74
Resources
0
You have width set to 20% which is the reason there is such a huge space between them. you should make width to be auto and add padding like padding: 10px 20px; This will put a reasonable space around each text.
and to align to the right just put float: right on the ul
 

EpicFooF

Digital Artist
Premium
Feedback score
13
Posts
1,438
Reactions
520
Resources
2
You have width set to 20% which is the reason there is such a huge space between them. you should make width to be auto and add padding like padding: 10px 20px; This will put a reasonable space around each text.
and to align to the right just put float: right on the ul
ty
 

Mahan

Premium
Feedback score
13
Posts
243
Reactions
74
Resources
0
Status
This thread has been locked.
Top