ng2-auto-complete result goes lengthy. If I try to inspect and give some css, when a click is done, results are gone. Then I tried one sample like below,
ng2-auto-complete{
height: 400px;
overflow-y: scroll;
overflow-x: hidden;
}
I think it's working for me, but a scroll was always in the mentioned height. How to solve this bug. Are there any other methods?
Check out the below result, that scroll was always there.
Check the image below
Check the Code below
<div _ngcontent-c14="" class="form-group">
<label _ngcontent-c14="">Language
<span _ngcontent-c14="" class="required">*</span>
</label>
<div _ngcontent-c14="">
<div class="ng2-auto-complete-wrapper" style="position: relative;">
<input _ngcontent-c14="" class="form-control ng-valid ng-touched ng-dirty" display-property-name="TextField" name="ng2autoLanguage" ng2-auto-complete="" placeholder="Enter your language" value-property-name="ValueField" ng-reflect-klass="form-control" ng-reflect-ng-class="" ng-reflect-name="ng2autoLanguage" ng-reflect-source="function () { [native code] }" ng-reflect-display-property-name="TextField" ng-reflect-list-formatter="function (data) {
" ng-reflect-model="" ng-reflect-ng-model="">
</div>
</div>
</div>
Try using max-height:
ng2-auto-complete {
max-height: 400px;
overflow-y: scroll;
overflow-x: hidden;
}
Related
I'm using Bootstrap as UI framework, what I'm trying to do is make a push menu on the left. Actually, I almost achieve this result, but there are some bugs on the system. In particular, I'm not able to get the menu inline. See the code for more details:
HTML
<div id="calendar-wrapper">
<div class="container-fluid">
<div class="row">
<div id="resource-bar" class="sidenav col-sm-2">
<h4>Resource</h4>
<div class="input-group">
<input type="text" placeholder="Search resource"
class="form-control resource-filter"/>
<span class="input-group-btn">
<button class="clear btn btn-default clean-resource btn-danger" type="button">
<span class="glyphicon glyphicon-remove"></span>
</button>
</span>
</div>
<div id="popover-content" hidden></div>
</div>
<div id="calendar-container" class="col-sm-10">
<div id="calendar" class="well"></div>
</div>
</div>
</div>
</div>
<br><br><br>
<button type="button" id="show" >Show</button>
<button type="button" id="hide" >Hide</button>
Note that the html above is adapted for a fiddle example.
CSS
.sidenav
{
background-color: azure;
height: 100%;
width: 0;
z-index: 1;
top: 0;
left: 0;
overflow-x: hidden;
transition: 0.5s;
}
#calendar-container
{
background-color: whitesmoke;
transition: margin-left .5s;
padding: 16px;
}
JS
$(document).ready(function()
{
var resourceContainer = $('#resource-bar');
var calendarContainer = $('#calendar-container');
$('#show').click(function()
{
resourceContainer.css('width', '250px');
calendarContainer.css('margin-left', '250px');
});
$('#hide').click(function()
{
resourceContainer.css('width', '0px');
calendarContainer.css('margin-left', '0px');
});
})
The result when the menu on the left is closed:
Seems that both divs are inline, the problem occurs when I press show button and the menu appears:
BUG actually noticed:
When the menu is opened I get the divs in two line instead of one row
Adding the class col-sm-2 to resource-bar the overflow-x: hidden; doesn't working, in fact, seems that the menu is visible when it should be closed.
col-sm-2 does not go in another line when the minimum resolution of the screen doesn't have enough space in width.
Someone could help me to fix this issues? Thanks. JSFIDDLE.
Edited to another workaround which wouldn't affect bootstrap grid:
With this setup sidebar would be absolute, since it's out of viewport and you set it to a fixed width (250px), using the grid wouldn't be necessary.
Visible input will not overflow once sidebar shows.
Raised buttons above sidebar.
Note the HTML structure was tweaked.
$(document).ready(function() {
var resourceContainer = $('#resource-bar');
var calendarContainer = $('#calendar-container');
$('#show').click(function() {
resourceContainer.css('width', '250px');
calendarContainer.css('margin-left', '250px');
});
$('#hide').click(function() {
resourceContainer.css('width', '0px');
calendarContainer.css('margin-left', '0px');
});
})
div.sidenav {
background-color: azure;
height: 100%;
width: 0;
z-index: 1;
top: 0;
left: 0;
overflow-x: hidden;
transition: 0.5s;
/* added absolute to sidenav since it will have fixed width anyways */
position: absolute;
}
#calendar-container {
background-color: whitesmoke;
transition: margin-left .5s;
padding: 16px;
/* this is just to vertically align with sidebar input */
padding-top: 36px;
}
button {
position: relative;
z-index: 2;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div id="calendar-wrapper">
<div class="container-fluid">
<div class="row">
<div id="calendar-container" class="col-sm-12">
<div id="calendar" class="well"></div>
</div>
<div id="resource-bar" class="sidenav">
<h4>Resource</h4>
<div class="input-group">
<input type="text" placeholder="Search resource" class="form-control resource-filter" />
<span class="input-group-btn">
<button class="clear btn btn-default clean-resource btn-danger" type="button">
<span class="glyphicon glyphicon-remove"></span>
</button>
</span>
</div>
<div id="popover-content" hidden></div>
</div>
</div>
</div>
</div>
<br>
<br>
<br>
<button type="button" id="show">Show</button>
<button type="button" id="hide">Hide</button>
You're issue lies with the mix of bootstrap and your own JavaScript generated style. It seems you already have knowledge of the Bootstrap Grid layout, but to reinforce, https://v4-alpha.getbootstrap.com/layout/grid/ will tell you that there are 12 columns in a row.
Each column is styled by Bootstrap to a set width with set margins in between. You've have all 12 columns filled up in your row. As you add an additional margin to your already-filled-up calendarContainer column, it will pop out of the row.
Therefore, the easiest way to achieve what you want without affecting any other styles is too make your column smaller and reduce the amount of 'margin-left' you push on the column like so https://jsfiddle.net/Zeenglishking/DTcHh/28837/
<div id="calendar-container" class="col-sm-8">
<div id="calendar" class="well"></div>
</div>
$('#show').click(function()
{
resourceContainer.css('width', '250px');
calendarContainer.css('margin-left', '50px');
});
Also, as you say "seems infact that the menu is even visible also when is closed.", the menu is indeed visible. This is again down to the fact of the bootstrap styling of the grid-layout. If you can figure out what styles are creating this issue (F12), you can override them using "something:!important". https://css-tricks.com/snippets/css/style-override-technique/ . Otherwise, find another way. If you mess around with css positioning elements too much, it's easy to get lost and jumbled with the rest of your code.
EDIT (in regard to comment):
What needs to be used in addition to this is 'col-xs-**' with a smaller size column, allowing for a responsive design and for it to work on the smaller viewports such as the one in JSFiddle. I have updated my fiddle to include
col-xs-1
and
col-xs-4
on resource-bar and calendar-container respectively. This will change the size of the column, upon resize of the screen/viewport to ensure it doesn't drop down on extra-small viewports. More info at http://getbootstrap.com/css/#grid-options
Upon using Bootstrap framework you almost acquire yourself to a certain standard. Shortcuts in fixing this can cause problems with other elements. You're probably best to read more into it before chucking random positioning in to fix certain elements on a page.
I know that there are many questions like that, but I couldn't find a solution to my problem.
In my single page application(with metro style) when I go back from a widget to home I would like to set the scroll position back where it was before entering the widget.
<div id="overflow" class="mCustomScrollbar _mCS_9" style="width: 1855px;">
<div id="mCSB_9" class="mCustomScrollBox mCS-jmsHorizontalScrollbar mCSB_horizontal mCSB_inside" style="max-height: none;" tabindex="0">
<div id="mCSB_9_container" class="mCSB_container" style="position: relative; top: 0px; left: 0px; width: 8360px;" dir="ltr">
<div class="page" id="dashboard_all" style="width: 8360px;">
</div>
</div>
<div id="mCSB_9_scrollbar_horizontal" class="mCSB_scrollTools mCSB_9_scrollbar mCS-jmsHorizontalScrollbar mCSB_scrollTools_horizontal" style="display: block;">
<div class="mCSB_draggerContainer">
<div id="mCSB_9_dragger_horizontal" class="mCSB_dragger" style="position: absolute; min-width: 30px; display: block; width: 403px; max-width: 1805px; left: 0px;" oncontextmenu="return false;">
<div class="mCSB_dragger_bar"></div>
</div>
<div class="mCSB_draggerRail"></div>
</div>
</div>
</div>
</div>
This is the code that the plugin creates when I apply it to the div #overflow
$(document).ready(function() {
$("#overflow").mCustomScrollbar({
axis:"x",
theme:"jmsHorizontalScrollbar",
scrollButtons: {
enable: true
},
scrollInertia: 950,
callbacks:{
onScroll:function(){
//this functions sets the value in another js file. -(this.mcs.left) to get a positive value
getNavigator().setScrollLeft(-(this.mcs.left));
},
alwaysTriggerOffsets:false
}
});
})
Then I use the position found in the callback like that
$("#overflow").mCustomScrollbar("scrollTo",scrollLeft);
But nothing happens.
If I try to put a value like 3000, sometimes #overflow scrolls, but the scrollbar stays at the initial position.
Thank you in advance,
Matteo
I did it! I used the scrollTo method in the onUpdate callback
onUpdate:function(){
$("#overflow").mCustomScrollbar('scrollTo',position, {
// scroll as soon as clicked
timeout:0,
// scroll duration
scrollInertia:0,
});
}
I am trying to make small page in html. I am able to do that. But it look good when plunker screen is small. Example: when you run the project it look fine. But when user run on full screen it look awkward.
here is image what I am trying to do
http://plnkr.co/edit/Cz10CYGKBBkG0oT0eO6C?p=preview
here is my code
http://plnkr.co/edit/Cz10CYGKBBkG0oT0eO6C?p=preview
Actually When user run on full screen I notice these thing ?
Why is the image not taking 35% width
is it the way to design the layout or I am doing wrong to design the things
what to do to design responsive layout
<ion-header-bar class="bar-assertive">
<img src="https://dl.dropboxusercontent.com/s/bt3rzcwpe80r6fs/sapient-logo.png?dl=0" class="logo">
<div class="barTab">
<a>Home</a>
<a>About us</a>
<a>Projects</a>
<a id="contactus">Contact Us</a>
</div>
</ion-header-bar>
<ion-content>
<div id="wrapper">
<div id="header">
<h1> Contact us</h1>
</div>
<div id="slideTest">
<ion-slide-box pager-click="doSomething(index)">
<ion-slide ng-repeat="n in success">
<img src={{n.image}}>
</ion-slide>
</ion-slide-box>
</div>
<div id="rightContainer">
<div id="textContainer">
What you’ve already accomplished is important. But, we’re interested in what you’re going to do next. At Sapient Global Markets, we bring together the brightest minds in the financial industry and set the stage for innovation and excellence. Given the right environment, the best tools and an incredible team to work with, what can you achieve?
</div>
<div id="formID">
<div class="list list-inset">
<label class="item item-input">
<input type="text" placeholder="First Name">
</label>
<label class="item item-input">
<input type="password" placeholder="Password">
</label>
<label class="item item-input">
<input type="password" placeholder="Confirm Password">
</label>
<label class="item item-input">
<input type="email" placeholder="Email">
</label>
<label class="item item-input">
<input type="text" placeholder="website">
</label>
<button class="button frmbtn">
submit
</button>
</div>
</div>
</div>
</div>
</ion-content>
http://plnkr.co/edit/3fu32oUq47KSmli6TP2p?p=preview
Add these rules
.slider-slides img {
width: 100%;
height: auto;
}
.slider-pager {
background: rgba(255,255,255,0.7);
}
The latter to make the controls visible.
The actual image you used is 202px wide, while the space you want to occupy if 210px wide. If you want the image to cover that area, you can make the image itself larger and it will do that automatically.
Also, you can specify width: 100% in CSS for the img tag. But as long as the image is smaller, it will be streched and that won't look as nice as having a proper sized source image.
So I think the best solution is to do both. Set the proper size through CSS and make the source image large enough to cover that area completely.
You might want to add the following css to your code, though there is still a problem with the responsive height.
.slider-slide img {
width:100%;
}
http://plnkr.co/edit/dUvIbYDxH27o81NKJ8dg?p=preview
Have you tried? :
ion-slide img {
max-width: 100%;
display: block;
height: auto;
width: 100%;
}
#slideTest - remove height: 100px;, add overflow: hidden;
.slider-slide - remove height: 100%;
.slider-slides - remove height: 100%;, add overflow: hidden;
.slider - add overflow: hidden;
List item
.slider-slide img{
width: 100%;
height: auto;
}
-
.slider-slide{
height: auto;
}
.slider-slides{
height: auto;
overflow: hidden;
}
.slider{
overflow: hidden;
}
.slider-slide img{
width: 100%;
height: auto;
}
Good morning everyone,
Sorry not sure how to word the question.
I have came across this problem, I can't seem to make the 'your email' box and 'your password' box align together. When you preview it in full screen, it will be how I want it but when I shrink the screen they start to go weird. Like this:
I want it like this but on a big screen
This is what happens on a big screen
I would like it so they are both under each other and both in the same place. Please could you help me?
Please visit http://jsfiddle.net/xiiJaMiiE/8S5VG/ to see my code so far.
#top_box
{
background: grey;
height: 50px;
left: 80.8%;
width:20%;
position: relative;
top: 0;
z-index: 5;
}
There were some errors in your HTML like unnecessary spacing and invalid tag names. I made it good. Replace your html with the following HTML code:
<body>
<div id="wrapper">
<div id="top_box">
<div class="homeform">
<input type="email" placeholder="Your E-Mail">
<input type="password" placeholder="Your Password">
<input type="Submit" value="Login">
</div>
</div>
<div class="background"></div>
<div id="menu_box"></div>
<div id="main_box"></div>
<div id="Bottom_box"></div>
</div>
</body>
And also remove height from #top_box.
Working Fiddle
add line break between the two input boxes
<input ... />
<br />
<input .../>
http://jsfiddle.net/8S5VG/1/
or make the inputs to display:block
[you had a slight mistake in the css]
http://jsfiddle.net/8S5VG/2/#update
you calling homeform as an ID is you css but in your html it is a class replace the # with a . before homeform
you also have extra spacings that are moving the boxes, clean your html get rid of all unnecessary spaces
.homeform
{
position:relative;
height:20px;
width:auto;
}
Tyr This
#top_box {
background: grey;
min-height: 50px;
min-width: 164px;
left: 80.8%;
width: 20%;
position: relative;
top: 0;
z-index: 5;
}
Give in enough space for the inputs to be in place.
Hope this helps. if you need further assistance just let me know.
For future reference here is the final result with pixel perfect precision:
The CSS code:
._25 {
width: 21%;
display: inline;
float: left;
margin-left: 2%;
margin-right: 2%;
}
._50 {
width: 46%;
display: inline;
float: left;
margin-left: 2%;
margin-right: 2%;
}
._75 {
width: 71%;
display: inline;
float: left;
margin-left: 2%;
margin-right: 2%;
}
._100 {
width: 96%;
display: inline;
float: left;
margin-left: 2%;
margin-right: 2%;
}
label {
width: 100%;
}
input {
border: 1px solid #B3B3B3;
width: 100%;
-moz-border-radius: 3px;
}
textarea {
border: 1px solid #B3B3B3;
width: 100%;
-moz-border-radius: 3px;
}
select {
border: 1px solid #B3B3B3;
width: 100%;
-moz-border-radius: 3px;
}
And some sample HTML code:
<div class="_50">
<p><label for="in_user">Username</label><input id="in_user" type="text" value=""/></p>
</div>
<div class="_50">
<p><label for="in_pass">Password</label><input id="in_pass" type="text" value=""/></p>
</div>
Recently I've started using CSS grid systems and I find the whole process of designing a webpage much more simpler. Now I'm trying to stylize form elements but I'm having a really hard time making forms with columns, take the following example:
div (width = 400px)
form
ul
li .half
label
input (should be 200px wide)
li .half
another label
another input (should also be 200px wide)
Basically I'm applying a class that has a width attribute of 50% but putting both inputs side by side makes the row to be bigger than 100% (400px) - I guess this is because of borders, margins and paddings.
Is there any CSS grid system that I can use to have multi-column forms while still making all the form elements have the same size (inputs, selects and textareas); eg. 1 input in 1 column should have 400px while 2 columns should have 200px each.
EDIT: Wufoo has some examples of what I'm trying to do but I'm too ignorant at CSS to understand all that code and I would appreciate if someone could give me some pointers.
First off, do not use a table. Putting form elements in a table does not solve your problem and complicates your maintenance. Using tables to supplement form presentation is a sign of incompetence and complexity. It is also entirely non-semantic. Instead you might actually have to write some CSS. Honestly, if you are going to use tables for non-tabular data then don't even bother using CSS as that multiplies the complexity of maintenance.
Here are some things to keep in mind:
1) Define all your units in "em" units. Most form elements are intended to contain text. Those elements, like text fields and textarea blocks, can be increased and decreased as a feature of accessibility. This means your pixel perfect pretty CSS grid will break the moment a user changes text size on the page.
2) Don't wrap your form element in a div. Like a div, your form is a block level element. Unless the form has peer nodes under a div parent simply direct any presentation directly to the form element and not a parent element that exists only to contain the form.
3) Group your form elements. If you are floating text fields things can get all messed up if the forms are floated independently of their respective label elements. It will be easier to put an ordered list inside your form and then wrap each form element in a list item. This way you only have to worry about defining layout of the label element relative to its form control and then layout of them together by defining presentation of the list item. This method is also semantic and informs text readers of an order upon your form controls.
4) Don't use the !important declaration. This makes for a quick fix in your CSS but completely screws up inheritance and absolutely complicates maintenance. Instead take the extra time to write your code correctly the first time, so that future maintenance is a quick and minor event.
5) Don't use position absolute, unless you really know what you are doing, even if your form is set to position relative. Position absolute results in unexpected behaviors in many cases and unexpected problems.
6) To ensure your CSS code actually defines a true grid use the Firefox MeasureIt plug in. It will help you achieve stunning accuracy and save you incredible time when making your grid.
7) Do everything correctly the first time using as little code as necessary to get the job complete and present your form perfectly. Only then test your form for cross browser accuracy. Make one correction for cross browser accuracy at a time to limit unnecessary bloating to your CSS code.
Something like this may help. This is how I did it on a form.
It will take some fine tuning though to make it work at your desired width. This might help you get started though.
The CSS:
.contact ul {margin:0; padding:0; list-style:none;}
.contact li {margin-bottom:10px; overflow:hidden;}
.contact label {display:block; margin-bottom:2px;}
.contact label span {color:#999;}
.contact .input {width:592px; border:1px solid #E0E0E0; background:#F6F6F6;}
.contact select.input {border:1px solid #E0E0E0; background:#F6F6F6;}
.contact .third {float:left; width:193px; margin-right:10px;}
.contact .third .input {width:185px;}
.contact .half {float:left; width:294px; margin-right:10px;}
.contact .half .input {width:286px;}
.contact .half select.input {width:294px;}
.contact .omega {margin-right:0;}
The HTML:
<form action="/contact-us" method="post" class="contact">
<ul>
<li>
<div class="half">
<label for="name">Name:</label>
<input type="text" id="name" name="name" class="input" />
</div>
</li>
<li>
<label for="address">Address:</label>
<input type="text" id="address" name="address" class="input" />
</li>
<li>
<div class="third">
<label for="city">City:</label>
<input type="text" id="city" name="city" class="input" />
</div>
<div class="third">
<label for="state">State:</label>
<input type="text" id="state" name="state" class="input" />
</div>
<div class="third omega">
<label for="zip">Zip:</label>
<input type="text" id="zip" name="zip" class="input" />
</div>
</li>
</ul>
</form>
Here's a basic kickoff example which may be of use:
<!doctype html>
<html lang="en">
<head>
<style>
fieldset { width: 400px; padding: 1%; }
input[type=text], select, textarea { width: 98%; }
.half { float: left; width: 48%; padding: 1%; }
.full { clear: both; width: 98%; padding: 1%; }
.right { text-align: right; }
</style>
</head>
<body>
<fieldset>
<legend>Contact form</legend>
<form>
<div class="half">
<label for="name">Name</label>
<input type="text" id="name" name="name">
</div>
<div class="half">
<label for="email">Email</label>
<input type="text" id="email" name="email">
</div>
<div class="half">
<label for="zip">Zip / Postal code</label>
<input type="text" id="zip" name="zip">
</div>
<div class="half">
<label for="country">Country</label>
<select id="country" name="country"><option></option></select>
</div>
<div class="full">
<label for="message">Message</label>
<textarea id="message" name="message"></textarea>
</div>
<div class="half">
<input type="checkbox" id="copy" name="copy">
<label for="copy">Send me a copy</label>
</div>
<div class="half right">
<input type="submit" value="send">
</div>
</form>
</fieldset>
</body>
</html>
Note that I am using left-floated div's of half-width instead of unordered list items.
As you insist in using percentages, don't expect it to be pixelperfect in all browsers. If you want to have it all pixelperfect, you really need to use pixels.
I think this is what you are looking for:
http://www.alistapart.com/articles/prettyaccessibleforms/
It should help simplify your structure a little bit. It doesn't explicitly describe how to make multiple column forms, but the technique could probably expand to that with some creativity on your part.
No need for the fluid 960 system here, unless you want the form to expand and contract with the browser.
I would recommend the regular old 960 grid system for this. 960 width is great for grids because it divides evenly by 12 and 16 which allows you to set up pixel perfect three and four column layouts.
The best way to get familiar with the 960 grid system is to look at the souce css and the source of the html demo
<div class="grid_6">
<p>
contact form
</p>
</div>
<div class="grid_3">
<p>
name
</p>
</div>
I had to do something similar and ended up setting my half-columns to 46%. It leaves an extra bit of room for the padding and gets all your input fields consistently sized.
One answer is Blueprint. I have read where you don't think it's the answer, but it's still the way I would do it. All the ease of tables with all the power of CSS.
With blueprint the math is pretty easy. Let's say your form spans 10 columns.
<div id="contact-form" class="span-10">
<h3>Contact Form</h3>
<form action="contact">
<div id="form-sec-1" class="span-5">
<label>Name</label> <br/>
<input type="text" name="name" /> <br/>
<label>ZIP code</label> <br/>
<input type="text" name="zipcode" />
</div>
<div id="form-sec-2" class="span-5 last">
<label>Email</label> <br/>
<input type="text" name="email" /> <br/>
<label>Country</label> <br/>
<input type="text" name="country" />
</div>
<div id="form-sec-3" class="span-10 last">
<label>Message</label> <br/>
<textarea name="message" />
</div>
<div id="form-sec-4" class="span-8">
<input type="checkbox" name="copy"/>
<label>Send me a copy</label>
</div>
<div id="form-sec-5" class="span-2">
<input type="submit"/>
</div>
</form>
</div>
Oh wow,i was just thinking what in the world is the matter with the css world then i saw this css grid layout editors draft,http://dev.w3.org/csswg/css3-grid-align/
I still cannot explain why the css world hasn't really been thinking along such lines,what explanation can there be for the lack of such a feature in css.