logo
down
shadow

Vertically Stretch List Items


Vertically Stretch List Items

By : user2956062
Date : November 22 2020, 10:54 AM
this one helps. I suggest using the display: table family of CSS3 rules. They'll be dynamic and maintain full height spacing if done correctly:
code :
body, html {
    height: 100%;
    margin: 0;
}

ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: table;
    width: 100%;
    height: 100%;
}

ul li {
    display: table-row;
}

ul li a { /* assuming an anchor child.  Can be anything */
    display: table-cell;
    vertical-align: middle;
    padding: 1em 3em;
}


Share : facebook icon twitter icon
How to stretch a div vertically to the footer, and stretch to fit content?

How to stretch a div vertically to the footer, and stretch to fit content?


By : wu tassel
Date : March 29 2020, 07:55 AM
it helps some times Try this layout and see if it works for you.
http://jsfiddle.net/TCdsK/14/
CSS Flex: flex items stretch vertically and text centered

CSS Flex: flex items stretch vertically and text centered


By : Jeff
Date : March 29 2020, 07:55 AM
Does that help I have updated your Plunker[1] Plunker. Please review and let me know is this what you need.
I have added flex-container to the orange div, so that the height will be height of the container
Make flex items stretch full height and vertically center their content

Make flex items stretch full height and vertically center their content


By : Pavel Hamřík
Date : March 29 2020, 07:55 AM
around this issue Unfortunately, it is impossible to achieve the desired effect while using the exact markup posted in the question.
The solution involves:
code :
<ul> flex-parent, direction=row
 ├ <li> flex-item && flex-parent && background && JavaScript clickable area
 │  └ <div> flex-item as a single transparent element
 │     ├ Actual contents
 │     └ Actual contents
 ├ …
/* New code: this is the solution. */
ul > li {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Old code below. */
ul {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}
ul > li {
  flex-grow: 1;
  flex-shrink: 0;
  flex-basis: 5em;
  text-align: center;
}
ul > li:nth-child(2) {
  background: #CFC;
}

/* Visual styles, just ignore. */
html, body { font-family: sans-serif; font-size: 25px; }
ul, li { list-style: none; margin: 0; padding: 0; }
ul { background: #CCF; width: 25em; }

button:focus + ul {
    font-size: 14px;
    width: auto;
}
<button>Click here to set <code>width: auto</code> and reduce the font size.</button>

<!-- New code: there is a single <div> between each <li> and their contents. -->
<ul>
  <li><div>Sample</div></li>
  <li><div><span>span</span></div></li>
  <li><div><span>multiple</span> <span>span</span></div></li>
  <li><div>text <span>span</span></div></li>
  <li><div>multi<br>line</div></li>
</ul>
Why my flex items don't stretch vertically?

Why my flex items don't stretch vertically?


By : Raj
Date : March 29 2020, 07:55 AM
it fixes the issue I'm trying to make a navbar, but not all my
  • stretch vertically. Currently only the
  • with

    is fully stretched vertically inside the container but there is white space to the left of it somehow though. The remaining
  • have white space above and below them. How do i make them stretch to take all vertical space (centered)?
    code :
    body, h1 {
        margin: 0;
        padding: 0;
    }
    header {
        max-width: 760px;
        margin: 0 auto;
        
    }
    header ul {
        display: flex;
        border: 5px solid black;
        align-items: stetch;
        margin: 0;
        padding: 0;
    }
    
    header ul li {
        background-color: bisque;
        flex: 1;
        text-align: center;
        list-style-type: none;
        border: 3px solid orange;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    <!DOCTYPE html>
    <html>
    
    <head>
      <title>Jenga Home</title>
      <link rel="stylesheet" href="styles.css" type="text/css">
    </head>
    
    <body>
      <header>
        <ul>
          <li>
            <h1>homepagio</h1>
          </li>
          <li>
            Home
          </li>
          <li>
            Werk
          </li>
          <li>
            Contact
          </li>
          <li>
            Disclaimer
          </li>
        </ul>
      </header>
      <section>
      </section>
      <footer>
      </footer>
    </body>
    
    </html>
  • Getting flex items to stretch and vertically center content at the same time?

    Getting flex items to stretch and vertically center content at the same time?


    By : shaik. parveen
    Date : March 29 2020, 07:55 AM
    With these it helps You can make the parent flex and that will put the children in columns in the row, stretched by default. Then you can make the children flex, too, and use align-items: center to center their contents. Depending on what's actually in the content in each column, you might want to wrap the content in an element like a div so that the div is centered and the content inside of it is treated normally.
    code :
    .u-flex, .u-flex > div {
    display: flex;
    }
    
    .u-flex > div {
    align-items: center;
    }
    <div class="u-flex u-height-4rem u-flex-align-items-center">
      <div class="u-width-25rem u-padding-left-3rem u-padding-right-3rem" style="background:red">u-background-color-gray-{{weight}}<br>foo<br>bar<br>foo<br>bar</div>
      <div class="u-background-color-gray-{{weight}} u-width-100" style="background:grey">asdf<br>asdf<br>asdfasdf<br>asdf<br>asdfasdf<br>asdf<br>asdfasdf<br>asdf<br>asdf</div>
    </div>
    Related Posts Related Posts :
  • How to change add and remove active class in JavaScript
  • how to toggle a specific div in javascript
  • How to get all the values from multiple keys of an array of object?
  • jQuery bind() unbind() and on() and off()
  • regular expression to find DD Month YYYY from a string
  • How to upload files from web client (HTML/jQuery form) to your Dropbox folder
  • Backbone history and require.js issue
  • Confusion over Classical and Prototypal Inheritance Javascript
  • How to take screen shot of current webpage using Javascript/JQuery?
  • Store meridiem in a variable
  • class declared inside closure vs standard class without closure
  • javascript confirm box always return true
  • dynamically changing the size of font size based on text length using css and html
  • Node.js - Getting the host IP address while on Amazon EC2
  • Confusing CSS, can anyone explain please
  • How to install v8-profiler on Windows 8 (64 bit) using npm?
  • Resolve promise based on another promise
  • google maps adding overlay layer above UI and markers
  • Style specific letter?
  • RangeError: Maximum call stack size exceeded with array.slice
  • node rest client get with local variable
  • If condition not executes while mouse move fastly
  • Count the number of displayed elements in a HTML list
  • Locate JavaScript source code in Emacs
  • Clean, Modular Code vs MV* Frameworks
  • infinite scroll without loading image
  • Backbone: reverse collection order with comparator
  • What do printers ignore?
  • jQuery UI .tabs() Contentless tab?
  • Execute Javascript alert() after page (visually) loaded
  • JavaScript - duplicating array doesn't work
  • Excessive clickable area below image
  • JavaScript Regex: Replace |b| with <b>
  • Unexpected value change in 2D array in JavaScript
  • Function doesnt see parameter as a array of objects
  • jQuery fetch keypress event on chrome and IE
  • How to enable jquery validate localization?
  • Cassandra map collection returned by node.js Helenus looks odd
  • angular ng-repeat with multiple filter options
  • Selecting Children without ID or Class names
  • How to uncheck a group of checkboxes when another checkbox is checked
  • Is hiding content by Javascript or jQuery Worth trying
  • Load XUL resource using javascript
  • XML to HTML text area from server file system
  • set focus() on textbox on form onload
  • es lint '' is assigned a value but never used' eventhough i have used it
  • Can "name" attribute be used for custom VueJS components
  • Get innerHTML of content when it is clicked
  • HTTPS causes CSS animations to not load? Very confused
  • How to hide other div apart from touched div to the band
  • Is global variable assignment atomic on NodeJS?
  • Datepicker onchangemonthyear beforeshowday
  • trying to render html files using jade but it still adresses it as a jade
  • Google Analytics - Understanding and Dissecting the Snippet: What is | | [ ];
  • Replacing "[aA09.b]." to "[aA09.b]\n" in in JavaScript
  • Why wrap a function definition in an immediate function?
  • Enable / disable jQuery script on switching to different tab in a HTML page
  • how can find return variable value outside anonymous function in node js mysql query function
  • Converting 1 to 0001 in javascript array
  • svg viewbox should not resize the text fontSize?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org