Home > Mobile >  unable to align items in navbar in css
unable to align items in navbar in css

Time:08-17

i am trying to copy some webpages to learn html and css.when i try to create header like image given below the righ elements which is abastract and helpcenter comes below one another.i want to align those two items horizontally.also i am unable to change font color of the same items

output i want: enter image description here

output i have right now;

enter image description here

[![

*{
    padding: 0px;
    margin: 0px;
   
}

header{

    background-color: black;
    height: 100px;
    
}

.menu{
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding: 20px;
    color: #fff;
    
}

.menu ul {
    list-style: none;   
    
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <header>
        <div >
            <ul>
                <li><a href="#">Abstract</a></li>
                <li><a href="#">Help center</a></li>
            </ul>
            <div >
            <button >Submit</button>
            <button >Signin</button>
        </div>
        </div>
    </header>
    
</body>
</html>

]3]3

CodePudding user response:

I can't access the images. Is this what you're looking for?

* {
  padding: 0px;
  margin: 0px;
}

header {
  background-color: black;
  height: 100px;
}

.menu {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  padding: 20px;
  color: #fff;
}

.menu ul {
  list-style: none;
  display:flex;
}

.menu ul li a{
  color: white;
  text-decoration: none;
  margin: 10px;
}
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <header>
        <div >
            <ul>
                <li><a href="#">Abstract</a></li>
                <li><a href="#">Help center</a></li>
            </ul>
            <div >
            <button >Submit</button>
            <button >Signin</button>
        </div>
        </div>
    </header>
    
</body>
</html>

  • Related