How to vertically aligned to middle with bootstrap? - html

I am trying to create a layout to make two up and down arrows stacks on top of another. Currently the arrows are aligned horizontally. I am not sure how to make it stacked and vertically aligned to middle along with the Title text. How do I do this?
<div class="row">
<div class="col-xs-8">Title</div>
<div class="col-xs-4">
<a href="">
<div class="glyphicon glyphicon-menu-up"></div>
</a>
<a href="">
<div class="glyphicon glyphicon-menu-down"></div>
</a>
</div>
</div>
CSS
.wrapper {
padding:20px;
background-color:green;
color:white;
}
a div {
color:white;
}
https://jsfiddle.net/371yuk1r/2/
Thanks a lot!

One solution without using class from bootstrap is to add display: table-row; to a element like:
html
<div class="row">
<div class="col-xs-8">Title</div>
<div class="col-xs-4">
<a href="" class="arrowVert">
<div class="glyphicon glyphicon-menu-up"></div>
</a>
<a href="">
<div class="glyphicon glyphicon-menu-down"></div>
</a>
</div>
</div>
css
.arrowVert {
display: table-row;
}
fiddle

There are some helper classes in Bootstrap, which you can use for your code.
Check out these link please: http://getbootstrap.com/css/#helper-classes-center

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-xs-8">Title</div>
<div class="col-xs-4">
<a href="#">
<div class="glyphicon glyphicon-menu-up"></div>
</a>
<div class="clearfix"></div>
<a href="#">
<div class="glyphicon glyphicon-menu-down"></div>
</a>
</div>
</div>
You want like this ?

Related

Icons will not align with the text element

I'm creating an account page (header) for the first time, and I notice that some of the icons will not align perfectly with the text. I know how simple and easy this is for advanced developers, but I'm just starting off and really need some advice.
I have tried using padding and margin as a style element but didn't work.
<header>
<div class="container">
<div class="row">
<div class="col-xs-6 col-md-8">
<div class="row">
<div class="col-sm-3">
<img src="paylocity_logo.png" alt="logo" style="width:100%"S/></a>
</div>
<div class="col-sm-9 hidden-sm hidden-xs" id="project-details">
<a class="home-link" href="" title="Edit"> <i class="material-icons"> home </i> </a>
<div class="project">
User Profile
</div>
</div>
</div>
</div>
<div class="col-xs-6 col-md-4 text-right" id="account">
<i class="material-icons">account_circle</i> <span>Tom Markart </span>
<div id="account-options">
<ul>
<li>
<span> <i class="material-icons">account_circle</i></span>View Profile
</li>
<li>
<span class="fa fa-cog"></span>Settings
</li>
<li>
<span class="fa fa-bug"></span>Report a Bug
</li>
<li>
<span class="fa fa-power-off"></span>Log Out
</li>
</ul>
</div>
</div>
</div>
</header>
I want to make them straight.
In your case, you can add the following rule:
.material-icons {
vertical-align: middle;
}
https://codepen.io/anon/pen/EBBbpd
Using flex:
Wrap text in <span> and a wrapper class to <a>.
...
<li>
<a class='wrapper' href="javascript:void(0);">
<span class="fa fa-cog"></span>
<span>Settings</span>
</a>
</li>
...
.wrapper {
display: flex;
align-items: center
}

Bootstrap css Aligns the text to the center by the text length of the other div

I want to use css, bootstrap to align the first line align left, and the second line will center on the text length of the first line.
I tried many ways but not.
code follow
<div class="col-md-6">
<a href="/" style="text-decoration:none">
<div class="col-md-12 row-eq-height" style="padding:0;">
<div class="col-md-2" style="padding:0">
<img src="/Content/images/logo.png" class="img-responsive" alt="">
</div>
<div class="col-md-10 tex-center" style="padding-right:0;">
<div style="padding:0">
<div class="line1-bold">THIS IS THE FIRST LONG HEADLINE</div>
<div class="line2">THIS IS THE SECOND HEADLINE</div>
</div>
</div>
</div>
</a>
</div>
Please check this..
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<div class="col-md-6">
<a href="/" style="text-decoration:none">
<div class="col-md-12 row-eq-height" style="padding:0;">
<div class="col-xs-2" style="padding:0">
<img src="https://www.tenforums.com/attachments/browsers-email/18558d1485951187t-microsoft-edge-logo-microsoft-edge-100582336-large.png" class="img-responsive" style="width:100px" alt="">
</div>
<div class="" style="float:left;">
<div class="line1-bold" style="color:#b63957; font-size:18px;">THIS IS THE FIRST LONG HEADLINE</div>
<div class="line2" style="color:#b63957; font-size:16px; text-align:center;">THIS IS THE SECOND HEADLINE</div>
</div>
</div>
</a>
</div>
Try adding the class text-center to your divs.
Here is a working pen.
Something like this?
I don't know about your task, but I deleted some tags.
CSS
.img-responsive {
width: 100px;
float: left;
}
span {
display: block;
}
HTML
<div class="col-md-6">
<a href="/" style="text-decoration:none">
<div class="col-md-12 row-eq-height" style="padding:0;">
<img src="https://www.tenforums.com/attachments/browsers-email/18558d1485951187t-microsoft-edge-logo-microsoft-edge-100582336-large.png" class="img-responsive" alt="">
<span class="text-left">THIS IS THE FIRST LONG HEADLINE</span>
<span class="text-center">THIS IS THE SECOND HEADLINE</span>
</div>
</a>
</div>
Reference Link

forcing element in same line regardless content

I searched here already and tried some accepted solutions but not worked for my case. I have listed some html and I need these elements both wrapper element and inner elements in single line.
here how it looks now and html;
html;
<div class="container-fluid">
<div class="col-sm-4 col-md-4 col-lg-4">
<div class="well">
<ul class="media-list">
<li class="media">
<a class="toggle-area pull-left" href="javascript:void(0);">
<img class="media-object" alt="Mali Sistemler" src="/Content/img/login/mali_hizmetler.png">
</a>
<div class="media-body">
<h4 class="toggle-area media-heading"><span style="width: 95%;">Mali Sistemler</span><i class="fa fa-parent-container fa-plus-square pull-right"></i></h4>
<div class="container-menus" style="display:none;"></div>
</div>
</li>
</ul>
</div>
<div class="well">... </div>
</div>
<div class="col-sm-4 col-md-4 col-lg-4">
<div class="well">
<ul class="media-list">
<li class="media">
<a class="toggle-area pull-left" href="javascript:void(0);">
<img class="media-object" alt="Denetim Sistemleri" src="/Content/img/login/denetim.png">
</a>
<div class="media-body">
<h4 class="toggle-area media-heading"><span style="width: 95%;">Denetim Sistemleri</span><i class="fa fa-parent-container fa-plus-square pull-right"></i></h4>
<div class="container-menus" style="display:none;"></div>
</div>
</li>
</ul>
</div>
<div class="well">... </div>
</div>
</div>
Sequences of white-space will collapse into a single white-space. Text will never wrap to the next line. The text continues on the same line until a <br> tag is encountered
Use white-space:nowrap
Update css
.media-body, .media-left, .media-right {
display: table-cell;
vertical-align: top;
white-space: nowrap; /* Add this */
}
Working fiddle
fiddle code

bootstrap grid elements not inline in small devices

I have a problem. Now I have bunch of divs in my code and i am using bootstrap, what I want is to make my content with control buttons be inline in small devices (like phone).However, i get something like this:
but that button should be in same line. Here is my code:
<div class='container-fluid info text-center'>
<h1>Truputėlis apie mane</h1>
<div class='row'>
<div class='col-xs-1 col-sm-1 col-md-4'>
<a href='#'><div class='controls left'><span class='glyphicon glyphicon-triangle-left' class='controls'></span>
</div></a>
</div>
<div class='col-xs-10 col-sm-10 col-md-4 about_me'>
<div style='background: url(notebook8.png);font-family: Dynalight; font-size:28px;padding-top:15px;padding-left:50px;padding-bottom:5px;margin:0 auto;border:1px solid grey;'>
<img src='http://www.arlongpark.net/customavatars/avatar23489_6.gif' style='width:80px; height:80px; background-color:white; border:1px solid black; border-radius:150px;'><br/>
<div class='about_me_text text-left'>
</div>
</div>
</div>
<div class='col-xs-1 col-sm-1 col-md-4'></div>
<a href='#' >
<div class='controls right'>
<span class='glyphicon glyphicon-triangle-right'></span>
</div>
</a>
</div>
</div>
</div>
What should I do? Sorry for my terrible english, hope you understood something...

Semantic UI centered non-fluid menu?

I have two menus, one is fixed to the bottom and another fixed to the top. My problem is two-fold. I want them to appear at the center of the screen and only be the width of their content (instead of being fluid, as per default).
I have found nothing in the documentation to indicate that this is possible, so presumably the solution is to modify it with CSS?
Any help would be greatly appreciated.
Use the semantic ui class "compact" for your UI menus to adjust to content, and then use grids and columns for center alignment.
So for example:
<div class="ui centered grid">
<div class="center aligned column">
<div class="ui compact menu">
<a class="active item">
<i class="home icon"></i> Home
</a>
<a class="item">
<i class="mail icon"></i> Messages
</a>
</div>
</div>
</div>
JSFiddle Link: http://jsfiddle.net/pLskpufp/2/
You can also just use a center aligned container:
<div class="ui center aligned container">
<div class="ui compact menu">
<a class="active item">
<i class="home icon"></i> Home
</a>
<a class="item">
<i class="mail icon"></i> Messages
</a>
</div>
</div>
JSFiddle Link: http://jsfiddle.net/377v6ect/1/
I know it's not a pure Semantic UI solution, but for those of you looking for a way to do this with a fixed menu in Semantic UI, the best solution I've found so far is to wrap it in a div with a little custom CSS.
<div className="fixed bottom">
<div className="ui centered grid">
<div className="center aligned column">
<!-- Your Semantic UI menu here, but not fixed. -->
</div>
</div>
</div>
Along with this css...
div.fixed {
width: 100%;
position: fixed;
}
div.fixed.bottom {
bottom: 0;
}
div.fixed.top {
top: 0;
}
I have searched on the semantic forums and other places; created mine.. Hope works for you too.
<div class="ui center aligned container">
<div class="ui" style="background-color: #009999;">
<!-- <a href="https://semantic-ui.com/examples/fixed.html#" class="header item"> -->
<div class="ui centered small image" >
<a href="#">
<img class="logo" src="./logo_white.png">
</a>
</div>
<!-- </a> -->
</div>
</div>