Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Input Text top and left border have a different border color

Tags:

html

css

Heyy there, I have this text field I would like it to have a simpler border, but the left and top borders have a different(darker) color than the one I'm assigning them to be. I have been trying alot of different attributes in my CSS file.

this is the imageenter image description here

this is my css:

div#search_area input[type=text]{
    width: 179px;
    height: 23px;
    background: -webkit-gradient(linear, left top, left bottom, from (#ffffff), to (#f5f5f5));
    background: -webkit-linear-gradient(top, #ffffff, #f5f5f5);
    background: -moz-linear-gradient(top, #ffffff, #f5f5f5);
    background: -ms-linear-gradient(top, #ffffff, #f5f5f5);
    background: -o-linear-gradient(top, #ffffff, #f5f5f5);
    outline: 0;
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
    border-width: 1px;
    border-color: rgb(228,229,228);
    color: rgb(120,123,122);
    font-size: 13px;
    font-family: Arial, serif;
    text-decoration: none;
    vertical-align: middle;
    padding: 0px 0px 0px 0px;
}
like image 900
mikkuslice Avatar asked Nov 27 '13 22:11

mikkuslice


People also ask

How do you make a two color border in CSS?

If you mean using two colours in the same border. Use e.g. border-right: 1px white solid; border-left: 1px black solid; border-top: 1px black solid; border-bottom: 1px white solid; there are special border-styles for this as well ( ridge , outset and inset ) but they tend to vary across browsers in my experience.

How do you add two colors to a border?

To achieve a multi-color border like shown above, we will use the position property and the ::after selector with a color gradient. First, we will make a header area using a HTML <div> class and then we will style it with CSS to have a multi-color border dividing it and the content below.


2 Answers

you need to also add

border-style: solid;

or dashed, or dotted, whichever one you want

like image 145
CRABOLO Avatar answered Sep 20 '22 21:09

CRABOLO


This is because your border-style is most likely set to inset. If you change it to a different style, it won't create the "3D" effect that is causing the two different colors. See here for more details on border-style https://developer.mozilla.org/en-US/docs/Web/CSS/border-style

like image 40
Dryden Long Avatar answered Sep 18 '22 21:09

Dryden Long