logo
down
shadow

My nav bar won't center and keeps moving either right or left


My nav bar won't center and keeps moving either right or left

By : user3042524
Date : November 28 2020, 12:01 PM
it helps some times I've been going around the web trying to find an answer to how to center my navbar but none of the solution worked.
code :
ul {
  margin: 0 auto; 
  text-align: center;
}

header {
  background: #ffffff;
  color: #000000;
  padding-top: 30px;
  min-height: 70px;
  border-bottom: #000000 3px solid;
}

header a {
  color: #000000;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 16px;
}

header li {
  float: center;
  display: inline;
  padding: 0 20px 0 20px;
}

header nav {
  margin-left: auto;
  margin-right: auto;
  margin-top: 10px;
  
  margin: 0 auto;
}

header #smcontent a {
  margin: 0;
}

header #smcontent img {
  width: 20px;
}

header .logoimg .center {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 20%;
}

header a:hover {
  color: #cccccc;
  font-weight: bold;
}
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<header>
  <div class="container">
    <div id="smcontent">
      <a href="https://twitter.com/">
        <img src="./images/twitter.png">
      </a>
      <a href="https://facebook.com/">
        <img src="./images/facebook.png">
      </a>
    </div>

    <div class="logoimg">
      <a href="index.html">
        <img class="center" src="./images/portfolio.png">
      </a>
    </div>

    <nav>
      <ul>
        <li class="current"><a href="index.html">Home</a></li>
        <li><a href="story.html">Story</a></li>
        <li><a href="product.html">Product</a></li>
        <li><a href="clinique.html">Clinique</a></li>
        <li><a href="promo.html">Promotions</a></li>
      </ul>
    </nav>
   </div>
</header>
</body>
</html>


Share : facebook icon twitter icon
Cannot center div tried floating to left text align margin:auto just wont work

Cannot center div tried floating to left text align margin:auto just wont work


By : Jack G
Date : March 29 2020, 07:55 AM
I hope this helps you . I think i gave the same solution, in this question of your Can't get right portion of middle to stay on the right ...considering your markup display:table is a better option (if you can ignore IE8-)
display:table is compatible(IE8+) overall with minimal css
code :
 <div class="center" style="display:table">
        <div class="cleft_portion" style="display:table-cell">

        </div>

        <div class="mid_portion" style="display:table-cell">

        </div>

        <div class="cright_portion" style="display:table-cell">

        </div>
    </div>
.center {
    margin: 0 auto; /* u have mentioned only auto here */
    width:1200px;
}
html, body {
    width:100%;
    height:100%;
}
Center "left floated" content (text-align: center; wont work)

Center "left floated" content (text-align: center; wont work)


By : Cath
Date : March 29 2020, 07:55 AM
This might help you Text-align center will work if you use display:inline-block instead of using float
JSfiddle
code :
#content div
{
display: inline-block;
background-color: green;
padding: 10px;        
margin: 10px;
}
Moving a UIImageView from left to center

Moving a UIImageView from left to center


By : pinkrose
Date : March 29 2020, 07:55 AM
this will help target needs to indicate the center of the view: CGPointMake(self.view.center.x, self.view.center.y) Change fillMode removedOnCompletion autoreverses repeatCount to avoid frame changes (final of animation)
Final code:
code :
CGPoint origin = self.headerImage.center;
CGPoint target = CGPointMake(self.view.center.x, self.view.center.y);
CABasicAnimation *bounce = [CABasicAnimation animationWithKeyPath:@"position.x"];
bounce.duration = 1;
bounce.fromValue = [NSNumber numberWithInt:origin.x];
bounce.toValue = [NSNumber numberWithInt:target.x];
bounce.fillMode = kCAFillModeForwards;
bounce.removedOnCompletion = NO;
bounce.autoreverses = NO;
bounce.repeatCount = 0;
[self.headerImage.layer addAnimation:bounce forKey:@"position"];
CGAffineTransform transform = CGAffineTransformMakeScale(1.3, 1.3);
self.headerImage.transform = transform;
How to move screen left/right or center it horizontally without moving cursor in vim?

How to move screen left/right or center it horizontally without moving cursor in vim?


By : Patsy Mutiso
Date : March 29 2020, 07:55 AM
will be helpful for those in need I don't know about centering the screen horizontally around the cursor, but as far as moving the screen half a screen left/right, try this (from :help scroll-horizontal)
code :
zL          Move the view on the text half a screenwidth to the
            right, thus scroll the text half a screenwidth to the
            left.  This only works when 'wrap' is off.  {not in
            Vi}


zH          Move the view on the text half a screenwidth to the
            left, thus scroll the text half a screenwidth to the
            right.  This only works when 'wrap' is off.  {not in
            Vi}
When I try to use container-fluid centered form is moving to the left. How to keep it in the center?

When I try to use container-fluid centered form is moving to the left. How to keep it in the center?


By : Soumo
Date : March 29 2020, 07:55 AM
like below fixes the issue , Use margin: 0 auto; for center the element
code :
.card.card-signin.my-5 {
  background-color: rgba(255, 255, 255, 0.6);
  margin: 0 auto;
}
Related Posts Related Posts :
  • Unable to display 3 columns in same row in printed page using bootstrap
  • How to achieve selection of radio element on click of label
  • Heading elements appearing below content
  • How do I position a side section or div in relation to nav bar?
  • How to maintain button location regardless of image size
  • Flex Layout not following flex percentages
  • Some images not working in `background-image:url()`
  • How to add an icon preview to a html list of google store apps?
  • How to hide element overflow without cropping inline images/text?
  • Margin-Top is not working for me when attempting to adjust the location of a button
  • When I send a letter to the mail gives an error 'tuple' object has no attribute 'get'
  • How can i intentionally access the "Index of /" page on my local server?
  • Unable to position a image and text side by side using css/html
  • Text not re-displaying on click of button
  • How to use href attribute in a link tag accurately in android?
  • Repeated reference of classes causing text margins to shift
  • Are my home and about links hyperlinking to the right pages?
  • Tinted background image not working with Bootstrap
  • How can I stop my parallax div having a blurred background?
  • CSS hover effect to modify another element is not working
  • why section-testimonial is not placing correctly
  • Why doesn't my media screen query work, I can't make my website responsive?
  • Aligning inline-block elements horizontally
  • How do I display TypeScript code in "<code>" tags in an Angular app?
  • How can I change the color of input tag in a form when focusing on it?
  • How do I put a container in a fixed position with its own overflow?
  • How to fix text-alignment
  • Outlook not displaying a portion of HTML
  • Remove radio button text only with CSS
  • How to use "v-if" in Vue.js to render a <span> only if parent div has a specific property?
  • How to Extract just the Date from Angular Material Datepicker
  • @keyframes not working, I have tried everything i can think of
  • Bootstrap fix form to bottom of the page
  • How to hide a list element in html
  • How to stop repeating image
  • Angular - String interpolation of undefined variable
  • Is there any way to edit specific Column of table using mat-table in Angular material
  • How can I set a text as a shadow for a heading element?
  • How to fix the forms making the buttons overlap
  • Splitting XML into multiple HTML pages with XSLT?
  • How to justify empty divs in flex container
  • How to blur in CSS only one layer of when you have multiple layers in background-image?
  • Scrollable html table with fixed first row and first column, along with angular material controls within the cells of ta
  • In Django, how to extract ID attribute from html Input tag, WITHOUT using django forms
  • how to fix link tag in html after changing css
  • How do I add a top padding to the second row?
  • Is it possible to split XML into multiple HTML pages with page navigation?
  • AngularJS: responsive height in bootstrap
  • Hide second line of text with CSS
  • repeating-linear-gradient not working in Edge browser and internet Explorer Browser
  • how to make search and form category merges like amazon on bootstrap
  • Bootstrap: Rearranging rows into columns and changing the order of elements
  • How can I move a label under a text box?
  • How save LinearGradient To database
  • How to reposition an image with a linear gradient using css?
  • HTML audio will not play when page opened by batch file
  • CSS Three Tone Diagonal Background
  • How to use slots inside of template components in HTML
  • Using span tags in meta description & title, for dual languages
  • How to make an icon/span selectable by pressing Tab key?
  • shadow
    Privacy Policy - Terms - Contact Us © festivalmusicasacra.org