Cannot set textarea inner border shadow (still need help) - html

EDIT: Hoping someone will see this one. I'm stuck and have tried several things since posting it, but to no avail.
I'm trying to display a textarea with a border shadow. For some weird reason, while other regular text input boxes on the page are displaying their inner shadows correctly, textareas do not show any inner shadows at all. How do I force textarea to display the shadow as the other input boxes do?
Here is the HTML I'm using.
<textarea class="form-control upladfieldset notes-field" rows="6"></textarea>
Note that when I remove the entire class attribute of
class="form-control upladfieldset notes-field"
the inner border shadow appears, but then of course all my other styling is gone which is not ideal. So I also tried commenting out individual lines of CSS in those classes to see which line is causing a conflict, but the only thing that gets the inner shadow to appear is if I remove the class attribute declaration altogether.
Here is the CSS I'm using.
.form-control
{
color: #34495e;
border-color: transparent;
border: none !important;
border-bottom-width: 0px;
border-bottom: none;
font-size: 16px;
line-height: 1.467;
padding: 8px 12px 8px 66px;
height: 54px;
-webkit-appearance: none;
-webkit-box-shadow: none;
box-shadow: none;
-webkit-transition: border .25s linear, color .25s linear, background-color .25s linear;
transition: border .25s linear, color .25s linear, background-color .25s linear;
background-repeat: no-repeat;
}
.uploadfieldset
{
border: none;
border-radius: 0;
padding: 0;
}
.notes-field
{
background-clip: border-box;
background-size: contain
border-radius:0;
height: 54px;
width: 680px;
font-family: 'gotham_htfbook';
font-size: 18px;
color: #000000;
text-transform: none;
text-align: left;
font-weight: normal;
}
input[type=text], textarea
{
-webkit-appearance: none;
-webkit-transition: all 0.30s ease-in-out;
-moz-transition: all 0.30s ease-in-out;
-ms-transition: all 0.30s ease-in-out;
-o-transition: all 0.30s ease-in-out;
box-shadow: 0 0 5px rgba(89, 89, 89, 1);
padding: 3px 0px 3px 3px;
margin: 5px 1px 3px 0px;
border: 1px solid rgba(204, 204, 204, 1);
}
input[type=text]:focus, textarea:focus
{
box-shadow: 0 0 5px rgba(89, 89, 89, 1);
padding: 3px 0px 3px 3px;
margin: 5px 1px 3px 0px;
border: 1px solid rgba(204, 204, 204, 1);
}

Well... you have a lot of things going on here, but I believe I may have achieved your desired result (I'm not 100% sure I understand what you want, but I'm operating under the assumption that you want your textarea to include a border and box-shadow identical to your input field). I believe the main problem here is mainly to do with hierarchy fundamentals. Because of that, I feel like there's a few things that should be said before we tackle our actual code here. In principle, you should have more general rules towards the top of your stylesheet and more specific ones as you go down. Resets (the raw elements like textarea, input, etc.) should be at the top--or at the very least, above the classes you wish to apply to those elements.
Also, I strongly encourage you to avoid using !imporant. If you find yourself needing to use !imporant, that generally means that your real problem lies elsewhere. It shows that you're now trying to work against the natural flow of CSS to force it to cover up something else. And what happens when you need to override that rule? You're going to have to write an even more specific rule, and the whole thing can very quickly turn into a mess.
So with that said, for the sake of familiarity, I have taken your code and commented out the problematic lines and have included explanations as to why they're preventing you from achieving what you want.
.form-control
{
color: #34495e;
/*border-color: transparent; Because of this, even if you had a border, you wouldn't be able to see it (assuming you didn't override it later). */
/*border: none !important; 1. Use of !important. 2. Your border isn't showing because this is explicitly telling it not to. */
/*border-bottom-width: 0px; You're getting rid of the bottom border. */
/*border-bottom: none; You're getting rid of the bottom border. */
font-size: 16px;
line-height: 1.467;
padding: 8px 12px 8px 66px;
height: 54px;
-webkit-appearance: none;
/*-webkit-box-shadow: none; Explicitly telling it not to have a box-shadow */
/* box-shadow: none; Explicitly telling it not to have a box-shadow */
-webkit-transition: border .25s linear, color .25s linear, background-color .25s linear;
transition: border .25s linear, color .25s linear, background-color .25s linear;
background-repeat: no-repeat;
}
.uploadfieldset
{
/*border: none; Explicitly telling it not to have a border */
border-radius: 0;
padding: 0;
}
.notes-field
{
background-clip: border-box;
background-size: contain
border-radius:0;
height: 54px;
width: 680px;
font-family: 'gotham_htfbook';
font-size: 18px;
color: #000000;
text-transform: none;
text-align: left;
font-weight: normal;
}
input[type=text], textarea
{
-webkit-appearance: none;
-webkit-transition: all 0.30s ease-in-out;
-moz-transition: all 0.30s ease-in-out;
-ms-transition: all 0.30s ease-in-out;
-o-transition: all 0.30s ease-in-out;
box-shadow: 0 0 5px rgba(89, 89, 89, 1);
padding: 3px 0px 3px 3px;
margin: 5px 1px 3px 0px;
border: 1px solid rgba(204, 204, 204, 1);
}
input[type=text]:focus, textarea:focus
{
box-shadow: 0 0 5px rgba(89, 89, 89, 1);
padding: 3px 0px 3px 3px;
margin: 5px 1px 3px 0px;
border: 1px solid rgba(204, 204, 204, 1);
}
However, here, I have re-ordered some of your lines in order to implement some of the principles I mentioned earlier. Because I don't know what you're going to use this for, I tried not to tamper with things when it was not directly necessary. I also did not delete any of your lines. Instead, I simply commented them out so you can follow along and see what I actually did. You can delete them yourself if you so wish to.
input[type=text], textarea /* Moved to the top of your stylesheet */
{
-webkit-appearance: none;
-webkit-transition: all 0.30s ease-in-out;
-moz-transition: all 0.30s ease-in-out;
-ms-transition: all 0.30s ease-in-out;
-o-transition: all 0.30s ease-in-out;
box-shadow: 0 0 5px rgba(89, 89, 89, 1); /* Reminder: You're defining your box-shadow here */
padding: 3px 0px 3px 3px;
margin: 5px 1px 3px 0px;
border: 1px solid rgba(204, 204, 204, 1); /* Reminder: You're defining your border here */
}
input[type=text]:focus, textarea:focus /* Moved to the top of your stylesheet */
{
/*box-shadow: 0 0 5px rgba(89, 89, 89, 1); No need to redefine in :focus. It will be in inherited. */
padding: 3px 0px 3px 3px; /* See: padding in .uploadfieldset (below) */
/*margin: 5px 1px 3px 0px; No need to redefine in :focus. It will be in inherited. */
/*border: 1px solid rgba(204, 204, 204, 1); No need to redefine in :focus. It will be in inherited. */
}
.form-control
{
color: #34495e;
/*border-color: transparent; This will hide previously defined border. */
/*border: none !important; This will override previously defined border. Remember, don't use !important.*/
/*border-bottom-width: 0px; This will get rid of the bottom border. */
/*border-bottom: none; This will get rid of the bottom border. */
font-size: 16px;
line-height: 1.467;
padding: 8px 12px 8px 66px;
height: 54px;
-webkit-appearance: none;
/*-webkit-box-shadow: none; This will override previously defined box-shadows. */
/* box-shadow: none; This will override previously defined box-shadows. */
-webkit-transition: border .25s linear, color .25s linear, background-color .25s linear;
transition: border .25s linear, color .25s linear, background-color .25s linear;
background-repeat: no-repeat;
}
.uploadfieldset
{
/*border: none; This will override previously defined borders. */
border-radius: 0;
padding: 0; /* This tells your text field to not have any padding. However, when you click on your textarea, the padding set by textarea:focus will override THIS. */
}
.notes-field
{
background-clip: border-box;
background-size: contain
border-radius:0;
height: 54px;
width: 680px;
font-family: 'gotham_htfbook';
font-size: 18px;
color: #000000;
text-transform: none;
text-align: left;
font-weight: normal;
}
If you try either of those with this markup:
<textarea class="form-control upladfieldset notes-field" rows="6"></textarea>
<input type="text">
You can see that both fields are stylized likewise. I hope this helps.

Related

-webkit-background-clip not working in Safari

The code below works on Chrome but not on Safari. I cannot work out why, so any help would be greatly appreciated. A live demo can be found at https://jacobcxdev.me/beta/ (while the problem persists). A screen recording can be found here.
CSS:
body {
background-color: red;
}
.button {
margin: 10px;
padding: 10px 20px 10px 20px;
font-size: 4vmin;
font-weight: 100;
border-radius: 10px;
border-width: 1px;
border-color: transparent;
color: white;
text-shadow: 0px 0px 6px rgba(255, 255, 255, 1);
background-clip: text;
-webkit-background-clip: text;
transition: box-shadow, background-color;
transition-duration: 0.5s;
-webkit-transition: box-shadow, background-color;
-webkit-transition-duration: 0.5s;
transition-timing-function: ease;
-webkit-transition-timing-function: ease;
}
.button:hover {
transition: box-shadow, background-color, text-shadow, color;
transition-duration: 0.5s;
-webkit-transition: box-shadow, background-color, text-shadow, color;
-webkit-transition-duration: 0.5s;
transition-timing-function: ease;
-webkit-transition-timing-function: ease;
text-shadow: none;
}
#media (hover: hover) {
.button:hover {
background-clip: text;
-webkit-background-clip: text;
background-color: black;
color: transparent;
text-shadow: none;
box-shadow: 0px 0px 10px -5px white, inset 0px 0px 200px -50px white;
}
}
<body>
<button class="button" onclick="location.href='about/'">About me</button>
</body>
<!--hover to view text-->
It looks like the color "transparent" on hover is being treated differently between browsers. You can change your CSS to pick the color you intend the text to be and this will work for Chrome and Safari.
#media (hover: hover) {
.button:hover {
background-clip: text;
-webkit-background-clip: text;
background-color: black;
color: black; /* change this color */
text-shadow: none;
box-shadow: 0px 0px 10px -5px white, inset 0px 0px 200px -50px white;
}
}

Input text-box not responding on chrome [CSS/HTML]

I am having an issue getting a text input box to work correctly on Chrome. It works as it should in Firefox; however, in Chrome it is completely unresponsive. It does not display the hover effect or even allow you to type into the box. My first thought was I am missing a webkit, but I am not sure which one. (I am fairly new to CSS/html). See the code I am using below:
As you can see, it works as it should if you run the snippet.
input[type="text"] {
display: block;
margin: 0;
width: 60%;
font-family: arial;
font-size: 12px;
color: #e2e2e2;
appearance: none;
box-shadow: none;
border-radius: none;
}
input[type="text"]:focus {
outline: none;
}
.promocode input[type="text"] {
padding: 10px;
margin-left: 1px;
border: solid 0px #2c303b;
background-color: rgba(74, 80, 99, .5);
transition: box-shadow 0.3s, border 0.3s;
transition: background-color 0.3s ease-in-out;
-webkit-transition: box-shadow 0.3s, border 0.3s;
-webkit-transition: background-color 0.3s ease-in-out;
-moz-transition: box-shadow 0.3s, border 0.3s;
-moz-transition: background-color 0.3s ease-in-out;
-o-transition: box-shadow 0.3s, border 0.3s;
-o-transition: background-color 0.3s ease-in-out;
}
.promocode:hover input[type="text"] {
background-color: rgba(74, 80, 99, .8);
}
.promocode input[type="text"]:focus,
.promocode input[type="text"].focus {
border: solid 0px #2c303b;
box-shadow: 0 0 4px 1px rgba(0, 0, 0, .25);
}
<div id="promoMsgPane" class="alignLeft" style="font-size: 12px; text-align:left; padding-top: 2em; margin-left: 0px;">
<p style="margin-bottom: 15px;">Enter your promo code below</p>
</div>
<div id="PromoIDPane">
<div class="input-list promocode clearfix">
<input id="txtPromoID" placeholder="Enter code" type="text" />
</div>
</div>

box shadow element into button tag

Shadows work properly on all elements, on IE and Firefox, but not for the button element in Chrome and Safari:
http://jsfiddle.net/q8xaa/
<button class="btn-test">
<span class="btn">test</span>
</button>
.btn-test {
background-color: transparent;
border: 0;
padding: 0px;
}
.btn-test:hover .btn {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.btn-test .btn {
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear;
-webkit-box-shadow: 4px 4px 0px #000;
-moz-box-shadow: 4px 4px 0px #000;
box-shadow: 4px 4px 0px #000;
background-color: #f00;
margin: 0px;
padding: 10px;
height: 40px;
display: inline-block;
}
button {
margin: 0;
padding: 0;
border: 0;
overflow: visible;
}
Any ideas on how to solve?
Example http://jsfiddle.net/H23Jy/1/
I tried forcing a zero CSS3 transformation as shown below
CSS
button span {
-webkit-transform: translate3d(0,0,0);
}
and the shadow seems to work fine also on Chrome 35.
But as you can see, in that way the button is not vertically aligned with the other buttons, so you could use -webkit-transform: translateY(-3px); instead
Result

Modifying button padding shifts other elements down?

I have been trying to create a button in CSS that appears to look "pushed down" on :active, to do this, I added 2px to padding-top and subtracted 2px from padding-bottom. However, this seems to add a margin to other elements, though I cannot figure out why.
I'm sure the solution is a simple one to experienced CSS-users.
http://jsfiddle.net/hTTWq/
You are using inline-block on the buttons who's default alignment is 'baseline`.
Try changing this by adding this to your buttton CSS
vertical-align: top; /* or middle or bottom */
JSfiddle Demo
Many ways to do this, but to move the whole button (and not just the text), you could do something like this, which alters margin-top rather than padding:
*:active, *:focus {
outline: none;
}
button {
display: inline-block;
margin: 0;
border: 0;
padding: 8px 16px;
border-radius: 4px;
background-color: #a9a9a9;
color: #fff;
overflow: hidden;
transition: padding-top 100ms linear, padding-bottom 100ms linear, box-shadow 100ms linear, -webkit-filter 100ms linear;
vertical-align: top;
}
button.suggested {
background-color: #0074d9;
}
button:active {
-webkit-filter: brightness(0.5);
margin-top: 2px;
box-shadow: 0 2px rgba(0, 0, 0, 0.5) inset;
vertical-align: bottom;
}

In Windows 8 Chrome The Search Box Stylings Got Messed Up?

I just added some stylings to the search box which make the corners round and add some more effects. When trying the site in Chrome and firefox under Linux, things are working fine. Its also working fine in IE 10 (in windows 8). But in Windows 8 Chrome (Not the Metro version), the stylings got messed up! why is it? Here are the stylings I added :
#top-search {
border: 1px solid #BABABA;
-webkit-border-radius: 18px 18px 18px 18px;
-moz-border-radius: 18px 18px 18px 18px;
-o-border-radius: 18px 18px 18px 18px;
border-radius: 18px 18px 18px 18px;
box-shadow: 0 0 4px #CFCFCF;
color: #696969;
float: right;
font-size: 11px;
margin-right: 2%;
margin-top: 8px;
opacity: 0.7;
padding: 3px 3px 3px 7px;
width: 6%;
outline: none;
-webkit-transition: all 0.3s ease-in;
-moz-transition: all 0.3s ease-in;
-o-transition: all 0.3s ease-in;
-ms-transition: all 0.3s ease-in;
transition: all 0.3s ease-in;
&:hover, &:focus, {
opacity: 1;
width: 8%;
}
}
Here's how the search box appear :
Simply changed the input type from "search" to "text"