How can I align elements to the left and right in the same line without floats?
You can use some flexbox magic: h1 { display: flex; justify-content: space-between; } <h1> <span>Align me left</span> <a href=””>align me right</a> </h1>
You can use some flexbox magic: h1 { display: flex; justify-content: space-between; } <h1> <span>Align me left</span> <a href=””>align me right</a> </h1>
Try something like this… <div id=”wrapper” style=”width:100%; text-align:center”> <img id=”yourimage”/> </div>
you can use display flex it enables a flex context for all its direct children, and with flex direction establishes the main-axis, thus defining the direction flex items are placed in the flex container div{ height: 400px; width: 800px; background: red; display: flex; flex-direction: column; justify-content: center; text-align: center; }
You could simply put a span or div tag around your text inside md-grid-tile: <md-grid-tile> <div class=”text-inside-grid”>{{ video.title }}</div> </md-grid-tile> and then style it: .text-inside-grid { position: absolute; left: 5px; }
You can use some flexbox magic: h1 { display: flex; justify-content: space-between; } <h1> <span>Align me left</span> <a href=””>align me right</a> </h1>
Bootstrap 4 has added new css classes for this purpose: <p class=”text-sm-right”>Right aligned text on viewports sized SM (small) or wider.</p> <p class=”text-md-right”>Right aligned text on viewports sized MD (medium) or wider.</p> <p class=”text-lg-right”>Right aligned text on viewports sized LG (large) or wider.</p> <p class=”text-xl-right”>Right aligned text on viewports sized XL (extra-large) or wider.</p>
Here’s a cross-browser method that works in IE6+ It combines text-align-last: justify; which is supported by IE and a variation of the :after pseudo-content method. It includes a fix to remove extra space added after one line text elements. CSS: p, h1{ text-align: justify; text-align-last: justify; } p:after, h1:after{ content: “”; display: inline-block; width: 100%; … Read more
Solution with display inline-block This adaptive grid is much simpler : less markup and less CSS so it will be easier to implement in a production site and adapt to your exact needs. =>> DEMO <<= (resize the result window to see the effect) html, body { margin:0; padding:0; } #container{ font-size:0; margin:0 auto; width:1000px; … Read more
Updated the “Future” solution info below; still not yet fully supported. Present Workaround (IE8+, FF, Chrome Tested) See this fiddle. Relevant CSS .prevNext { text-align: justify; } .prevNext a { display: inline-block; position: relative; top: 1.2em; /* your line-height */ } .prevNext:before{ content: ”; display: block; width: 100%; margin-bottom: -1.2em; /* your line-height */ } … Read more
I assume you want all the items next to each other, and the whole thing to be centered horizontally. li elements are display: block by default, taking up all the horizontal space. Add div#footer ul li { display: inline } once you’ve done that, you probably want to get rid of the list’s bullets: div#footer … Read more