0

I am currently working on a practice website based off of the off-white website (https://www.off---white.com/en/US). A problem I am facing is when attempting to position the top tabs that being Shop, More, About, & Contact it moves the off-black™ text I have next to them. Is there anyway I can move the others to the right of the screen and leave the off-black™ on the left?

I have tried multiple things ranging from my own experimentation to reaching the 4th page of google.

My HTML

<div class="web-top">
  <div id="web-top-title">
    <p class="web-top-title-text">Off-Black™</p>
  </div>
  <div id="web-top-shop">
    <p class="web-top-shop-text">Shop</p>
  </div>
  <div id="web-top-more">
    <p class="web-top-more-text">More</p>
  </div>
  <div id="web-top-about">
    <p class="web-top-about-text">About</p>
  </div>
  <div id="web-top-contact">
    <p class="web-top-contact-text">Contact</p>
  </div>
</div>

My CSS

/* Full Page Styling */
body {
    padding:0px;
    margin:0px;
}

/* Top Header Styling */
.web-top {
    color:white;
    background-color:blue;
    width:100%;
    height:22px;
    display:block;
    margin-top:0px;
}

#web-top-title, #web-top-shop, #web-top-more, #web-top-about, #web-top-contact {
    margin-top:-14px;
    float:left;
}

.web-top-title-text {
    margin-left:10px;
}
1
  • Welcome. Please read How to Ask, and minimal reproducible example, with the focus on clear problem statement. "Confusing CSS Positioning" is not a very clear problem statement. Commented Sep 27, 2019 at 2:55

2 Answers 2

1

You can use display: flex; and apply flex-grow for getting this UI.

/* Full Page Styling */

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


/* Top Header Styling */

.web-top {
  color: white;
  background-color: blue;
  width: 100%;
  display: flex;
  align-items: center;
}

#web-top-title {
  flex-grow: 1;
  margin-left: 10px;
}

#web-top-shop,
#web-top-more,
#web-top-about,
#web-top-contact {
  margin-right: 10px;
}
<div class="web-top">
  <div id="web-top-title">
    <p class="web-top-title-text">Off-Black™</p>
  </div>
  <div id="web-top-shop">
    <p class="web-top-shop-text">Shop</p>
  </div>
  <div id="web-top-more">
    <p class="web-top-more-text">More</p>
  </div>
  <div id="web-top-about">
    <p class="web-top-about-text">About</p>
  </div>
  <div id="web-top-contact">
    <p class="web-top-contact-text">Contact</p>
  </div>
</div>

Sign up to request clarification or add additional context in comments.

5 Comments

That exactly what I needed. I am still wondering though now that they are over there how would I go about separating them from each other?
you mean spacing?
Yes. How would I go about spacing them from each other.
updated the code. I have taken off the height as i guess this is what you are after
Yes, that is exactly what I was looking for. Thank you for the help.
0

You could float the elements you want on right to right

  .web-top {
    color:white;
    background-color:blue;
    width:100%;
    height:22px;
    display:block;
    margin-top:0px;
}
/* Top Header Styling */

 #web-top-title{
   float:left;
   margin-top:-14px;
   margin-left:10px;
 }

#web-top-shop,#web-top-more ,#web-top-about,#web-top-contact{

    float:right;
    margin-top:-14px;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.