semantic-ui fluid full-width input in a menu - css

I have a fixed top menu with an image on the left, an input to it's right and another input on the far right. I want the center input to stretch to fill all remaining space between the image and the other input.
Normally in semantic-ui I'd consider a fluid input, but that doesn't seem to work at all inside a semantic-ui menu. When 'fluid' is applied the input becomes smaller.
How can I get the center input to stretch to full-width between the other two? Is there a way to do this with just semantic-ui?
<div class="ui fixed borderless menu">
<div class="header">
<a href="/" class="">
<img src="logo.png">
</a>
</div>
<div class="item">
<div class="ui left icon input">
<i class="search icon"></i>
<input type="text" placeholder="search">
</div>
</div>
<div class="right item">
<div class="ui left icon input">
<i class="map outline icon"></i>
<input type="text" placeholder="location">
</div>
</div>
</div>

You can set flex-grow to 1 for the item's css style.
<div class="category search item" style="flex-grow:1;">
<div class="ui icon input">
<input class="prompt" placeholder="Search..." type="text">
<i class="search link icon"></i>
</div>
<div class="results"></div>
</div>
Tested and Work with Semantic UI 2.2.13

Set the display property of the elements to display: inline-block.
Set the width properties for the elements to relative values, i.e. use percents instead of pixels.
Set the values of the width properties for the elements so that they add up to 100%.
Remove any extra margins and/or padding from the page.
* {
margin: 0;
padding: 0;
}

Related

Icon added with input-group-append seems bigger then input box

I have got the following search input box within a navbar.
The thing that confuses me is that the appended search icon looks as if its bigger then the input search field. This seems to be due the "inline" shadow used within the search box.
How can make the icon look better without having to remove the shadow?
<nav>
<!-- removed -->
<!-- Right side items -->
<form class="navbar-nav form-inline flex-column flex-sm-row" style="flex-basis: 350px;">
<div class="input-group flex-sm-fill">
<input class="form-control" id="search-box" type="search" placeholder="Search">
<div class="input-group-append">
<span class="input-group-text"><i class="fa fa-search" aria-hidden="true"></i></span>
</div>
<div class="card shadow px-4 border-top-0" id="result-box" style="display: none; position: absolute; top: 46px;">
<ul class="list-unstyled" id="search-result"></ul>
</div>
</div>
</form>
</div>
</nav>

Jumbotron at footer not sticking to the bottom of the page?

I'm trying to create a fixed footer from a jumbotron including a text area and a button. This is what I have now at the end of <body>:
<div class="jumbotron jumbotron-fluid position-fixed fixed-bottom">
<div class="container-fluid">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Message: </span>
</div>
<textarea class="form-control" aria-label="With textarea"></textarea>
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button">Send</button>
</div>
</div>
</div>
</div>
But this jumbotron doesn't stick to the bottom of the page. It stays about 50px above the bottom, it's so ugly and I don't know how to fix it!
Because the default .jumbotron has margin-bottom: 2rem;. Removing that bottom margin will fix the issue.
You can also do your custom style:
.jumbotron.fixed-bottom {
margin-bottom: 0 !important;
}
By the way, you don't need .position-fixed class. .fixed-bottom will do the fixed position for you!

Vertical center a span with font-awesome 5 SVG icon in Bootstrap Panel Heading

I have this code:
<div class="panel-heading clearfix">
<div class="col-md-11 left">
<button style="display: inline-block;" type="button" class="btn btn-success btn-circle"> <i class="fab fa-twitter"></i></button>
<h3 style="display: inline-block;" class="panel-title uppercased green"> Twitter</h3>
</div>
<div class="col-md-1">
<span class="clickable right"><i class="fa fa-2x fa-chevron-circle-up"></i></span>
</div>
</div>
I have a problem to center vertically col-md-1 and span with font-awesome chevron icon.
This is an image
This is beacuse the button inside the left div has a certain height that affects also the element on the right.
Just add a line-height equals to the height of the green button:
.clickable i {
line-height: 34px;
}
I also fixed your typo in icon class. There's an extra 'b' that causes the non-rendering of the twitter icon.
<i class="fa fa-twitter"></i>
I have updated the codepen.
I add a wrapper and background color, so you can easily see that now it's aligned correctly.

Semantic UI dropdown - how to position it to the left of the opening link?

I would like to open the dropdown to the left of the link opening the dropdown, so it is visible on tiny screens like iPhone has. Is there some standard way to do it?
Here is my dropdown definition - it would be nice to get some setting(class) telling the dropdown to align right, not left side with the link.
<div class="four wide mobile three wide computer column">
<div class="ui compact dropdown doNotClose">
<i class="dropdown icon"></i>
<span class="ui tiny header">Filters</span>
<div class="menu">
<div class="item">
<div class="ui toggle checkbox">
<input type="checkbox" checked>
<label>Acknowledge</label>
</div>
</div>
<div class="item">
<div class="ui toggle checkbox">
<input type="checkbox" checked>
<label>Active</label>
</div>
</div>
</div>
</div>
</div>
It is possible to do it by adding pointing class to the dropdown.
You can find a JSFiddle example here: http://jsfiddle.net/ypvpajrL/
Source: https://github.com/Semantic-Org/Semantic-UI/issues/3645
Add this style next to menu class
style="right: 0;left: auto;"
example;
<div class="ui simple dropdown icon button" style="margin:0;">
<i class="calendar icon"></i>
Date
<div class="menu" style="right: 0;left: auto;">
<a class="ui item">Today</a>
<a class="ui item">Yesterday</a>
</div>
</div>

Float bootstrap badge right

I am trying to float a bootstrap badge to right of a label. However I run into problems with spacing and with the element that the span is with in resizing.
It seems that my element size changes enough when the badge appears that it forces the label to move within the span.
<div class="row-fluid" style="padding-top: 10px;">
<div class="span4 text-center">
<span class="tab">
<a class="tab" href="javascript:void(0)" ng-click="tabSelected('one')">Stuff 1</a>
</span>
<span class="badge badge-success" ng-show="currentTab == 'one'">0</span>
</div>
<div class="span4 text-center">
<span class="tab">
<a class="tab" href="javascript:void(0)" ng-click="tabSelected('two')">Stuff 2</a>
</span>
<span class="badge badge-success" ng-show="currentTab == 'two'">0</span>
</div>
</div>
</div>
Is there a way to place the badge just to the right of the label such that when the badge appears/disappears the label does not move.
I am using bootstrap 2.
Plunk here to demonstrate:
http://plnkr.co/edit/iurlXU?p=preview
Click each label to switch the badge.
This is happening because you are using the text-center class. The text-center class always places the the text in the center on the div based on the text's length. When you de/activate the badge the length changes and therefore the text is moved a bit to the right or the left. If you remove the text-center alignment you get the expected result.
If it is required to have the content of the div placed somewhere specifically in the page you can utilise a grid style with a <div class="row"> / offset and col-x size in order to bring the div in the required position (1).
Check the grid style in this page

Resources