I have a prompt-box div that has a max-height of 80% of the screen.
Inside of it, I have a ul which holds a bunch of li elements depending on how many the user adds.
How do I configure this so that once that prompt-box hits a certain size, new items can be added to the list but the contents just scroll instead of overflowing like this?
Thanks!
Edit: Adding html & css
<div className='prompt-box'>
<p className='title'>What's in your future?</p>
<ul className='options-holder'>
{
this.state.items.map(item => (
<li key={item.id} className='option'>
<div className='circle' />
<p className='item-text'>{ item.text }</p>
</li>
))
}
<li key={0} className='option form'>
<div className='circle' />
<form className='new-item-form' onSubmit={this.handleSubmit}>
<input className='new-item-input' placeholder='Type something and press return...' onChange={this.handleChange} value={this.state.text} />
</form>
</li>
</ul>
<button className='confirm-button'>Continue</button>
</div>
.prompt-box {
#include absolute-center;
background: #1E1E1E;
width: 35%;
margin: 0 auto;
border-radius: 7px;
border: 1px solid rgba(255, 255, 255, 0.1);
color: #ccc;
font-family: 'Circular Book';
max-height: 80%;
overflow-y: auto;
}
.prompt-box .title {
text-align: center;
font-size: 30px;
margin-top: 30px;
margin-bottom: 25px;
}
.prompt-box .options-holder {
list-style: none;
border-radius: 3px; // not currently working
padding: 0;
width: 95%;
margin: 12px auto;
}
.prompt-box .option {
background: #303030;
padding: 18px;
border-bottom: 1px solid rgba(196, 196, 196, 0.1);
}
.prompt-box .option.form {
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
}
.prompt-box .item-text {
color: white;
font-size: 24px;
margin: 0;
display: inline-block;
padding: 0 18px;
}
.prompt-box .new-item-form .new-item-input {
background: transparent;
border-style: none;
font-size: 24px;
padding-left: 18px;
color: white;
width: 80%;
&:focus { outline: none; }
}
.prompt-box .confirm-button {
width: 95%;
margin: 22px auto 18px auto;
}
You haven't shown us any HTML/CSS code for us to reproduce and test a fix for the issue, but adding something like this should work, to allow that container to scroll vertically when its height is exceeded:
.prompt-box {
overflow-y: auto;
}
Try a overflow: scroll; style rule on your div.prompt-box. (You're already giving it a max height, so the extra contents should have a vertical scroll bar).
I threw a max-height and an overflow-y: scroll on the ul and it did the trick.
Related
I need some help with a dropdown menu that's hiding behind a div. I tried setting the z-index to higher value, set the li to position:relative, checked for overflow in css (none). I see these as common causes for this issue, but nothing works for me.
Please note that z-index, positive and negative, were added whilst trying to find a solution. It makes no difference.
NOTE: dropdown is hiding behind "text-on-banner", yet showing in front of "main-banner".
Thanks for looking at this.
HTML:
<div class="wrapper">
<div class="header">
<ul class="PrimaryNav with-indicator">
<li class="Nav-item">
A
<li class="Nav-item">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">B</a>
<ul class="dropdown-menu">
<li class="Nav-subitem">B.1</li>
<li class="Nav-subitem">B.2</li>
<li class="Nav-subitem">B.3</li>
</ul>
<li class="Nav-item">
C
</ul>
</div>
</div>
<div class="section-wrapper">
<div class="main-banner">
<div class="text-on-banner">
<h2><strong>SOME TEXT HERE</strong></h2>
</div>
</div>
</div>
CSS:
.wrapper {
width: 100%;
}
.header {
width: 100%;
background: #26282c;
color: #f5f5f5;
text-align: center;
}
.PrimaryNav {
list-style: none;
margin: 7px auto;
max-width: 1220px;
padding: 0;
width: 100%;
font-family: 'Open Sans', sans-serif;
font-size: 130%;
font-weight: 600;
}
.with-indicator {
position: relative;
z-index: 0;
}
.Nav-item {
background: #26282c;
display: block;
float: left;
margin: 0;
padding: 0;
width: 14.28%;
text-align: center;
}
.Nav-item a {
color: #c2c5ca;
display: block;
padding-top: 20px;
padding-bottom: 20px;
text-decoration: none;
}
.Nav-subitem {
background: #26282c;
display: inline-block;
width: 100%;
text-align: center;
position: relative;
z-index: 999999;
}
.section-wrapper {
max-width: 1250px;
margin: auto;
padding: 20px 0 0 0;
}
.main-banner {
text-align: center;
font-weight: 700;
font-family: 'Titillium Web', sans-serif;
font-size: 36px;
line-height: 40px;
padding: 10px 2px 1px 2px;
color: #26282c;
box-shadow:
inset 0 0 0 1px rgba(232, 45, 0, 0.1),
inset 0 0 5px rgba(232, 45, 0, 0.2),
inset -285px 0 35px white;
border-radius: 10px;
background: #fff url(banner00.jpg) no-repeat center left;
z-index: -1;
}
.text-on-banner {
font-weight: 1000;
width: 95%;
max-width: 95%;
background-color:white;
opacity:0.6;
border-radius: 10px;
z-index: -1;
}
.text-highlight {
color: #e82d00;
font-weight: 800;
}
After spending 2-3 hours on this, I just realize that it was the .with-indicator ul which had to have z-index > 0. All working as expected now.
Hope this helps somebody else though. Thanks for looking.
I am trying to use CSS to expand the input box on hover/focus of the search ICON of CSS
Now, I am trying to call a function in html to angular component (seems that I cannot use CSS with datalist element) such that the input tag gets stays expanded when I shift the focus or select an item from datalist
Here is my sample HTML
<div class="searchDiv">
<span class="glyphicon glyphicon-search" id="searchSpan" (click)="searchEvent($event)"></span>
<form [formGroup]="searchGroup" (ngSubmit)="searchEvent($event)">
<input type="text" placeholder="search" id="searchInput" formControlName="localInput" class="" list="promotionsSearchList"
(keyup)="searchEvent($event)" />
</form>
<datalist id="promotionsSearchList" class="test"
onfocus="focusEvent()" onmousemove="focusEvent()">
</datalist>
</div>
Here is my CSS
.customClass {
float: center;
}
.grid {
display: inline-grid;
grid-template-columns: 150px 150px 150px 150px auto;
grid-template-rows: repeat(3,25px);
width: 100%;
}
#headerDiv {
grid-row : 1;
grid-column : 1/6;
padding-top: 14px;
}
#firstElementSpan {
grid-row:1;
grid-column:2/6;
}
#secondElementSpan {
grid-row:1;
grid-column:3/6;
}
#thirdElementSpan {
grid-row:1;
grid-column:4/6;
}
#fourthElementSpan {
grid-row:1;
grid-column:5/6;
}
.rounded-text-box{
border-radius: 2px;
border: 2px solid #555;
padding: 20px;
width: 200px;
height: 15px;
}
.searchDiv{
width: 500px;
vertical-align: middle;
white-space: nowrap;
position: relative;
}
.searchDiv input#searchInput{
width: 45px;
height: 30px;
background: white;
border: none;
font-size: 10pt;
float: left;
color: black;
/*this is to accomadate the search icon */
padding-left: 45px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.searchDiv #searchSpan{
/*the position needs to be mentioned as absolute for the icon to
appear on top of the input */
position: absolute;
top: 5%;
margin-left: 17px;
margin-top: 7px;
/*for now z index is mentioned as to make the icon on top */
/* z-index: 5; */
z-index : 1;
color: #4f5b66;
background-color: inherit;
}
.searchDiv input#searchInput:hover, .searchDiv
input#searchInput:focus, .searchDiv input#searchInput:active{
outline:none;
width:300px;
}
.searchDiv:hover input#searchInput{
width:300px;
}
.searchDiv:hover #searchSpan{
color: #93a2ad;
}
/* this is not working , hence tried to use get the element in
angular and change its DOM prop*/
datalist:active, datalist:focus input#searchInput{
width:300px;
}
This is my sample angular component call. I have just reduced to the point of func call at this point
focusEvent(){
console.log('onfocusEvent');
const inputElement = document.getElementById('searchInput');
inputElement.style.width = '300px';
}
I don't see the func being called. I tried to use angular's property binding as well but no luck. basically I want the input element to keep expanded when I have shift the focus to the datalist element and going through the list. Could you guys help?
Thanks to #CBroe to notifying this. We cannot listen to any events as well as not do any modifications using datalist. Hence I started using ul
Here is a sample html code modified:
<div class="searchDiv">
<span class="glyphicon glyphicon-search" id="searchSpan" (click)="searchEvent($event)"></span>
<input type="text" placeholder="search" id="searchInput" class="" list="promotionsSearchList"
(keyup)="searchEvent($event)" [(ngModel)]="searchModel"/>
<ul *ngIf="loadDropDown">
<li *ngFor="let pp of promoList" (click)="selectAnyItem($event)" value="pp.id"><span>{{pp.name}}</span>
</li>
</ul>
</div>
Here is the CSS that I implemented.
ul {
padding: 2px;
list-style-type: none;
z-index:2;
background-color:black;
/*below css makes the element clear the float and move to the next
line if placed in the same block */
clear:both;
}
li:hover{
background-color: dodgerblue;
}
.rounded-text-box{
border-radius: 2px;
border: 2px solid #555;
padding: 20px;
width: 200px;
height: 15px;
}
.searchDiv{
width: 500px;
vertical-align: middle;
white-space: nowrap;
position: relative;
}
.searchDiv input#searchInput{
width: 45px;
height: 30px;
background: white;
border: none;
font-size: 10pt;
float: left;
color: black;
/*this is to accomadate the search icon */
padding-left: 45px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.searchDiv #searchSpan{
position: absolute;
top: 5%;
margin-left: 17px;
margin-top: 7px;
z-index : 1;
color: #4f5b66;
background-color: inherit;
}
.searchDiv input#searchInput:hover, .searchDiv
input#searchInput:focus, .searchDiv input#searchInput:active{
outline:none;
width:300px;
}
.searchDiv:hover input#searchInput {
width:300px;
box-sizing:border-box;
}
.searchDiv:hover ul{
width:300px;
box-sizing: border-box;
}
.searchDiv:hover #searchSpan{
color: #93a2ad;
}
Hope this helps for the users who are trying to implement
I'm almost done, but my problem is the background of the text , I even try the opacity but the underline of the box appear.
.block {
display: inline-block;
border: 2px solid white;
padding: 5px;
margin-top: 1em;
}
.paddingbox{
padding: 60px;}
.boxed {
float: left;
color: white;
padding: 0 5px;
margin-top: -2em;
}
<div class="paddingbox"><center>
<div class="block">
<span class="boxed">
<h1 style="color:white;"><?php echo get_the_title(); ?></h1></span>
</div></center></div>
With backgroun color
without background color
I'm trying to achive is like this, but it have a back ground like in the picture above
I tried fieldset and this happen
The behavior can be achieved with a fieldset tag.
.block{
display: inline-block;
border: 2px solid white;
}
.title{
color: white;
font-size: 1.5em;
text-align: center;
}
body{
background: purple;
}
<fieldset class="block">
<legend class="title">
Services
</legend>
</fieldset>
I get help of positions for solve this question!
div {
position: relative;
width: 400px;
padding: 10px;
border: 1px solid;
}
span {
position: absolute;
top: -10px;
left: 40%;
background-color: #FFF;
font-weight: bold;
}
<div>
<span>About Us</span>
</div>
I have to design a page to be compatible with IE6; it's a client requirement.
The content in my <td> is meant to be vertically aligned to the middle of the cell, but it's aligning to the bottom of the cell by default. However, when it's clicked on, it reverts back to middle vertical alignment.
HTML
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td>Utility Payments</td>
<td valign="top" style="border:1px solid #0C0;">
<div class="select_box_container index01" style="border:1px solid #F00;">
<h2>-- Select Utility Payment --</h2>
<ul id="UtilPay" style="z-index: 10;">
<li data-val="0" class="subhead">-- Electricity --</li>
</ul>
</div>
</td>
</tr>
</table>
CSS
.select_box_container {
overflow: hidden;
width: 241px;
}
.select_box_container select {
background: url(../images/text-box.png);
background-color: transparent;
}
.select_box_container {
position: relative;
overflow: visible;
}
.select_box_container h2 {
font-size: 12px;
color: #333333;
margin: 0px;
background: url(../../../pgmerc/instpy/images/text-box.png);
padding: 6px 10px;
}
.select_box_container ul {
background: none repeat scroll 0 0 #FFFFFF;
border: 1px solid #F1F1F1;
display: none;
height: auto;
overflow-y: scroll;
position: absolute;
max-height: 247px;
top: 29px;
width: 240px;
}
.select_box_container ul li {
border-bottom: 1px solid #F1F1F1;
font-size: 12px;
list-style: none outside none;
margin: 0;
padding: 2px 10px;
width: 204px;
}
.select_box_container ul li:hover { background: #F7F7F7 !important; }
.index_container {
background: url("../../../pgmerc/instpy/images/zero.png") no-repeat scroll 400px center #EAF3FA;
border: 1px solid #CCCCCC;
padding: 9px 20px;
}
.index_container table td {
font-size: 12px;
color: #003976;
padding-right: 20px;
}
.index_container h1 {
color: #003976;
font-size: 14px;
font-weight: bold;
margin-bottom: 10px;
}
How do I get it to only align to the middle of the cell?
Reference images for before and after are below:
Thanks all..have found solution.
I have removed the position relative from my container that is $(".select_box_container") and added it back on h2 click.... $(".select_box_container").css("position","relative");
Just a hunch
Can you try and replace
<h2>-- Select Utility Payment --</h2>
with
<span>-- Select Utility Payment --</span> or div
I couldn't set inline elements background like this:
My code is this:
#divMansetKategoriHaberleriContainer
{
background-color: Transparent;
margin-top: 4px;
font-size: 12px;
}
.divKategoriHaberItem
{
float: left;
background-color: White;
width: 324px;
height: 126px;
margin: 0;
padding: 0;
}
.divKategoriHaberItemImage
{
float: left;
width: 80px;
height: 80px;
border: 1px solid red;
margin: 2px;
}
.imgKategoriHaberResim_Cevre
{
width: 95%;
height: 95%;
}
.divKategoriHaberItemBaslikIcerik
{
}
.spHaberBaslik_Cevre
{
background-color: Green;
display: inline;
font-weight: bold;
padding: 5px;
height: 20px;
}
.spHaberIcerik_Cevre
{
display: block;
}
.divKategoriHaberDevami_Cevre
{
background-image: url('../images/HaberinDevami_Cevre.png');
background-repeat: no-repeat;
background-position: right;
height: 13px;
}
<div class="divKategoriHaberItem">
<div class="divKategoriHaberItemImage">
<img src='' alt='DÜNYANIN MEKANİK Dengesi Bozuldu' class="imgKategoriHaberResim_Cevre" />
</div>
<div class="divKategoriHaberItemBaslikIcerik">
<span class="spHaberBaslik_Cevre">
<a href='CevreHaber.aspx?id=2128'>DÜNYANIN MEKANİK Dengesi Bozul</a>
</span>
<span class="spHaberIcerik_Cevre">Demokratik Kongo Cumhuriyeti'n</span>
</div>
<div class="divKategoriHaberDevami_Cevre"></div>
</div>
PS: Sorry for i couldn't write with sentences :(
If i understand the question correctly, you will need to add a line-height that equals the total height of your inline element ...
in your case that would be 30px (20px for the height + 10px for the padding 5px top and 5px bottom..)
.spHaberBaslik_Cevre
{
background-color: Green;
display: inline;
font-weight: bold;
padding: 5px;
height: 20px;
line-height:30px; /*height + padding-top +padding-bottom*/
}