Its possible to have an LI fixed at a position and make the rest of the LI scrollable?
I want to have a ul where the first item is fixed, since its a search box, and make the other items, that are loaded with ng-repeat, scrollable.
I came to a solution but it's not UX ok...
My html:
<ul ng-if="filter.isSearchListType && hasFilterValues(filter)" class="dropdown-menu">
<li class="individual-search">
<input type="search" ng-model="searchInputText" class="form-group filter-input" placeholder="Nombre o E-mail" />
<i ng-show="searchInputText" class="fa fa-remove clear-search-icon" aria-hidden="true" ng-click="searchInputText = ''; $event.stopPropagation()"></i>
<i class="fa fa-search search-icon" aria-hidden="true" ng-click="$event.stopPropagation()"></i>
</li>
<li>
<ul class="pre-scrollable2">
<li ng-repeat="filterValue in filter.values | searchInData:searchInputText">
<a href="#" ng-click="selectFilterValue(filter, filterValue.id)" ng-class="{ 'selected': isSelectedFilter(filter, filterValue.id) }">
{{filterValue.label}}
</a>
</li>
</ul>
</li>
</ul>
CSS pre-scrollable2 is kinda a copy of dropdown-menu:
.pre-scrollable2 {
max-height: 340px;
overflow-y: scroll;
/*list-style-type: none;*/
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
/*display: none;*/
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, .15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
}
.pre-scrollable2 > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
}
.pre-scrollable2 > li > a:hover,
.pre-scrollable2 > li > a:focus {
color: #262626;
text-decoration: none;
background-color: #f5f5f5;
}
In my experience you have to seperate the two lists and stack them on top of eachother to make them look like one list. then the top list set the position to fixed for the fixed search bar then the bottom set overflow to auto to get a scroll effect. create a navbar class set its width to whatever and the height to 100vh
<div class="navbar">
<ul ng-if="filter.isSearchListType && hasFilterValues(filter)" class="searchbar">
<li class="individual-search">
<input type="search" ng-model="searchInputText" class="form-group filter-input" placeholder="Nombre o E-mail" />
<i ng-show="searchInputText" class="fa fa-remove clear-search-icon" aria-hidden="true" ng-click="searchInputText = ''; $event.stopPropagation()"></i>
<i class="fa fa-search search-icon" aria-hidden="true" ng-click="$event.stopPropagation()"></i>
</li>
</ul>
<ul class="bottomlist">
<li ng-repeat="filterValue in filter.values | searchInData:searchInputText">
<a href="#" ng-click="selectFilterValue(filter, filterValue.id)" ng-class="{ 'selected': isSelectedFilter(filter, filterValue.id) }">
{{filterValue.label}}
</a>
</li>
</ul>
</div>
<style>
.navbar {
position: fixed;
left: 0;
top: 0;
bottom: 0;
height: 100vh;
width: 20vw;
}
.searchbar {
postion: fixed;
top: 0;
}
.bottomlist {
overflow: auto;
postion: relative;
}
</style>
Related
I have been fighting with this section of code for a good few hours and cant figure out why it's greyed out in the browser and in dev tools. its suppose to display a title of the listed item. So far Im not seeing any Title unless I remove the class="ad-box-title" from the tag.
CSS
/*Ad box*/
.modern-img-indicator{
position: absolute;
top: 0;
left: 0;
background: rgba(0,0,0, 0.2);
font-size: 11px;
padding: 5px;
color: #ffffff;
}
.ad-box {
background: #fff none repeat scroll 0 0;
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
position: relative;
margin-bottom: 20px;
}
.ad-box .ads-thumbnail {
display: block;
overflow: hidden;
position: relative;
border-radius: 3px 3px 0 0;
height: 158px;
}
.ad-box .caption {
background: #fff none repeat scroll 0 0;
padding: 7px 10px;
}
.ad-box-caption-title {
height: 32px;
margin-bottom: 5px;
overflow: hidden;
}
.ad-box-caption-title .ad-box-title {
color: #666666;
}
.ad-box-category {
font-size: 11px;
height: 30px;
border-top: 1px solid #e7e7e7;
line-height: 30px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ad-box-footer {
background-color: #f6f6f6;
border-radius: 0 0 3px 3px;
border-top: 1px solid #e7e7e7;
box-shadow: 0 1px 0 0 #fff inset;
padding: 5px 8px;
position: relative;
}
span .ad-box-footer, .ad-box-price {
display: block;
}
.ad-box-price {
font-size: 12px;
}
.ad-box-premium i {
margin-top: 7px;
color: #f21aa5;
}
.ad-box-premium {
border-left: 1px solid #ddd;
color: #aaa;
cursor: default;
height: 28px;
position: absolute;
right: 1px;
text-align: center;
top: 1px;
transition: color 0.15s linear 0s;
width: 29px;
}
.ad-box-premium img {
max-height: 25px;
width: auto;
}
.countdown{
padding: 5px;
font-size: 14px;
text-align: center;
}
.place-bid-btn{
text-align: center;
}
HTML
<div class="col-md-3">
<div class="ad-box">
<!-- Thumbnail -->
<div class="ads-thumbnail">
<a href="#">
<img src="/uploads/thumbs/cat.jpg" alt="Auction title" class="img-fluid">
<span class="modern-img-indicator">
<i class="far fa-file-image"></i>
</span>
</a>
</div>
<!-- Caption -->
<div class="caption">
<div class="ad-box-caption-title">
<a href="#" class="ad-box-title">
Title Here
</a>
</div>
<div class="ad-box-category">
<a href="#" class="price text-muted">
<i class="far fa-folder"></i> Category Name Here
</a>
<a href="#" class="price text-muted">
<i class="fas fa-map-marker-alt"></i> Location Here
</a>
</div>
</div>
<!-- Box footer -->
<div class="ad-box-footer">
<span class="ad-box-price">Starting price here $0.00</span>
<span class="ad-box-price">Current Bid here $0.00</span>
<!-- If its a premium auction -->
<div class="ad-box-premium">
<img src="/images/premium-icon.png" alt="Premium Auction Image here">
</div>
<!-- Countdown -->
<div class="countdown">Time remaining</div>
<div class="place-bid-btn">
Place Bid
</div>
</div>
</div>
</div>
I'm making a landing page for a client with a dropdown menu. I'm using bootstrap. I've been having an issue where the dropdown options are already expanded on page load, but only for IE. They also do not have any of the normal formattings for an 'expanded' dropdown (background color should be white, it's not, etc.) Instead, all the li are translucent gray. The options are hoverable and selectable, but the dropdown menu will not close (the caret is essentially unresponsive).
This problem has happened before, on other sites, for this same client. The weirdest thing is, in the past, I have been able to get it to work by merely uploading the folder again to the client's servers. Same code, not working once, then uploaded again and then working. For the life of me, I can't figure out why this is happening
.hero .hero-selection select {
width: 250px;
border: none;
font-size: 14px;
font-family: Proxima Nova Thin;
-moz-box-shadow: 0 0 0 35px rgba(255, 255, 255, .2);
-webkit-box-shadow: 0 0 0 35px rgba(255, 255, 255, .2);
box-shadow: 0 0 0 35px rgba(255, 255, 255, .2);
background-color: #FFF;
color: #999;
border-radius: 0!important;
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
appearance: none;
padding: 15px 10px 10px;
}
.hero .hero-form-container .dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, .15);
border-radius: 4px;
box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
margin: 2px 0 0;
padding: 5px 0;
}
.hero .hero-form-container .dropdown-menu>li>a {
display: block;
clear: both;
font-weight: 400;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
padding: 3px 20px;
}
.hero .hero-form-container ul {
width: 250px;
top: 91px;
border-radius: 0;
border: none;
background-color: #FFF;
color: #999;
padding: 0;
}
.hero .hero-form-container ul li a:hover {
background-color: #99d425;
font-family: Proxima Nova Thin;
font-size: 14px;
color: #999;
padding: 5px 5px 5px 15px;
}
.hero .hero-form-container ul li a {
font-family: 'Proxima Nova Thin';
font-size: 14px;
color: #999;
text-decoration: none;
padding: 5px 5px 5px 15px;
}
<div class="row">
<div class="col-sm-6 pull-left"><img id="nats-logo" style="" src="img/nats-logo-red.png" alt=""></div>
<div class="col-sm-6">
<div class="hero">
<div class="hero-form">
<div class="dropdown hero-selection">
<h5>Select your utility below:</h5>
<h2 style="margin-top: 20px">My Electricity Utility is:</h2>
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-expanded="true"> Select One<span class="caret"></span> </button>
<ul class="dropdown-menu" role="menu">
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="notlisted" class="is-active">[not listed]</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="EBG">BGE</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="CNM">Delmarva Power (MD)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="PED">Pepco (DC)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="PEM">Pepco (MD)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="APM">Potomac Edison</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" value="SME">SMECO</a></li>
</ul>
</div>
<form action="https://one.wglenergy.com/portal/rc_engine_by_ldc.php" id="form1">
<input type="hidden" name="super_rc" value="NATS">
<input type="hidden" name="cust_type" value="RES">
<input type="hidden" name="ldc_g" id="ldc_g">
<input type="hidden" name="ldc_e" id="ldc_e">
<input type="submit" id="go-button" value="See Your Pricing">
</form>
</div>
</div>
</div>
</div>
</div>
I have this code below. I have one container div with 2 inner div. I want the two inner divs to be side by side so I used in-line block on the two divs. Also I want the two divs to be start on top. In the demo below they are stuck on top and I dont know why while in my own project they are side by side but first div starts on top while second div does not start on top.
What is the best css style to make the 2 div in a container start on top while it is side by side?
What is the best way to make two div side by side?
.homissync {
display: block;
height: 100%;
}
.homissync>div {
padding: 27px;
margin: 3px;
display: inline-block;
}
#homissyncbuttons {
height: 100vh;
width: 20%;
margin: 3px;
}
#homissynclist {
height: 100vh;
margin: 3px;
width: 68%;
}
#homissyncbuttons .libuttons {
width: 100% !important;
background-color: #ff0000;
}
.vBorder {
border: solid 1px #ddd;
}
button, input[type=submit] {
padding: 8px 20px;
color: #fff;
text-shadow: 0 0 2px rgba(0,0,0,0.35);
background-color: orange;
font-size: 0.9rem;
font-weight: bold;
border-radius: 3px;
border: 0;
outline: none !important;
margin: 3px 0;
cursor: pointer;
transition: background 1s ease-in-out;
}
<div class=" homissync">
<div id="homissyncbuttons" class=" vBorder">
<ul>
<li>
<button class="libuttons">UACS</button>
</li>
<li>
<button class="libuttons">Medicine</button>
</li>
<li>
<button class="libuttons">Non-Drugs</button>
</li>
<li>
<button class="libuttons">Miscellaneous</button>
</li>
</ul>
</div>
<div id="homissynclist" class=" vBorder">
<button class="listbuttons" id="new_uacs_entry">New UACS Entry</button>
<button class="listbuttons" id="update_uacs_entry">Update UACS Entry</button>
<div id="homissynclistresult" class=" vPadding vBorder">
</div>
</div>
</div>
Please try this code instead of the display:inline-block; and just add float:left.
.homissync>div {
display: block;
float: left;
}
you can use float: left; instead of display: inline-block;
.homissync {
display: block;
height: 100%;
}
.homissync>div {
padding: 27px;
margin: 3px;
float:left;
}
#homissyncbuttons {
height: 100vh;
width: 20%;
margin: 3px;
}
#homissynclist {
height: 100vh;
margin: 3px;
width: 65%;
}
#homissyncbuttons .libuttons {
width: 100% !important;
background-color: #ff0000;
}
.vBorder {
border: solid 1px #ddd;
}
button, input[type=submit] {
padding: 8px 20px;
color: #fff;
text-shadow: 0 0 2px rgba(0,0,0,0.35);
background-color: orange;
font-size: 0.9rem;
font-weight: bold;
border-radius: 3px;
border: 0;
outline: none !important;
margin: 3px 0;
cursor: pointer;
transition: background 1s ease-in-out;
}
<div class=" homissync">
<div id="homissyncbuttons" class=" vBorder">
<ul>
<li>
<button class="libuttons">UACS</button>
</li>
<li>
<button class="libuttons">Medicine</button>
</li>
<li>
<button class="libuttons">Non-Drugs</button>
</li>
<li>
<button class="libuttons">Miscellaneous</button>
</li>
</ul>
</div>
<div id="homissynclist" class=" vBorder">
<button class="listbuttons" id="new_uacs_entry">New UACS Entry</button>
<button class="listbuttons" id="update_uacs_entry">Update UACS Entry</button>
<div id="homissynclistresult" class=" vPadding vBorder">
</div>
</div>
</div>
display:inline-block have default white space, you need to remove the white space. otherwise you need to relace the display-inline-block with float:left , there is so many options to remove the white space please check the reference link below
Why is there an unexplainable gap between these inline-block div elements?
I am trying to center the text of class "link" in the middle on the Y axis. It doesn't seem to be centering on the Y axis, I have tried "middle" and "center". Is it maybe because the text inline? Or could it also be because of the other CSS tags? Could I have some help? I provided the 2 pieces of code below.
#top {
z-index: -1;
height: 100%;
margin: 0;
background: linear-gradient(to right, #00ace6, #007399);
}
#toggle {
display: none;
}
input[type=checkbox]:checked ~ #nav {
animation: fadein 1s 1 forwards;
display: initial;
vertical-align: middle;
}
#menuicon {
z-index: 10;
width: 50px;
background: rgba(0, 0, 0, 0.1);
}
#nav {
opacity: 0;
display: none;
position: absolute;
padding: 0;
margin: 0px;
height: 50px;
width: 50%;
z-index: 11;
background: rgba(0, 0, 0, 0.1);
border-radius: 0px 20px 20px 0px;
}
#nav li {
top: 50%;
color: white;
display: inline;
vertical-align: middle;
}
#nav li a {
margin-top: 5%;
text-decoration: none;
color: white;
font-size: 20px;
font-weight: bold;
}
#link {
vertical-align: middle;
}
<div id="top">
<input type="checkbox" id="toggle">
<label for="toggle">
<img id="menuicon" src="images/icons/Kitkatbar2.png">
</label>
<ul id="nav">
<li class="link">About me
</li>
<li class="link">Work
</li>
<li>
<a href="https://twitter.com/Littlebigbloxs">
<img src="images/icons/twitterICON.png" style="height: 100%; border-radius: 10px;">
</a>
</li>
<li>
<a href="https://www.roblox.com/users/19619052/profile">
<img src="images/icons/robloxICON.png" style="height: 100%; border-radius: 10px;">
</a>
</li>
<li>
<a href="mailto:littlebigblox#gmail.com">
<img src="images/icons/emailICON.png" style="height: 100%; border-radius: 10px;">
</a>
</li>
</ul>
<h1 class="Title">littlebigblox</h1>
<p align="center"></p>
</div>
Try to change from ul to table. Like that:
<table><tr><td>About me </td><td>Work </td></tr></table>
So, with table tag you can use vertical align in td.
Change the parents display to display: table. Then, change the childrens display to display: table-cell. This way, you can use the vertical-align: middle property.
Im tring here to set the list tags to float right in the navbar and keep my image at the left and the selector with it, and trying to set the search over the list aswell. Already try everything, im just starting with coding and cant find a way to solve
.fixed-top {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
top: 0;
border-width: 0 0 1px;
}
#nav ul li a {
display: block;
padding: 7px 15px;
text-decoration: none;
font-weight: bold;
color: #FFFFFF;
}
#nav li a:hover {
color: #000000;
background-color: #fff;
}
select option {
margin: 40px;
background: rgba(0, 0, 0, 0.3);
color: #fff;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
select {
margin-left: 10px;
padding-left: 20px;
padding-top: 5px;
background: #696969;
color: #FFFFFF;
border: none;
}
input[type=text] {
margin-left: 840px;
}
.navbar-superior {
float: right;
margin-bottom: -20px;
}
.contenedora {
width: 100%;
float: right;
margin: auto;
padding: 0;
list-style: none;
background-color: #696969;
box-shadow: 10px 0 10px #000000;
border-bottom: 1px solid #000000;
border-top: 1px solid #000000;
}
.navbar-derecha li {
float: left;
}
.contenedora * {
float: left;
list-style: none;
}
<div id="nav" class="fixed-top">
<div class="contenedora">
<!-- Navegador Superior - logo -->
<a href="">
<img src="images/logo.png">
</a>
<select>
<option val="">Argentina</option>
<option val="1">Algeria</option>
<option val="2">..</option>
<option val="3">...</option>
<option val="4">....</option>
</select>
<input type="text" placeholder="Buscar"><i class="material-icons">search</i>
</input>
<div class="navbar-superior">
<ul class="navbar-derecha">
<li>Soluciones para
</li>
<li>Contáctenos
</li>
<li>Mi Cuenta
</li>
<li>Carrito
</li>
</ul>
</div>
<!-- Navbar Derecha -->
</div>
<!-- Navegador superior -->
</div>
Try removing the asterisk "*" from .contenedora * {...}, And instead add the list-style:none to the .navbar-derecha li {...} class.
Also remove margin-bottom: -20px; form your .navbar-superior {...} class such that it looks like
.navbar-superior {
float: right;
}
Remove the margin-left from the input[type=text], Wrap your text-input and your search text in a div tag which you have to float to the right
<div style="float:right;">
<input type="text" placeholder="Buscar"><i class="material-icons">search</i>
</div>
Make sure your code looks like in the example below.
.fixed-top {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
top: 0;
border-width: 0 0 1px;
}
#nav ul li a {
display: block;
padding: 7px 15px;
text-decoration: none;
font-weight: bold;
color: #FFFFFF;
}
#nav li a:hover {
color: #000000;
background-color: #fff;
}
select option {
margin: 40px;
background: rgba(0, 0, 0, 0.3);
color: #fff;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
select {
margin-left: 10px;
padding-left: 20px;
padding-top: 5px;
background: #696969;
color: #FFFFFF;
border: none;
}
input[type=text] {} .navbar-superior {
float: right;
}
.contenedora {
width: 100%;
float: right;
margin: auto;
padding: 0;
list-style: none;
background-color: #696969;
box-shadow: 10px 0 10px #000000;
border-bottom: 1px solid #000000;
border-top: 1px solid #000000;
}
.navbar-derecha li {
float: left;
list-style: none;
}
.contenedora {
float: left;
}
<div id="nav" class="fixed-top">
<div class="contenedora">
<!-- Navegador Superior - logo -->
<a href="">
<img src="images/logo.png">
</a>
<select>
<option val="">Argentina</option>
<option val="1">Algeria</option>
<option val="2">..</option>
<option val="3">...</option>
<option val="4">....</option>
</select>
<div style="float:right;">
<input type="text" placeholder="Buscar"><i class="material-icons">search</i>
</div>
</input>
<div class="navbar-superior">
<ul class="navbar-derecha">
<li>Soluciones para
</li>
<li>Contáctenos
</li>
<li>Mi Cuenta
</li>
<li>Carrito
</li>
</ul>
</div>
<!-- Navbar Derecha -->
</div>
<!-- Navegador superior -->
</div>
Hope that helped you.