Dropdown menu pops below whole site instead of under button - css

I'm developing a simple website using Angular 5 and Angular Materials. My site has one dropdown menu that is above whole content of my site, used to set sorting criteria. The problem is, when I try to open it, the menu opens itself all the way at the bottom of my site. What could be the cause of it?
Here is .html used for this site:
<mat-card >
<mat-card-header id="game-list-menu">
<div id="game-list-menu-left">
<button mat-button [matMenuTriggerFor]="sortMenu">Sort by: {{sortBy}}</button>
<mat-menu #sortMenu="matMenu">
<div id="game-list-menu-sort">
<button mat-menu-item (click)="changeSort(1)">Name</button>
<button mat-menu-item (click)="changeSort(2)">Platform</button>
<button mat-menu-item (click)="changeSort(3)">Rating</button>
</div>
</mat-menu>
</div>
<div id="game-list-menu-title">Game List</div>
<div id="game-list-menu-right">
<form #searchForm="ngForm" (ngSubmit)="search(searchForm.value)">
<mat-form-field>
<input matInput [(ngModel)]="searchGame.name"
required name="name" #name>
</mat-form-field>
<button mat-raised-button color="primary" type="submit"
[disabled]="!searchForm.form.valid">Search</button>
<button mat-raised-button color="primary" (click)="searchForm.reset(); showAll()">
<span>Show all</span>
</button>
</form>
</div>
</mat-card-header>
<mat-card-content id="game-list-container">
<mat-card class="game-list-item" *ngFor="let game of games">
<mat-card-header>
<mat-card-title>{{game.name}}</mat-card-title>
<mat-card-subtitle>{{game.platform}}</mat-card-subtitle>
</mat-card-header>
<img mat-card-image src="{{game.gameCoverPath}}" alt="{{game.name}} cover">
<mat-card-content>
<p>Rating:</p>
<span *ngFor="let goldstar of getIterator(game.rating)">
<img src="https://dl.dropbox.com/s/ngxkbxyy8hmpbaw/Star_gold.png?dl=0" height="20px" width="20px"/>
</span>
<span *ngFor="let greystar of getIterator(5 - game.rating)">
<img src="https://dl.dropbox.com/s/pnuorfnn75xib3o/Star_grey.png?dl=0" height="20px" width="20px"/>
</span>
<p></p>
</mat-card-content>
<mat-card-actions>
<button mat-button [routerLink]="['/game-details', game.id]">Details</button>
<button mat-button>Edit</button>
</mat-card-actions>
</mat-card>
</mat-card-content>
<mat-card-actions id="container_actions">
<button mat-fab color="primary" [routerLink]="['/game-add']">+</button>
</mat-card-actions>
</mat-card>
Here is CSS used for this site:
.game-list-item {
max-width: 300px;
padding: 25px;
margin: 10px;
display: inline-block;
}
#container_actions {
text-align: right;
padding: 25px;
}
.game-list-item mat-card-title {
font-size: 24px;
font-weight: bold;
}
.game-list-item mat-card-subtitle {
font-size: 18px;
}
.game-list-item mat-card-header {
display: inline;
}
.game-list-item .mat-card-content {
padding: 15px 0 0 0;
}
.game-list-item mat-card-actions {
text-align: right;
}
#game-list-menu {
}
#game-list-menu div {
display: inline;
padding: 20px;
width: 33%;
}
#game-list-menu-left {
text-align: left;
}
#game-list-menu-title {
}
#game-list-menu-right {
text-align: right;
}
#game-list-menu-sort {
}
Here is styles.scss file used for whole project:
#import url("https://fonts.googleapis.com/css?family=Karla");
* {
font-family: 'Karla', serif;
}
h1 {
width: auto;
text-align: center;
font-size: 50px;
}
mat-card-header {
width: auto;
text-align: center;
font-size: 35px;
}

Add this to your style.css
#import '~#angular/material/prebuilt-themes/deeppurple-amber.css';

Related

Centralize md card angular material

I use angular 6 and angular material, but nothing works. I'd like to put my login card at middle of page
html:
<mat-card class="card" layout-align="center center">
<form (ngSubmit)="onSubmit(UserLogin)">
<div class="container">
<mat-form-field>
<input matInput placeholder="E-mail" [formControl]="email" required>
<mat-error *ngIf="email.invalid">{{getErrorMessage()}}</mat-error>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Senha" [type]="hide ? 'password' : 'text'" [formControl]="password">
<mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility' : 'visibility_off'}}</mat-icon>
</mat-form-field>
<div>
<button mat-raised-button color="accent" type="submit">Entrar</button>
</div>
</div>
</form>
</mat-card>
add this in css file of component
:host{
display: flex;
min-height: 100vh;
}
mat-card{
margin: auto;
}
You could use position:absolute with left and top positioning and transform should work
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
position: relative;
height: 100vh;
}
form {
border: 1px solid;
display: inline-block;
padding: 20px;
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
<form>
<div><input type="text" placeholder="First Name" name=""></div>
<div><input type="text" placeholder="Last Name" name=""></div>
<div><input type="text" placeholder="Email" name=""></div>
</form>

Adding login to right top corner

I'd like to add login to right top corner, just like most forums have. I split my container on left/right, but the right side wouldn't work.
<div id="header">
<div class="container">
<div class="leftbox">
LOGO image
</div>
<div class="rightbox">
<form class="form-signin">
<h2 class="form-signin-heading">Please sign in</h2>
<input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus>
<input type="password" id="inputPassword" class="form-control" placeholder="Password" required>
<div class="checkbox">
<label>
<input type="checkbox" value="remember-me"> Remember me
</label>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
</form>
</div>
css
body {
background-color: #E3E3E3;
font-size: 12px;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #4f4f4f;
font-family: "BebasNeue", sans-serif;
margin: 0;
font-weight: normal;
}
/* header/navbar*/
#header{
background-color: #2C2C2C;
color: #FFFFFF;
padding-top: 30px;
}
#header.leftbox{
float:left;
display: inline;
}
#header.rightbox{
float:right;
display: inline;
width: 200px;
}
here is my jsfiddle: https://jsfiddle.net/otj12jno/
You've made one mistake. There should be a space between id and class in css.
#header.leftbox{}
This code calls element which id="header" and class="leftbox"
#header .leftbox{}
This code calls element which class="leftbox" and his parent (or grandparent etc.) has id="header"
It might be easier to use position: absolute on the button class and then set position as follows:
#signinbtnClass {
position : absolute;
top : 0 px // or below the header or banner image
left :10px;
}

Inline textfield and input don't line up

I am implementing an inline form. Users can search for an existing customer or add a new customer.
<div id="CustomerInfo">
<div class="display-field roomy">
<div id="customerInfoContainer">
<div class="addCustomerControlsContainer">
<span class="twitter-typeahead" style="position: relative; display: inline-block;"><input type="text" class="autocompleteinput tt-query" placeholder="Type to search" autocomplete="off" spellcheck="false" dir="auto" style="position: relative; vertical-align: top; background-color: rgba(0, 0, 0, 0);"></span>
<input class="add-new-customer" title="Add New Customer" type="button" value="+">
</div>
</div>
</div>
</div>
Does anyone know why my two elements don't line up?
http://jsfiddle.net/gq2279j2/4/
Try this with your style .add-new-customer{vertical-align: top;}
Working Demo
Set the vertical alignment of the button to top:
.add-new-customer {
vertical-align:top;
}
jsFiddle example
Use this CSS:
.display-field.roomy, .editor-field.roomy {
line-height: inherit;
}
Instead of the below CSS:
.display-field.roomy, .editor-field.roomy {
line-height: 1.9;
}
And place your both button in the same span:
<span class="twitter-typeahead" style="position: relative; display: inline-block;">
<input type="text" class="autocompleteinput tt-query"
placeholder="Type to search" autocomplete="off" spellcheck="false" dir="auto"
style="position: relative; vertical-align: top; background-color: rgba(0, 0, 0, 0);">
<input class="add-new-customer context-button noarrow" title="Add New Customer" type="button" value="+">
</span>

Bootstrap CSS - aligning absolute positioned buttons and inputs

http://jsfiddle.net/D2RLR/122/
I need to achieve the following:
contain the inputs within the the parent ordered-list/definition-list
have right edge of the arrow buttons sit flush against the right edge of each text input (thereby partly covering the inputs. I will later hide these and use jQuery to display on hover)
HTML
<div class="container">
<div class="row-fluid">
<div class="span4">
<form id="" class="well sidebar-nav">
<dl>
<dt><input type="text" class="counter nospace" name="myList_name" id="myList_name"/></dt>
<dd>
<ol>
<li><input type="text" name="myList_item_1" class="counter box" id="myList_item_1" /><div id="myList_chart_1" class="chart"><a class="btn" href="#">↑</a><a class="btn" href="#">↓</a></div></li>
<li><input type="text" name="myList_item_2" class="counter box" id="myList_item_2" /><div id="myList_chart_2" class="chart"><a class="btn" href="#" style="z-index:0">↑</a><a class="btn" href="#">↓</a></div></li>
<li><input type="text" name="myList_item_3" class="counter box" id="myList_item_3" /><div id="myList_chart_3" class="chart"><a class="btn" href="#">↑</a><a class="btn" href="#">↓</a></div></li>
<li><input type="text" name="myList_item_4" class="counter box" id="myList_item_4" /><div id="myList_chart_4" class="chart"><a class="btn" href="#">↑</a><a class="btn" href="#">↓</a></div></li>
<li><input type="text" name="myList_item_5" class="counter box" id="myList_item_5" /><div id="myList_chart_5" class="chart"><a class="btn" href="#">↑</a><a class="btn" href="#">↓</a></div></li>
</ol>
</dd>
</dl>
</form>
</div>
</div>
</div>
CSS
#import url('http://twitter.github.com/bootstrap/assets/css/bootstrap.css');
.sidebar-nav {
padding: 9px 0;
}
.nav {
list-style: decimal;
}
.counter {
width: 100%;
}
dt {
margin-left: 34px;
}
form dl dd ol {
position: relative;
}
.box {
position: absolute;
top: 0;
}
#myList_item_1, #myList_chart_1 { top: 0; }
#myList_item_2, #myList_chart_2 { top: 36px; }
#myList_item_3, #myList_chart_3 { top: 72px; }
#myList_item_4, #myList_chart_4 { top: 108px; }
#myList_item_5, #myList_chart_5 { top: 144px; }
ol li {
margin-bottom: 18px;
z-index: 0;
}
.chart {
width: 58px;
position: absolute;
top: 0;
z-index: 1;
margin-left: 100%;
margin-right: 0;
}
Okay - I'm almost there:
http://jsfiddle.net/D2RLR/151/
It was pretty much as simple as applying right: 0; to the .chart class.
The only thing I'm still struggling with is aligning the buttons against the inputs.

jquery wizard for user registration [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I Want some samples for step by step registrations like a wizard.
i want to use these samples and asp.net page.
Thanks.
You can easily create your own using jQuery - check out this demo
http://jsfiddle.net/nwJFs/
And here's the code
HTML
<div class="step step-1">
<div class="wrap">
<label for="name">Name</label>
<input id="name" type="text" />
</div>
<div class="wrap">
<label for="email">Email</label>
<input id="email" type="text" />
</div>
<div class="wrap">
<label for="phone">Phone</label>
<input id="phone" type="text" />
</div>
<br class="clear-last" />
<a class="button prev" href="#">Previous</a>
<a class="button next" href="#">Next</a>
</div>
<div class="step step-2">
<div class="wrap">
<label for="name">Mobile</label>
<input id="name" type="text" />
</div>
<div class="wrap">
<label for="email">Address</label>
<textarea id="email"></textarea>
</div>
<div class="wrap">
<label for="phone">Phone</label>
<input id="phone" type="text" />
</div>
<br class="clear-last" />
<a class="button prev" href="#">Previous</a>
<a class="button next" href="#">Next</a>
</div>
<div class="step step-3">
<div class="wrap">
<label for="name">Some</label>
<input id="name" type="text" />
</div>
<div class="wrap">
<label for="email">Other</label>
<textarea id="email"></textarea>
</div>
<div class="wrap">
<label for="phone">Fields</label>
<input id="phone" type="text" />
</div>
<br class="clear-last" />
<a class="button prev" href="#">Previous</a>
<a class="button next" href="#">Submit</a>
</div>
CSS
body {
font-family: Trebuchet MS;
font-size: 12px;
}
.wrap {
clear: both;
padding: 8px 0;
}
.wrap label {
display: block;
float: left;
width: 150px;
padding: 4px;
line-height: 12px;
}
.wrap input,
.wrap textarea {
display: block;
font-size: 12px;
line-height: 12px;
float: left;
width: 200px;
border: 1px solid #888;
padding: 4px 8px;
}
.button {
background: #333;
color: #f2f2f2;
display: inline-block;
padding: 4px 8px;
text-decoration: none;
border: 1px solid #ccc;
}
.button:hover {
background: #888;
color: #000;
}
br.clear-last {
clear: both;
margin: 15px 0;
}
.step {
display: none;
}
.step-1 {
display: block;
}
jQuery
$(".next").click(function() {
//store parent
var parent = $(this).parent();
if(parent.next().length) {
parent.hide("slow").next().show("slow");
}
return false;
});
$(".prev").click(function() {
var parent = $(this).parent();
if(parent.prev().length) {
parent.hide("slow").prev().show("slow");
}
return false;
});
check out this one : http://thecodemine.org
having problems with chrome though...
Do you mean, something like this?
jQuery Form Builder
checkout these links for better wizard creation:
techlab-smart wizard: http://techlaboratory.net/smartwizard
https://github.com/techlab/SmartWizard

Resources