I have a html/css modal on my page which is hosted here:
http://yousolutions.co.za/#openModalViewCreateClient
However, I need to be able to use the main scroller on the page to scroll down and view the rest of this form. My current CSS doesn't allow for this, and I don't want to add another scroll bar within the div. My code looks like this:
HTML:
<div id="openModalViewCreateClient" class="modalDialog">
<div>
X
<h2>Add A Client</h2>
<form class="contact_form" action="#" method="post" name="contact_form">
<ul>
<li>
<h2>Add New Client</h2>
</li>
<li>
<label for="name">First Name:</label>
<input type="text" placeholder="John" required />
</li>
<li>
<label for="name">Last Name:</label>
<input type="text" placeholder="Doe" required />
</li>
<li>
<label for="email">Email:</label>
<input type="email" name="email" placeholder="john_doe#example.com" required />
<span class="form_hint">Proper format "name#something.com"</span>
</li>
<li>
<label for="website">Website:</label>
<input type="url" name="website" placeholder="http://johndoe.com" required pattern="(http|https)://.+"/>
<span class="form_hint">Proper format "http://someaddress.com"</span>
</li>
<li>
<label for="message">Message:</label>
<textarea name="message" cols="40" rows="6" required ></textarea>
</li>
<li>
<button class="submit" type="submit">Submit Form</button>
</li>
</ul>
</form>
</div>
</div>
CSS:
.modalDialog:target {
opacity:1;
pointer-events: auto;
}
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.8);
z-index: 99999;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog > div {
width: 630px;
position: relative;
margin: 10% auto;
padding: 5px 20px 13px 20px;
border-radius: 10px;
background: #fff;
background: -moz-linear-gradient(#fff, #999);
background: -webkit-linear-gradient(#fff, #999);
background: -o-linear-gradient(#fff, #999);
}
.close {
background: #606061;
color: #FFFFFF;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
.close:hover { background: #00d9ff; }
You are using
position: fixed;
on .modalDialog, the viewport scrolling does not have any effect in this case on the modal
Try with absolute positioning -
position: absolute;
Related
I'm using the :focus property on an input so that when I click on it an effect occurs. However, even when I don't click on it, all the inputs have had the style contained within :focus applied as soon as I load the page.
.input-container {
position: relative;
}
.form {
background-color: white;
font-size: 16px;
overflow: hidden;
color: black;
border-radius: 10px;
width: 100%;
position: relative;
height: 100%;
padding-left: 7rem;
padding-right: 7rem;
padding-top: 5rem;
}
.form input {
outline: none;
position: relative;
margin: 0 auto;
width: 100%;
color: #595f6e;
padding-top: 30px;
border: none;
}
.form input:focus+.label-name .content-name,
.form input:valid+.label-name .content-name {
transform: translateY(-150%);
color: blue;
font-size: 14px;
}
.form input:focus+.label-name::after,
.form input:valid+.label-name::after {
transform: translateX(0%);
}
.form label {
position: absolute;
pointer-events: none;
bottom: 0px;
left: 0px;
width: 100%;
border-bottom: 2px solid black;
}
.form label::after {
content: "";
position: absolute;
left: 0px;
height: 100%;
width: 100%;
border-bottom: 3px solid blue;
transform: translateX(-100%);
transition: transform 0.3s ease;
}
.content-name {
position: absolute;
bottom: 5px;
left: 0px;
transition: all 0.3 ease;
}
<div class="form">
<div class="input-container u-margin-bottom-medium">
<input type="text" name="name" autocomplete="off">
<label for="name" class="label-name">
<span class="content-name">Name</span>
</label>
</div>
<div class="input-container u-margin-bottom-medium">
<input type="text" name="name" autocomplete="off">
<label for="name" class="label-name">
<span class="content-name">Email</span>
</label>
</div>
<div class="input-container u-margin-bottom-medium">
<input type="text" name="name" autocomplete="off">
<label for="name" class="label-name">
<span class="content-name">Message</span>
</label>
</div>
</div>
Does anyone know why this might be happening? Any help or suggestions are appreciated!
Since you need to test if there is text in the input, but want to wait until it's "valid" (this does not check to see if the actual data is valid, but rather that there is text). You can set the required attribute on the input fields. Technically, if there is no text in the input field, the field isn't "valid" until there is.
.input-container {
position: relative;
}
.form {
background-color: white;
font-size: 16px;
overflow: hidden;
color: black;
border-radius: 10px;
width: 100%;
position: relative;
height: 100%;
padding-left: 7rem;
padding-right: 7rem;
padding-top: 5rem;
}
.form input {
outline: none;
position: relative;
margin: 0 auto;
width: 100%;
color: #595f6e;
padding-top: 30px;
border: none;
}
.form input:focus+.label-name .content-name,
.form input:valid+.label-name .content-name {
transform: translateY(-150%);
color: blue;
font-size: 14px;
}
.form input:focus+.label-name::after,
.form input:valid+.label-name::after {
transform: translateX(0%);
}
.form label {
position: absolute;
pointer-events: none;
bottom: 0px;
left: 0px;
width: 100%;
border-bottom: 2px solid black;
}
.form label::after {
content: "";
position: absolute;
left: 0px;
height: 100%;
width: 100%;
border-bottom: 3px solid blue;
transform: translateX(-100%);
transition: transform 0.3s ease;
}
.content-name {
position: absolute;
bottom: 5px;
left: 0px;
transition: all 0.3 ease;
}
<div class="form">
<div class="input-container u-margin-bottom-medium">
<input type="text" name="name" autocomplete="off" required>
<label for="name" class="label-name">
<span class="content-name">Name</span>
</label>
</div>
<div class="input-container u-margin-bottom-medium">
<input type="text" name="name" autocomplete="off" required>
<label for="name" class="label-name">
<span class="content-name">Email</span>
</label>
</div>
<div class="input-container u-margin-bottom-medium">
<input type="text" name="name" autocomplete="off" required>
<label for="name" class="label-name">
<span class="content-name">Message</span>
</label>
</div>
</div>
I want to change the style of the toggle-button like this.
This is my sample code:
<div class="form-group has-feedback">
<input id="wffm302ebacf2b634d59b0dc1e81e451bc8d_Sections_0__Fields_6__Id" name="wffm302ebacf2b634d59b0dc1e81e451bc8d.Sections[0].Fields[6].Id" type="hidden" value="{D7AB5D2E-444F-49C7-91E4-564496D7C8A2}">
<div>
<input data-val="true" data-val-required="The Value field is required." id="wffm302ebacf2b634d59b0dc1e81e451bc8d_Sections_0__Fields_6__Value" name="wffm302ebacf2b634d59b0dc1e81e451bc8d.Sections[0].Fields[6].Value" type="checkbox" value="true" autocomplete="off" style="display: none;">
<span class="button-checkbox bootstrap-checkbox">
<button type="button" class="btn clearfix custom-btn">
<span class="icon fa fa-check theme-text" style="display:none;"></span>
<span class="icon fa fa-check-square"></span>
<span class="icon cb-icon-check-indeterminate" style="display:none;"></span>
</button>
</span>
<label class="switch">
<input name="wffm302ebacf2b634d59b0dc1e81e451bc8d.Sections[0].Fields[6].Value" type="checkbox" value="false">
<span class="slider round"></span>
</label>
</div>
<span class="field-validation-valid help-block" data-valmsg-for="wffm302ebacf2b634d59b0dc1e81e451bc8d.Sections[0].Fields[6].Value" data-valmsg-replace="true"></span>
</div>
Jsfiddle example
I tried few CSS but it is not exactly what I want. I tried:
.switchbtn:before {
position: absolute;
content: "";
height: 32px;
width: 26px;
background-color: black;
-webkit-transition: .4s;
transition: .4s;
}
You are on the right track. You can use the :before and :after pseudo CSS selectors to modify the look and feel of the toggle button. Since :before is already used to create the circular toggle, I have used :after to add the text. Obviously, there are more ways to do this, and the below is a just a quick way to show you how to achieve this.
Note that you will have to modify the pseudo selectors for both the states (normal and checked) as you want different colors.
Check the code snippet below and use that as a starting point to modify/tweak styles as per your need.
Hope this helps.
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.switchbtn {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
border: 2px solid #bbb;
-webkit-transition: .4s;
transition: .4s;
}
.switchbtn:before {
position: absolute;
content: "";
height: 34px;
width: 34px;
left: -2px;
top: -2px;
background-color: black;
-webkit-transition: .4s;
transition: .4s;
}
.switchbtn:after {
position: absolute;
content: "OFF";
right: 3px;
top: 10px;
font-size: 9px;
font-family: 'Arial';
-webkit-transition: .4s;
transition: .4s;
}
input:checked+.switchbtn {
background-color: white;
border: 2px solid #2196F3;
}
input:focus+.switchbtn {
box-shadow: 0 0 1px #2196F3;
}
input:checked+.switchbtn:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
background-color: #2196F3;
}
input:checked+.switchbtn:after {
position: absolute;
content: "ON";
left: 7px;
top: 10px;
font-size: 9px;
font-family: 'Arial';
-webkit-transition: .4s;
transition: .4s;
}
/* Rounded sliders */
.switchbtn {
border-radius: 34px;
}
.switchbtn:before {
border-radius: 50%;
}
.switch button {
display: none;
}
<label class="switch">
<input class="switchbtn" data-val="true" data-val-required="The Value field is required." id="wffm302ebacf2b634d59b0dc1e81e451bc8d_Sections_0__Fields_6__Value" name="wffm302ebacf2b634d59b0dc1e81e451bc8d.Sections[0].Fields[6].Value" type="checkbox" value="true" autocomplete="off" style="display: none;" aria-invalid="false" aria-describedby="wffm302ebacf2b634d59b0dc1e81e451bc8d\.Sections\[0\]\.Fields\[6\]\.Value-error wffm302ebacf2b634d59b0dc1e81e451bc8d\.Sections\[0\]\.Fields\[6\]\.Value-error">
<span class="button-checkbox bootstrap-checkbox switchbtn">
<button type="button" class="btn clearfix custom-btn">
<span class="icon fa fa-check theme-text" style="display: none;"></span>
<span class="icon fa fa-check-square" style="display: inline;"></span>
<span class="icon cb-icon-check-indeterminate" style="display:none;"></span>
</button></span><input name="wffm302ebacf2b634d59b0dc1e81e451bc8d.Sections[0].Fields[6].Value" type="hidden" value="false">
</label>
Hope this helps.
I have a problem and this isn't really my area and am not able to find a good solution, please help me. I want to make my slider on my website responsive. Do you have any idea how I should do it?
The slider needs to be smaller or be shaped differently when I make the window smaller. Can I use the #media rule or is it something else I should do?
Thanx for helping a beginner like me:)!
<ul class="slides">
<input type="radio" name="radio-btn" id="img-1" checked />
<li class="slide-container">
<div class="slide">
<img src="bilder/blommor.jpg" />
</div>
<div class="nav">
<label for="img-6" class="prev">‹</label>
<label for="img-2" class="next">›</label>
</div>
</li>
<input type="radio" name="radio-btn" id="img-2" />
<li class="slide-container">
<div class="slide">
<img src="bilder/Berg.jpg" />
</div>
<div class="nav">
<label for="img-1" class="prev">‹</label>
<label for="img-3" class="next">›</label>
</div>
</li>
<input type="radio" name="radio-btn" id="img-3" />
<li class="slide-container">
<div class="slide">
<img src="bilder/water.jpg" />
</div>
<div class="nav">
<label for="img-2" class="prev">‹</label>
<label for="img-4" class="next">›</label>
</div>
</li>
<input type="radio" name="radio-btn" id="img-4" />
<li class="slide-container">
<div class="slide">
<img src="bilder/ros.jpg" />
</div>
<div class="nav">
<label for="img-3" class="prev">‹</label>
<label for="img-5" class="next">›</label>
</div>
</li>
<input type="radio" name="radio-btn" id="img-5" />
<li class="slide-container">
<div class="slide">
<img src="bilder/glasogon.jpg" />
</div>
<div class="nav">
<label for="img-4" class="prev">‹</label>
<label for="img-6" class="next">›</label>
</div>
</li>
<li class="nav-dots">
<label for="img-1" class="nav-dot" id="img-dot-1"></label>
<label for="img-2" class="nav-dot" id="img-dot-2"></label>
<label for="img-3" class="nav-dot" id="img-dot-3"></label>
<label for="img-4" class="nav-dot" id="img-dot-4"></label>
<label for="img-5" class="nav-dot" id="img-dot-5"></label>
</li>
Css:
#import url(https://fonts.googleapis.com/css?family=Varela+Round);
html, body { background: #333 url("https://codepen.io/images/classy_fabric.png"); }
.slides {
padding: 0;
width: 609px;
height: 420px;
display: block;
margin: 0 auto;
position: relative;
}
.slides * {
user-select: none;
-ms-user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
}
.slides input { display: none; }
.slide-container { display: block; }
.slide {
top: 0;
opacity: 0;
width: 609px;
height: 420px;
display: block;
position: absolute;
transform: scale(0);
transition: all .7s ease-in-out;
}
.slide img {
width: 100%;
height: 100%;
}
.nav label {
width: 200px;
height: 100%;
display: none;
position: absolute;
opacity: 0;
z-index: 9;
cursor: pointer;
transition: opacity .2s;
color: #FFF;
font-size: 156pt;
text-align: center;
line-height: 380px;
font-family: "Varela Round", sans-serif;
background-color: rgba(255, 255, 255, .3);
text-shadow: 0px 0px 15px rgb(119, 119, 119);
}
.slide:hover + .nav label { opacity: 0.5; }
.nav label:hover { opacity: 1; }
.nav .next { right: 0; }
input:checked + .slide-container .slide {
opacity: 1;
transform: scale(1);
transition: opacity 1s ease-in-out;
}
input:checked + .slide-container .nav label { display: block; }
.nav-dots {
width: 100%;
bottom: 9px;
height: 11px;
display: block;
position: absolute;
text-align: center;
}
.nav-dots .nav-dot {
top: -5px;
width: 11px;
height: 11px;
margin: 0 4px;
position: relative;
border-radius: 100%;
display: inline-block;
background-color: rgba(0, 0, 0, 0.6);
}
.nav-dots .nav-dot:hover {
cursor: pointer;
background-color: rgba(0, 0, 0, 0.8);
}
input#img-1:checked ~ .nav-dots label#img-dot-1,
input#img-2:checked ~ .nav-dots label#img-dot-2,
input#img-3:checked ~ .nav-dots label#img-dot-3,
input#img-4:checked ~ .nav-dots label#img-dot-4,
input#img-5:checked ~ .nav-dots label#img-dot-5,
input#img-6:checked ~ .nav-dots label#img-dot-6 {
background: rgba(0, 0, 0, 0.8);
}
Hi
I am new to Primeng. I need to create a search box as shown in image.
I tried something like below, but not getting desired output.
<div class="ui-g-12">
<input type="text" [(ngModel)]="filterCriteria.searchValue">
<a href="#" class="search-icon">
<i class="fa fa-search" id="myimage" (click)="search()"></i>
</a>
</div>
Can anyone help how to do this in primeng?
Thanks
Like This
<form class="search-container">
<input type="text" id="search-bar" placeholder="What can I help you with today?">
<a href="#" class="search-icon">
<i class="fa fa-search"></i>
</a>
</form>
.css
.search-container{
width: 490px;
display: block;
margin: 0 auto;
}
input#search-bar{
margin: 0 auto;
width: 100%;
height: 45px;
border-radius: 5px;
padding: 0 20px;
font-size: 1rem;
border: 1px solid #D0CFCE;
outline: none;
&:focus{
border: 1px solid #008ABF;
transition: 0.35s ease;
color: #008ABF;
&::-webkit-input-placeholder{
transition: opacity 0.45s ease;
opacity: 0;
}
&::-moz-placeholder {
transition: opacity 0.45s ease;
opacity: 0;
}
&:-ms-placeholder {
transition: opacity 0.45s ease;
opacity: 0;
}
}
}
.search-icon .fa-search{
position: relative;
float: right;
width: 75px !important;
top: -39px;
right: -38px;
font-size: 30px;
}
I was looking for a good Material Design input tutorial - which I found here -, but when I tried to apply this in my code, the underlines don't match up.
The underline when focused is shorter than the regular border-bottom.
Here's the live example of what I mean: Codepen
And here's the code:
input {
font-size: 18px;
padding: 10px 10px 10px 5px;
display: block;
width: 300px;
border: none;
border-bottom: 1px solid #757575;
}
.bar {
position: relative;
display: block;
width: 300px;
}
.bar:before,
.bar:after {
content: '';
height: 2px;
width: 0;
bottom: 1px;
position: absolute;
background: rgba(37, 116, 169, 0.50);
transition: 0.2s ease all;
}
.bar:before {
left: 50%;
}
.bar:after {
right: 50%;
}
/* active state */
input:focus ~ .bar:before,
input:focus ~ .bar:after {
width: 50%;
}
<form>
<div class="group">
<input type="text" required>
<span class="bar"></span>
<label>Name</label>
</div>
<div class="group">
<input type="text" required>
<span class="bar"></span>
<label>Email</label>
</div>
</form>
Is there anyone who knows why this happens?
You need to set the box-sizing:border-box; on the input elements:
input {
font-size: 18px;
padding: 10px 10px 10px 5px;
display: block;
width: 300px;
border: none;
border-bottom: 1px solid #757575;
box-sizing:border-box;
outline:none;
}
.bar {
position: relative;
display: block;
width: 300px;
}
.bar:before,
.bar:after {
content: '';
height: 2px;
width: 0;
bottom: 1px;
position: absolute;
background: rgba(37, 116, 169, 0.50);
transition: 0.2s ease all;
}
.bar:before {
left: 50%;
}
.bar:after {
right: 50%;
}
/* active state */
input:focus ~ .bar:before,
input:focus ~ .bar:after {
width: 50%;
}
<form>
<div class="group">
<input type="text" required>
<span class="bar"></span>
<label>Name</label>
</div>
<div class="group">
<input type="text" required>
<span class="bar"></span>
<label>Email</label>
</div>
</form>
That, or set the width of the spans to about 315px which should match the width of the inputs when you factor in the border and padding.