I'm trying to insert a data-icon to two input fields, but they keep shifting my input fields to the right, like they where adding a margin-left to it.
I'm using z-index:2 to the icons in order to keep them floating above the fields and they do, but the added margin is still there.
Here's my css:
#loginBox input#username, #loginBox input#password {
height: 20px;
width: 120px;
padding: 5px 5px 5px 32px;
border: 1px solid rgb(178, 178, 178);
box-sizing : content-box;
border-radius: 3px;
box-shadow: 0px 1px 4px 0px rgba(168, 168, 168, 0.6) inset;
transition: all 0.2s linear;
}
#loginBox [data-icon]:before {
content: attr(data-icon);
font-family: FontomasCustomRegular;
color: #999;
position: relative;
left: 25px;
z-index: 2;
}
And here's a screenshot:
Any thoughts?
Thanks.
Sanjeev and Stéphanie Walter's code in nearly identical
http://www.infotuts.com/email-verification-php/
http://tympanus.net/codrops/2012/03/27/login-and-registration-form-with-html5-and-css3/
[data-icon]:after {
content: attr(data-icon);
font-family: 'FontomasCustomRegular';
color: rgb(106, 159, 171);
position: absolute;
left: 10px;
top: 35px;
width: 30px;
}
position: absolute;
Related
I am creating a dropdown box for the account at the top right corner of the window.
I have added the code for the :before but does not seem to show above the element. The :before element is meant to be a triangle at the top of the ul container which points to where the dropdown has come from.
.DropDownContainer{
color: rgba(0, 0, 0, 0.87);
background-color: rgb(255, 255, 255);
transition: transform 250ms cubic-bezier(0.23, 1, 0.32, 1) 0ms, opacity 250ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
box-sizing: border-box;
font-family: Roboto, sans-serif;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
box-shadow: rgba(0, 0, 0, 0.12) 0px 1px 6px, rgba(0, 0, 0, 0.12) 0px 1px 4px;
border-radius: 2px;
position: fixed;
z-index: 2100;
opacity: 1;
transform: scale(1, 1);
transform-origin: left top;
max-height: 670px;
overflow-y: auto;
float: left;
text-align: left;
top: 55px;
right: 20px;
padding: 26px 0;
border-radius: 8px;
position: absolute;
top: calc(60px - 10px);
width: 210px;
list-style: none;
background-clip: padding-box;
padding-left:0;
}
.DropDownContainer:before{
content: '';
width: 0;
height: 0;
position: absolute;
top: -20px;
right: 120px;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
}
.DropDownButton{
display: flex;
justify-content: left;
padding: 10px;
padding-left: 28px;
padding-right: 28px;
letter-spacing: 1px;
color: rgb(38, 38, 38);
}
.DropDownButton a{
text-decoration: none;
}
.DropDownButton img{
height: 20px;
width: 20px;
margin-right: 10px;
}
.DropDownButton:hover{
background-color: rgba(36, 36, 36, 0.071);
cursor: pointer;
}
(<ul className={classes.DropDownContainer}>
<li className={classes.DropDownButton} onClick={() => setShowDropDown(false)}>Profile</li>
<li className={classes.DropDownButton}>Edit Profile</li>
<li className={classes.DropDownButton}>My Hub</li>
<li className={classes.DropDownButton} >My Favourites</li>
<li className={classes.DropDownButton} >My Must Reads</li>
<li className={classes.DropDownButton}>Account Settings</li>
<li className={classes.DropDownButton} >Sign Out</li>
</ul>)
It is meant to be a triangle at the top of the ul container.
You should write two colons not only a colon for ' before '. I mean your code should be as such :
.DropDownContainer::before {
content: '';
width: 0;
height: 0;
position: absolute;
top: -20px;
right: 120px;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
}
I think this is very simple, but I'm not sure how it's implemented. So let's say I have an input field that is originally centered to the page (vertically & horizontally). However, I want to animate the input box to the top of the page when the user starts typing, how would this be implemented? My initial thought would be to assign the top:0 and transform it on focus. Is it more complex than that?
Please enlighten me.
input.input-student-search {
position: absolute;
top: 50%;
transform: translateY(0px);
padding: 27px 145px 27px 38px;
margin: 10px;
width: 100%;
border: none;
box-shadow: 0 10px 20px rgba(198, 198, 198, 0.02), 0 6px 6px rgba(221, 221, 221, 0.23);
border-radius: 6px;
text-align: left;
&:focus {
top: 0;
}
}
This is how I did it:
.txt {
position: relative;
text-align: center;
width: 90%;
margin: 0 20px 0 20px;
top: 200px;
transition: top 0.4s;
}
.txt:focus{
top:0;
}
Here is the JSFiddle demo
Just put top:0 in a :focus style:
input.input-student-search:focus {
top:0;
}
input.input-student-search {
background-color:#AAA;
position: absolute;
top: 50%;
transform: translateY(0px);
padding: 27px 145px 27px 38px;
margin: 10px;
width: 100%;
border: none;
box-shadow: 0 10px 20px rgba(198, 198, 198, 0.02), 0 6px 6px rgba(221, 221, 221, 0.23);
border-radius: 6px;
text-align: left;
transition:top 1s linear;
}
input.input-student-search:focus {
top:0;
}
<input class="input-student-search" type="text"/>
I try to animate my search button.
When you click on it, it should expand and slide to the side.
The animation is no problem in css, but in front of the search bar is a div, which does not follow the expanding search bar.
<form>
<div class="test"></div>
<input type="search" placeholder="Search">
</form>
form{
float:right;
}
input[type=search] {
background: #E75757 url(http://nerdlove.de/Blog/img/search_icon.svg) no-repeat 15px center;
background-size: 25px;
border: none;
padding: 10px 10px 10px 10px;
width: 35px;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
text-indent:-999px;
}
input[type=search]:focus {
width: 150px;
background-position: -30px;
text-indent: 0px;
}
.test{
float:left;
}
.test:before{
content: no-close-quote;
border-top: 40px solid rgba(0, 0, 0, 0);
border-left: 0px solid rgba(0, 0, 0, 0);
border-right: 18px solid #E75757;
float: right;
right: 55px;
position: absolute;
}
Example
I would add the :before to the input. But it is not possible in css.
Edit
HERE IS WHAT I WANT
Just position the .test element as relative and the :before to right: 0;.
.test{
float:left;
position: relative;
}
.test:before{
content: no-close-quote;
border-top: 40px solid rgba(0, 0, 0, 0);
border-left: 0px solid rgba(0, 0, 0, 0);
border-right: 18px solid #E75757;
float: right;
right: 0;
position: absolute;
}
Demo
I have one question with inverted triagle image overlay. I have created this DEMO from codepen.io.
What i want in my demo you can see there is a bubble div inside an image. a triangle on the right side of the image looks.I would like it to appear in the triangle in the picture. How can i do this anyone can help me ?
CSS:
.bubble
{
position: fixed;
width: 345px;
height: 235px;
padding: 0px;
background: #FFFFFF;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
border: #d8dbdf solid 1px;
-webkit-box-shadow: -1px 1px 1px 0px rgba(216, 219, 223, 0.52);
-moz-box-shadow: -1px 1px 1px 0px rgba(216, 219, 223, 0.52);
box-shadow: -1px 1px 1px 0px rgba(216, 219, 223, 0.52);
}
.bubble:after
{
content: '';
position: absolute;
border-style: solid;
border-width: 10px 0 10px 10px;
border-color: transparent #fff;
display: block;
width: 0;
z-index: 1;
right: -10px;
top: 16px;
}
.bubble:before
{
content: '';
position: absolute;
border-style: solid;
border-width: 10px 0 10px 10px;
border-color: transparent #d8dbdf;
display: block;
width: 0;
z-index: 0;
right: -11px;
top: 16px;
}
.film_bilgileri{
float:left;
width:345px;
height:235px;
background-color:red;
}
.film_kapak{
float:left;
width:345px;
height:120px;
background-color:white;
overflow:hidden;
}
.film_kapak img {
width:100%;
-webkit-transition: -webkit-transform 0.5s ease;
-moz-transition: -moz-transform 0.5s ease;
-webkit-backface-visibility: hidden;
}
HTML:
<div class="container">
<div class="bubble">
<div class="film_bilgileri">
<div class="film_kapak">
<img src="abc.jpg">
</div>
</div>
</div>
</div>
One way is to create a transparent triangle using white borders, and masking above and below using an element with white background.
transparent triangle using white masking is created by:
border-left: 11px solid transparent;
border-top: 11px solid white;
border-bottom: 11px solid white;
working example: http://jsfiddle.net/064ojpm8/
(note - it's not production material, but merely to give you the idea)
If you want your triangle point towards your image, you can use the code from Sgoldy in your :after pseudo-element:
.bubble:after {
content: '';
position: absolute;
width: 0;
border-right: 11px solid white;
border-top: 11px solid transparent;
border-bottom: 11px solid transparent;
z-index: 1;
right: 0px;
top: 36px;
}
I just moved the element to the left with right: 0px; and altered the border values.
You don't need the :before
DEMO
I have been working on debugging our web app for days now, and I am not sure what is causing it to crash in mobile safari. The app works wonderfully on the iPad2, but for some reason it crashes on the iPad3. I commented out every piece of code, and what seems to be the problem is absolute positioning on an element. Here is my code for the section.
.page .main-content .study-bo {
background: #F4F4F4;
border-top: 1px solid #D1D1D1;
border-bottom: 1px solid #D1D1D1;
width: 644px;
position: absolute;
top: 501px;
left: 0px;
padding: 30px 40px;
z-index:500;
-webkit-transition: top .5s ease-in-out;
}
.page .main-content .study-bo .text {
width: 100%;
height: 100%;
position: relative;
left:auto;
}
.page .main-content .study-bo p {
font-family: "FrutigerRoman";
font-size: 12px;
color: #000000;
margin-bottom: 15px;
}
.page .main-content .study-bo .study-design {
width: 92px;
height: 20px;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(199, 199, 199, 1)), color-stop(100%,rgba(167, 167, 167, 1)));
-webkit-border-radius: 5px 5px 0px 0px;
border: 1px solid #999;
font-family: "FrutigerItalic";
font-size: 13px;
color: white;
text-shadow: 1px 1px 0px #8E8E8E;
filter: dropshadow(color=#8e8e8e, offx=1, offy=1);
text-align: center;
padding-top: 4px;
-webkit-box-shadow: inset 0px 1px 0px 0px #e5e4e4;
position: absolute;
top: -26px;
font-style: italic;
z-index: 50;
left: 44px;
}
.page .main-content .study-bo .study-design .btn.active {
background: #6c6a6a;
text-shadow: 1px 1px 0px #434343;
filter: dropshadow(color=#434343, offx=1, offy=1);
-webkit-box-shadow: inset 0px 1px 0px 0px #9e9d9d;
}
The part in the code that is making the app crash is:
position: absolute;
top: 501px;
left: 0px;
I am not sure if this is an apple bug? I have multiple elements positioned absolute with no problems. If I comment out those three lines (and only those three lines), the app works. I have tried commenting out other sections of my code and keeping those three lines in, and it doesnt work. Anyone have any suggestions?? Thank you!
It could be a bug, but it's hard to say without seeing and exploring the webapp first-hand. I would try to fiddle with the layout to try to:
get relative positioning to work, instead of absolute,
using percentages instead of pixels in the top and left attributes,
working with float:left or float:right, with margins or padding, instead of absolute positioning,
apply a CSS reset/normalizer before your other CSS, like normalize.css, to see if that magically fixes the problem,
or as a last resort, look into an alternative layout that doesn't force you to use absolute positioning here.
These are all shots in the dark, but maybe they'll help.