logo
down
shadow

Horizontally center <li> inside <ul> and keep animation working


Horizontally center <li> inside <ul> and keep animation working

By : Dimitri
Date : November 19 2020, 12:41 AM
With these it helps I'm trying to center all element and keep the animation working. I have tried to remove float:left in
  • and add text-align:center in
      but then the animation falls appart. , add "display: table;" to your ul:
      code :
      #accordion {
          list-style: none;
          margin: 0;
          padding: 0;
          height: 500px;
          overflow: hidden;
          background: #2A2C2D;
          text-align: center;
          display: table;
          margin: 0 auto;
      }
      


  • Share : facebook icon twitter icon
    How can i horizontally center this animation?

    How can i horizontally center this animation?


    By : Bobby Bates
    Date : March 29 2020, 07:55 AM
    Does that help I've got 3 images superposed for a css animation on a link hover. I'm using position:absolute for overlaying the 2 animated images. But then i don't know how i could center the animation on the page. , Add this to your CSS:
    code :
    #avatar {
      text-align:center;
      position:relative;
      width:147px;
      margin:0 auto;
    }
    
    Center horizontally div elements inside bootstrap? (text-center not working)

    Center horizontally div elements inside bootstrap? (text-center not working)


    By : Kevin Gosschalk
    Date : March 29 2020, 07:55 AM
    To fix this issue You can set the .nav.nav-pills li items to flex-grow: 1; which will cause all the list items to expand equally to fill the space. See this fiddle for an example. I also added a snippet below, but it only looks right in full-screen.
    code :
    .options-bar  {
        line-height: 50px;
        width: 100%;
    }
    
    .nav.nav-pills li {
      flex-grow: 1;
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
    <div class="col-md-12 options-bar text-center">
      <ul class="nav nav-pills">
        <li class="normal-li">Ordenar por: </li>
        <li class="dropdown">
          <a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
                            Status <span class="caret"></span>
                            </a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </li>
        <li class="dropdown">
          <a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
                            Clientes <span class="caret"></span>
                            </a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </li>
        <li class="dropdown">
          <a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
                            Fecha <span class="caret"></span>
                            </a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </li>
        <li class="dropdown">
          <a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
                            Productos <span class="caret"></span>
                            </a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </li>
        <li class="dropdown">
          <a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
                            Asignación <span class="caret"></span>
                            </a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </li>
        <li class="normal-li">Ver por: </li>
        <li>
          <input type="radio">
          <label style="color: rgb(46, 116, 241 );">Solicitud</label>
        </li>
        <li>
          <input type="radio">
          <label style="color: rgb(46, 116, 241 );">Producto</label>
        </li>
        <li id="clock"><span class="glyphicon glyphicon-time"></span></li>
        <li>
          <input type="text" class="form-control" placeholder="Buscar solicitudes">
        </li>
      </ul>
    </div>
    How can I center an object horizontally with an animation?

    How can I center an object horizontally with an animation?


    By : Edgar Ortiz
    Date : March 29 2020, 07:55 AM
    I wish did fix the issue. I found the method centerH which puts the element correctly in the center , From what I see, your task translates to
    code :
    function getPositionByOrigin (x, y, originX, originY) {
      const point = new fabric.Point(x, y)
      const center = this.translateToCenterPoint(point, originX, originY)
      return this.translateToOriginPoint(center, this.originX, this.originY)
    }
    
    const fabric = window.fabric;
    
    const canvas = new fabric.Canvas('canvas', {
      background: 'silver',
      centeredRotation: true,
    })
    
    canvas.setWidth(250)
    canvas.setHeight(250)
    
    const textbox = new fabric.Textbox('hello world this is', {
      left: 5,
      top: 200,
      fontSize: 30,
      hasRotatingPoint: false,
      centeredScaling: true,
      centeredRotation: true,
      originX: 'left',
      originY: 'top',
      fixedWidth: 200,
      width: 200,
      angle: -75,
    }).scale(0.65)
    canvas.add(textbox).setActiveObject(textbox)
    
    // grid
    const gridStyle = {
      stroke: 'red',
      strokeWidth: 1,
      selectable: false,
    }
    const center = {
      h: canvas.width / 2,
      v: canvas.height / 2,
    }
    const h = new fabric.Line([ center.h, 0, center.h, canvas.height], gridStyle)
    const v = new fabric.Line([ 0, center.v, canvas.width, center.v], gridStyle)
    canvas.add(h)
    canvas.add(v)
    
    function getPositionByOrigin (x, y, originX, originY) {
      const point = new fabric.Point(x, y)
      const center = this.translateToCenterPoint(point, originX, originY)
      return this.translateToOriginPoint(center, this.originX, this.originY)
    }
    
    // center function
    document.getElementById('center').addEventListener('click', () => {
      const activeElement = canvas.getActiveObject()
      
      const { left, top } = canvas.getCenter()
      const newPosition = getPositionByOrigin.call(activeElement, left, top, 'center', 'center')
      
      const dest = {
        left: newPosition.x,
        top: newPosition.y
      }
      
      activeElement.animate(dest, {
        onChange: canvas.renderAll.bind(canvas),
        easing: fabric.util.ease['easeOutCubic'],
        duration: 500,
      })
    }, { passive: true })
    body {
      margin: 20px;
    }
    
    canvas {
      border: 1px dashed red;
    }
    <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/2.4.2/fabric.min.js"></script>
    <button id="center">center element</button>
    <br/>
    <canvas id="canvas"></canvas>
    Positioning in CSS: Center align a text inside child DIV which is already horizontally & vertically aligned inside p

    Positioning in CSS: Center align a text inside child DIV which is already horizontally & vertically aligned inside p


    By : user2522231
    Date : March 29 2020, 07:55 AM
    I wish this helpful for you I have an inner (child) div inside an outer (parent) div. , used flexbox to achieve it Hope this helps. thanks
    code :
    /* Lesson 3 (PART 1): div inside div */
    
    .outer-lesson3 {
      border: 1px solid lightcoral;
      display: table-cell;
      width: 300px;
      height: 300px;
      vertical-align: middle;
      text-align: center;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .inner-lesson3 {
      border: 1px solid mediumseagreen;
      display: inline-block;
      width: 100px;
      height: 150px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    
    /* Lesson 3 (PART 1) ENDS */
    <html>
    
    <head>
      <link rel="stylesheet" href="prac.css">
    </head>
    
    <body>
      <!-- Lesson 3 -->
      <div class="outer-lesson3">
        <div class="inner-lesson3">
          Horizontally & Vertically Center 'div' inside 'div'
        </div>
      </div>
    </body>
    
    </html>
    Can't horizontally center div inside another div

    Can't horizontally center div inside another div


    By : user3658558
    Date : March 29 2020, 07:55 AM
    will be helpful for those in need You need to make the buttons div take up the whole width so they will center properly. Add width: 100%; to .button-wrap.
    code :
    /* Container4 Styling */
    
    .container4 {
      height: 100vh;
      width: 100%;
      margin: 0;
      background-color: #CDE5E1;
      text-align: center;
    }
    
    
    /* Tab HP Styling */
    
    .one {
      height: 100vh;
      width: 100%;
      margin: 0;
      background-color: red;
      position: relative;
    }
    
    
    /* Tab HP BUTTON Styling */
    
    .content {
      height: 100vh;
      width: 100%;
    }
    
    .button-wrap {
      position: absolute;
      bottom: 0;
      width: 100%;
    }
    
    a.button {
      color: #fff;
      text-decoration: none;
      padding: 15px 50px;
      display: inline-block;
    }
    
    a.active {
      color: black;
      display: inline-block;
    }
    
    div[class*="content-"] {
      display: none;
    }
    
    div.active {
      display: inline-block;
    }
    <div class="container4">
    
      <div class="content">
        <div class="content-1 active one">
          <h1>Content</h1>
    
          <div class="button-wrap">
            <a href="#" class="button">Button1</a>
            <a href="#" class="button">Button2</a>
            <a href="#" class="button">Button3</a>
            <a href="#" class="button">Button4</a>
          </div>
    
        </div>
    
        <div class="content-2 two"> content 2 </div>
    
        <div class="content-2 three"> content 3 </div>
    
        <div class="content-2 four"> content 4 </div>
    
      </div>
    
    </div>
    Related Posts Related Posts :
  • TabIndex - hitting tab moves me to Address Bar - unable to work around this using Focus
  • Create JSON from string, to use as object
  • Jquery - How do I make ifModified:true work in .ajax request?
  • Jquery and create html on the fly
  • jQuery Validation not validating on button click
  • Jquery Draggable/Droppable appending multiple divs
  • jQuery selector not working properly. Possible Sizzle bug?
  • enable anchor in twitter bootstrap modal
  • jQuery keydown : Wait for previous event to finish
  • why magnific popup ajax box closes if clicked on content
  • JQPlot pie charts "jqplotDataClick" event fires multiple times
  • Show div as the page scrolls on div height
  • Keypress event for ajax call does not work
  • responsive/fluid jQGrid with Twitter Bootstrap
  • IE10 does not seem to fire load event
  • Remove tipTip tool tip
  • jquery datepicker changing unavailable dates in one instance
  • TableTools plugin export buttons are not working
  • Prepopulate jquery token input textbox
  • Open a fancybox link with ajax
  • Getting jQuery and AngularJS content assist / auto-complete in eclipse for standalone HTML "file"
  • TR alternate background colour with unequal number of TD
  • DATATABLE jQuery TH and TD alignment
  • Jquery UI Convert Select's to Range Slider
  • Change text in text field according to link that has been clicked
  • Animate addClass + removeClass transitions?
  • knockout ajax call data-BIND
  • How do I create a variable with a number based on an element's number position using jquery?
  • Prevent fixed position element from flickering during jQuery animation
  • points are not visible clearly in nvd3 ghaph
  • How to write a regular expression for IP address format
  • Animate 3 DIVs from right to left when page is loading.
  • How to pivot columns in free jqgrid 4.15.4
  • the jquery method works fine but when made as a function not working
  • Show/hide text doesn't work when targeting link within div
  • multiple autocomplete search input fields
  • Display image in cell using Jquery jTable
  • jQuery and Wordpress - Scripts not working
  • flickering when mouse over, .hover() show/hide div(s)
  • Using Django's JSONResponseMixin to respond to AJAX requests
  • Unable to render charts using Wicked PDF
  • Style to dynamically created elements
  • hover not working for items in list
  • Keep server session alive automatically based on activity / input, using JQuery
  • jQuery load() taking a long time
  • Change / Exchange values in textboxes on text change in jquery
  • Unslider arrow code overriding slider options
  • what is the traditional way of sorting search results?
  • Do the action when the DIV comes in the display area of the browser with jQuery
  • jQuery slideshow overlapping CSS ribbon
  • JQuery animate function dont work
  • problems charts jquery highcharts
  • How to reset the select box values in Jquery sumoselect Multi select plugin
  • css absolute position on top of another element
  • How use jQuery String variable in html body
  • Get a row from table in view on modal bootstrap using codeigniter
  • How to make the effect of a div that covers an other div when scrolling?
  • Data binding using a button
  • How do i replace all dot in string to Underscore?
  • grab non-sibling element with jquery
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org