Product Landing Page - Build a Product Landing Page

why margin:auto; is not workin for styling .input
?

Your code so far

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

Challenge: Product Landing Page - Build a Product Landing Page

Link to the challenge:

We can’t see your code right now.

<!DOCTIPE html>
<html>
  <head>
    <title>Product Landing</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="styles.css">
  </head>
  <body>
    <div class="header">
    <header id="header">
      <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAApVBMVEUKCiP///8AAAAAABsAAB8AABYAABgGBiEAABoAAB0AAAwAABEAACAAAA4AABMAAAnw8PHi4uX4+Pnt7e+5ub6kpKllZW/T09dZWWWenqPm5ueCgoqqqrDAwMVubniWlp0iIjYuLj9CQlDY2NsYGCu2trvJyc6MjJMzM0N5eYI8PEpsbHZcXGZLS1cRESeIiJAnJzoTEy5GRlAbGzQ4OEoxMT4QECXFKtxSAAANOklEQVR4nO1d63biOAwmJsEkBBJCW1paCpROW3rvzM6+/6Mt10Zy7CSytWf2nPX3sxfHsnWXbHc6Hh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4e/0PEQyFE90/PYo/udibDmHnQUNwtpuuzN8E8rg3E29lsvbgTIeOYMlvOgz3O/zyJ4vwwlfkyk1xjhuI6OOEi4hrVEtHF91w+MqZtjAdn34MG0z+9iWJaTuahxyKN3fd1AAb94xQ+gNmM73vuI3bfJ2DI4HrkPqQTRtdwOvmTs9R0Ozkccdxnk25LyP4YTqhY9t3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xGLTxCgd4FKb8PT+NZFOK/5ZBo7QdoyreNU0bx94zUnXTsEN3jjX6U6WSNiTc1piH0NVqEfVgSaXe4lGFf8UQv/x0dL+pNjcr1ly3kH90qqE/pmiCTk1KzMPhhevhXYpMwvqW11fEbfG7w0P3ZFvHniU9fycdSjmJIbKCVCfKH252GwdtOK7UNT4l1emHgwKRFQvRmkDvc0g1LU/wqCcl2n5bHeJGRCUdbcUfTwRkqtk7a9t4qeSLaR49BELnKetiMDc0V6uEUX/v+adyCNyZd3Bb29z4D1fM+BHg3NFsfpii1TMgLhDifScsodD93TD4htm3tL2ycU/1RtBMFJSAZ4WIZ7YrI3l6h0lTNPvylvsSh9FxfkkRfebzjlkbiLh59oCmotQWBWF0QL5jD3uzWvJHMcPS7aM61QewOg02JT8UlOKnQEDRV0X1SnkEiMV20GlNSBOF9HsyJj6gNsCDllFv1D0jw2ZDJF8lm9JbjoPWjGnJr7H8QdzBa4YTyi0XLqPLOSb4kkRhH86JtFmT7pQ+iDEZPmEC7y8GVOuZkRWJUKa7mUSuLMbjIL6kZ7hXOzlre4VO60QfMVjSPSrze/N1iF/vP0ydigru3wi9tkZ9gOSF6xqwwWdKkOVpdN988Ez79iIhKorvEO1g8W58BT5TadU58jSVsEcvKVZe4AeFAOSr+6nCvuqJt0NEeLkhqR4JaqnR7QkptsuN6rYlxSo43EctMKUdzXZZjDfVkjvNVy2GESaQ2abBjiN1tx9fgdghx2ew/9ZYs0+tYEgUpbBcO2gLFhAuuF84+SrvIdeGgNUATacH1EN82AH8+OXBMj244QCYnxTB+ZrvXZvea+eLIo3+awPLk/oL3pXeZiM1i8fofIHBH4utisRHs3CSj4ZDtjm9H9IZDntdNPDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8aPgH6Ze3tMKVGv4AAAAASUVORK5CYII=" id="header-img">
      <nav id="nav-bar">
        <a class="nav-link" href="courses">courses</a>
        <a class="nav-link" href="timing">timing</a>
        <a class="nav-link" href="video">video</a>
      <nav>
    </header>
    </div>
    <div class="div-2">
    <section class="form-sec">
      <p>best web-site to learn coding</p>
     <form action="https://www.freecodecamp.com/email-submit" id="form">
     <div class="input">
        <input type="email" id="email" name="email" placeholder="email"/>
       <input type="submit" id="submit" value="submit" />
      </div>
     </form>
    </section>
    <section class="vdo-sec">
      <iframe  id="video" width="300px" height="300" src="https://www.youtube.com/embed/kUMe1FH4CHE" title="Learn HTML – Full Tutorial for Beginners (2022)" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
    </section>
    </div>
  </body>

</html>

.
.
.

.header{
  position:fixed;
  background-color:gray;
  width:100%;
  top:0;
  left:0;
  
}


img {
  width:50px;
  height:50px;
 
}
.div-2{
  display:flex;
  flex-direction:column;   
  align-items:center;
  margin:50px 0;
}

p{
  font-size:1.8rem;
}

#nav-bar {
  
  display:flex;
  flex-direction:row;
  float:right;
  align-items:center;
  
}
.input{
  margin:auto;
}
a{
  text-decoration:none;
  color:white;
  font-size:1.5rem;
  margin:10 8px;
}
iframe{
  margin:auto;
}
@media (max-width:200px){

}

it didnt work with align-items so i tried margin:auto; . . . . :smiling_face_with_tear:

what do you mean exactly when you are saying that it is not working?

i wanted to center the .input …put it in the center of screen

well, .input means ‘element with class input’ Oh, i see you have such div. Do you want to center that?

yeah it include two input element

yeah i want to center it … it didnt work with align-items neither with margin-auto;

Your div is a child of some section. This section is not flex-container. And I don’t think you are using grid… So align-items is kind of not good here.

oh thank u that was usefull

i made it child for a flex parent

So it’s all good now?

yeah ! … i had other problem , i wanted to align-items my .nav-bar without givin ‘a’ (anchor) a margin of : margin:10 8px; . . . . . shall i rewrite u the code ?

You can if you want.
But for this one you can just go ahead and experiment with flexbox on your own. That way you will learn bunch of stuff, and you navbar is already flexcontainer.

Just go to MDN and search for
flex-direction
and
flex-wrap
and
justify-content
and maybe
some general info about flex

Oh and also gap

i did my best to align them … okey will look for sollution by myself … thank you

Feel free to ask more stuff in case you will be lost in all this flex shenanigans

oh … thanks lot :innocent: … i’ll in case needed