Can anybody help me styling a textbox border like in image only by css.I have tried the following css but not working perfectly
.addfolder-input {
border: medium none;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
margin-bottom: 20px;
width: 100%;
padding: 0 10px;
border-top: 0;
border-right: 0;
border-bottom: solid 2px #3c5a9a;
border-left: 0;
border-radius:5px;
}
This is one possible approach by using a container element around the text box and then adding an absolutely positioned pseudo-element to the container which is rotated along the X-axis with a bit of perspective.
Rotating along the X-axis with perspective makes the rectangle look as though it sides are going away from each other as we go from bottom of the rectangle to its top. The top-border of the pseudo-element is nullified as we don't need it.
Whatever width is required for the text-box should be set to the container as both the pseudo-element and the text-box derive their `width (100%) from their container.
.addfolder-input {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
margin-bottom: 20px;
width: 100%;
padding: 0 10px;
border: none;
outline: none;
}
.container {
position: relative;
width: 100px;
}
.container:after {
position: absolute;
content: '';
bottom: 48%;
left: 6px;
width: 100%;
height: 6px;
border: 2px solid #3c5a9a;
border-top: none;
-webkit-transform: perspective(10px) rotateX(-10deg);
-moz-transform: perspective(10px) rotateX(-10deg);
transform: perspective(10px) rotateX(-10deg);
}
<div class="container">
<input type="text" class="addfolder-input" value="Type Something..."/>
</div>
Here is another alternate using multiple backgrounds, linear-gradients and background positioning. This can also work but in some browsers the angular edges/borders become a bit jagged.
.addfolder-input {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
margin-bottom: 20px;
width: 85%;
padding: 0 10px;
border: none;
outline: none;
position: relative;
left: 6px;
}
.container {
position: relative;
width: 120px;
}
.container:after {
position: absolute;
content: '';
bottom: 48%;
left: 6px;
width: 100%;
height: 6px;
background: -webkit-linear-gradient(45deg, transparent 9%, #3c5a9a 9%, #3c5a9a 12%, transparent 12%), -webkit-linear-gradient(-45deg, transparent 9%, #3c5a9a 9%, #3c5a9a 12%, transparent 12%), -webkit-linear-gradient(0deg, transparent 9%, #3c5a9a 9%, #3c5a9a 95%, transparent 11%) no-repeat;
background: -moz-linear-gradient(45deg, transparent 9%, #3c5a9a 9%, #3c5a9a 12%, transparent 12%), -moz-linear-gradient(-45deg, transparent 3%, #3c5a9a 3%, #3c5a9a 6%, transparent 6%), -moz-linear-gradient(90deg, transparent 9%, #3c5a9a 9%, #3c5a9a 86%, transparent 86%) no-repeat;
background: linear-gradient(45deg, transparent 9%, #3c5a9a 9%, #3c5a9a 12%, transparent 12%), linear-gradient(-45deg, transparent 3%, #3c5a9a 3%, #3c5a9a 6%, transparent 6%), linear-gradient(90deg, transparent 9%, #3c5a9a 9%, #3c5a9a 86%, transparent 86%) no-repeat;
background-position: 0px 6px, 107px 6px, 0px 4px;
}
<div class="container">
<input type="text" class="addfolder-input" value="Type Something..." />
</div>
Related
I'm trying to reproduce (as close as possible) in CSS a gradient I've seen.
I managed to get close to it but I can't do better.
Here is the image of the gradient:
Gradient to reproduce
And here is my HTML / CSS code:
*, *:before, *:after { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body {display: flex; align-items: center; justify-content: center;}
.logo {
background:
radial-gradient(circle farthest-corner at 10% 90%, #FFF200, transparent 50%),
radial-gradient(circle farthest-corner at 10% 130%, #FFF200, transparent 50%),
radial-gradient(circle farthest-corner at 150% 150%, #ed4444, transparent),
radial-gradient(circle farthest-corner at 170% 170%, #ed4444, transparent),
linear-gradient(#627AFF 40%, transparent);
border-radius: 50%;
font-size: 250px;
height: 1em;
position: relative;
width: 1em;
}
.logo:before {
content: "D";
color: white;
position: absolute;
left: 67px;
top: 17px;
font-size: 175px;
}
<div class='logo'></div>
Thank you in advance,
the best i can do for you, wish it helps you.
good luck,
.logo {
background:
radial-gradient(circle farthest-side at 50% 180%, white 15%, transparent 20%),
radial-gradient(closest-corner at 121% 84%, #ef5d5d 190%, transparent 307%),
radial-gradient(closest-side at 40% 77%, #fff64d 76%, transparent 185%),
linear-gradient(#9933ff 10%, transparent);
border-radius: 50%;
font-size: 250px;
height: 1em;
position: relative;
width: 1em;
}
.logo:before {
font-family: 'Brush Script MT', cursive;
content: "D";
color: white;
position: absolute;
left: 67px;
top: 17px;
font-size: 175px;
}
<div class='logo'></div>
I set the custom dropdown arrow using css but it is not clickable right know. So how can i fix that?
.container select{
border-radius: 20px;
padding: 5px 38px 7px 23px;
border: 2px solid orange;
appearance: none;
position: relative;
}
.container i.fa-angle-down{
position: absolute;
right: 66.8%;
top: 92.8%;
border-radius: 20px;
color: white;
background-color: orange;
padding: 8px;
padding-left: 10px;
font-size: 20px;
}
<div class="container">
<h6>Current open positions</h6>
<div class="form-group">
<label class="search">Search by Location</label>
<select>
<option>Canada</option>
<option>Dakor</option>
</select><i class="fas fa-angle-down"></i>
</div>
</div>
There are neater ways of doing what you're trying to achieve. Look up Select2.
In saying this though, the reason your dropdown isn't clickable is because it is overlapping the actual dropdown - to circumvent this, add this property;
pointer-events: none; to your .container i.fa-angle-down class.
ie;
.container i.fa-angle-down{
position: absolute;
right: 66.8%;
top: 92.8%;
border-radius: 20px;
color: white;
background-color: orange;
padding: 8px;
padding-left: 10px;
font-size: 20px;
pointer-events: none; //enables click-through
}
This will enable a "click-through" to the object/element behind it.
Another alternative is this solution here that I found for you, a sample can be found here.
It won't work since you are inserting the font outside of the select which excludes it from the select option. you can use select pseudo-element to achieve the same thing. You can find more about it here on font awesome documentation. does it answer your question
Answer :
: How to create a custom dropdown arrow in css?
Here Is The Link, (My CodePen) : Click Here
select {
/* styling */
background-color: white;
border: thin solid blue;
border-radius: 4px;
display: inline-block;
font: inherit;
line-height: 1.5em;
padding: 0.5em 3.5em 0.5em 1em;
/* reset */
margin: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-appearance: none;
-moz-appearance: none;
}
/* arrows */
select.classic {
background-image:
linear-gradient(45deg, transparent 50%, blue 50%),
linear-gradient(135deg, blue 50%, transparent 50%),
linear-gradient(to right, skyblue, skyblue);
background-position:
calc(100% - 20px) calc(1em + 2px),
calc(100% - 15px) calc(1em + 2px),
100% 0;
background-size:
5px 5px,
5px 5px,
2.5em 2.5em;
background-repeat: no-repeat;
}
select.classic:focus {
background-image:
linear-gradient(45deg, white 50%, transparent 50%),
linear-gradient(135deg, transparent 50%, white 50%),
linear-gradient(to right, gray, gray);
background-position:
calc(100% - 15px) 1em,
calc(100% - 20px) 1em,
100% 0;
background-size:
5px 5px,
5px 5px,
2.5em 2.5em;
background-repeat: no-repeat;
border-color: grey;
outline: 0;
}
select.round {
background-image:
linear-gradient(45deg, transparent 50%, gray 50%),
linear-gradient(135deg, gray 50%, transparent 50%),
radial-gradient(#ddd 70%, transparent 72%);
background-position:
calc(100% - 20px) calc(1em + 2px),
calc(100% - 15px) calc(1em + 2px),
calc(100% - .5em) .5em;
background-size:
5px 5px,
5px 5px,
1.5em 1.5em;
background-repeat: no-repeat;
}
select.round:focus {
background-image:
linear-gradient(45deg, white 50%, transparent 50%),
linear-gradient(135deg, transparent 50%, white 50%),
radial-gradient(gray 70%, transparent 72%);
background-position:
calc(100% - 15px) 1em,
calc(100% - 20px) 1em,
calc(100% - .5em) .5em;
background-size:
5px 5px,
5px 5px,
1.5em 1.5em;
background-repeat: no-repeat;
border-color: green;
outline: 0;
}
select.minimal {
background-image:
linear-gradient(45deg, transparent 50%, gray 50%),
linear-gradient(135deg, gray 50%, transparent 50%),
linear-gradient(to right, #ccc, #ccc);
background-position:
calc(100% - 20px) calc(1em + 2px),
calc(100% - 15px) calc(1em + 2px),
calc(100% - 2.5em) 0.5em;
background-size:
5px 5px,
5px 5px,
1px 1.5em;
background-repeat: no-repeat;
}
select.minimal:focus {
background-image:
linear-gradient(45deg, green 50%, transparent 50%),
linear-gradient(135deg, transparent 50%, green 50%),
linear-gradient(to right, #ccc, #ccc);
background-position:
calc(100% - 15px) 1em,
calc(100% - 20px) 1em,
calc(100% - 2.5em) 0.5em;
background-size:
5px 5px,
5px 5px,
1px 1.5em;
background-repeat: no-repeat;
border-color: green;
outline: 0;
}
select:-moz-focusring {
color: transparent;
text-shadow: 0 0 0 #000;
}
body {
background-color: rgb(0,159,214);
font: bold 1em/100% "Helvetica Neue", Arial, sans-serif;
padding: 2em 0;
text-align: center;
}
h1 {
color: white;
line-height: 120%;
margin: 0 auto 2rem auto;
max-width: 30rem;
}
<h1>Tutorial How to create a custom dropdown arrow in css.</h1>
<select class="classic">
<s>CSS SELECT arrow (classic)</s>
<option>No external background image</option>
<option>No wrapper</option>
</select>
<br><br>
<select class="round">
<option>CSS SELECT arrow (round)</option>
<option>No external background image</option>
<option>No wrapper</option>
</select>
<br><br>
<select class="minimal">
<option>CSS SELECT arrow (minimal)</option>
<option>No external background image</option>
<option>No wrapper</option>
</select>
Leave A Like, Comment.
Why not make use of SVG instead of an extra icon?
.container select{
border-radius: 20px;
padding: 5px 38px 7px 23px;
border: 2px solid orange;
background-color: Transparent;
background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 420 512'><path d='M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z' style='fill: rgb(255, 193, 42);'></path></svg>") no-repeat right center;
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
}
<div class="container">
<h6>Current open positions</h6>
<div class="form-group">
<label class="search">Search by Location</label>
<select>
<option>Canada</option>
<option>Dakor</option>
</select>
</div>
</div>
so far I have this < hr > with the About Me text in a data-content.
I want to add a linear gradient border bottom with three colors under the text "About Me" like it is underlined. I've tried setting the background in the .section-divider:after to a linear gradient and padding and all that but it ends up setting the whole background as a linear gradient.
HTML:
<hr class="section-divider" data-content="ABOUT ME"></hr>
CSS:
.section-divider {
font-family: Lato-Regular;
line-height: 1em;
position: relative;
outline: 0;
border: 0;
color: black;
text-align: left;
height: 1.5em;
font-size: 20px;
}
.section-divider:before {
content: '';
background: black;
position: absolute;
left: 0;
top: 50%;
width: 100%;
height: 1px;
}
.section-divider:after {
content: attr(data-content);
position: relative;
display: inline-block;
color: black;
padding: 0 .5em;
line-height: 1.5em;
color: black;
background-color: white;
}
If anyone knows how to do this or a better way to do this hr with text aligned to the left better in general let me know, thank you!
.section-divider {
font-family: Lato-Regular;
line-height: 1em;
position: relative;
outline: 0;
border: 0;
color: black;
text-align: left;
height: 1.5em;
font-size: 20px;
}
.section-divider:before {
content: '';
background: black;
position: absolute;
left: 0;
top: 50%;
width: 100%;
height: 1px;
}
.section-divider:after {
content: attr(data-content);
position: relative;
display: inline-block;
color: black;
padding: 0 .5em;
line-height: 1.5em;
color: black;
background-color: white;
}
<hr class="section-divider" data-content="ABOUT ME"></hr>
You can use this code.
.section-divider {
font-family: Lato-Regular;
line-height: 1em;
position: relative;
outline: 0;
border: 0;
color: black;
text-align: left;
height: 1.5em;
font-size: 20px;
}
.section-divider:before {
content: '';
position: absolute;
left: 0;
top: 50%;
width: 100%;
height: 1px;
margin: 0;
border: 0;
background: #333; /* Chrome,Safari4+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#34495e), color-stop(10%,#34495e), color-stop(10%,#207cca), color-stop(24%,#2989d8), color-stop(24%,#34495e), color-stop(42%,#34495e), color-stop(42%,#207cca), color-stop(70%,#207cca), color-stop(70%,#207cca), color-stop(70%,#34495e), color-stop(100%,#34495e)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #34495e 0%,#34495e 10%,#207cca 10%,#2989d8 24%,#34495e 24%,#34495e 42%,#207cca 42%,#207cca 70%,#207cca 70%,#34495e 70%,#34495e 100%); /* Chrome10+,Safari5.1+ */
background-image: -moz-linear-gradient(left, #34495e 0%, #34495e 9%, #207cca 10%, #2989d8 24%, #34495e 24%, #34495e 42%, #207cca 42%, #207cca 70%, #207cca 70%, #34495e 71%, #34495e 100%);
background-image: -o-linear-gradient(left, #34495e 0%, #34495e 9%, #207cca 10%, #2989d8 24%, #34495e 24%, #34495e 42%, #207cca 42%, #207cca 70%, #207cca 70%, #34495e 71%, #34495e 100%);
background-image: linear-gradient(left, #34495e 0%, #34495e 9%, #207cca 10%, #2989d8 24%, #34495e 24%, #34495e 42%, #207cca 42%, #207cca 70%, #207cca 70%, #34495e 71%, #34495e 100%); /* Chrome10+,Safari5.1+ */
}
.section-divider:after {
content: attr(data-content);
position: relative;
display: inline-block;
color: black;
padding: 0 .5em;
line-height: 1.5em;
color: black;
background-color: white;
}
<hr class="section-divider" data-content="ABOUT ME" />
I have a figure with bevel corners, but the background is not rounded:
How to have it rounded?
.test-block {
height: 480px;
padding: 4px;
color: #ffffff;
background-color: transparent;
background-image:
-webkit-linear-gradient(top, #ffdc00, #ffdc00),
-webkit-linear-gradient(225deg, #ffdc00, #ffdc00),
-webkit-linear-gradient(bottom, #ffdc00, #ffdc00),
-webkit-linear-gradient(left, #ffdc00, #ffdc00),
-webkit-linear-gradient(315deg, transparent 9px, #ffdc00 10px, #ffdc00 12px, red 12px);
background-image:
linear-gradient(180deg, #1698d9, #1698d9),
linear-gradient(225deg, #1698d9, #1698d9),
linear-gradient(0deg, #1698d9, #1698d9),
linear-gradient(90deg, #1698d9, #1698d9),
linear-gradient(135deg, transparent 28px, #1698d9 28px, #1698d9 32px, #ffffff 10px);
background-position: top right, top right, bottom left, bottom left, top left;
background-size: -webkit-calc(100% - 15px) 2px, 2px 100%, 100% 2px, 2px -webkit-calc(100% - 15px), 100% 100%;
background-size: calc(100% - 40px) 4px, 4px 100%, 100% 4px, 4px calc(100% - 40px), 100% 100%;
background-repeat: no-repeat;
border-radius: 10px;
width: 320px;
}
.test-block__div {
background-image: url(http://css-snippets.com/blogfile/wp-content/uploads/2011/03/square.jpg);
background-repeat: no-repeat;
background-position: -24px 208px;
height: 100%;
}
<div class="test-block">
<div class="test-block__div"></div>
</div>
Since you are using multiple background you can add more using radial-gradiant to create the corner (I removed the vendor prefixes to simplify the code)
.test-block {
height: 480px;
padding: 4px;
color: #ffffff;
background-color: transparent;
background-image:
radial-gradient(circle at top left, transparent 40%, #1698d9 0%),
radial-gradient(circle at bottom left, transparent 40%, #1698d9 0%),
radial-gradient(circle at top right, transparent 40%, #1698d9 0%),
linear-gradient(180deg, #1698d9, #1698d9),
linear-gradient(225deg, #1698d9, #1698d9),
linear-gradient(0deg, #1698d9, #1698d9),
linear-gradient(90deg, #1698d9, #1698d9),
linear-gradient(135deg, transparent 28px, #1698d9 28px, #1698d9 32px, transparent 10px);
background-position:
bottom right,
top right,
bottom left,
top right,
top right,
bottom left,
bottom left,
top left;
background-size:
10px 10px, 10px 10px, 10px 10px,
calc(100% - 40px) 4px,
4px 100%,
100% 4px,
4px calc(100% - 40px),
100% 100%;
background-repeat: no-repeat;
border-radius: 10px;
width: 320px;
}
body {
background-image:linear-gradient(30deg, pink, yellow);
}
<div class="test-block">
</div>
By the way you can achieve the same layout using pseudo-element and without multiples background. It can be easier to handle:
.test-block {
height: 440px;
padding: 4px;
margin-top: 60px;
color: #ffffff;
border-right: 4px solid #1698d9;
border-left: 4px solid #1698d9;
border-bottom: 4px solid #1698d9;
border-radius: 0 0 10px 10px;
width: 320px;
position: relative;
}
.test-block:before {
content: "";
position: absolute;
left: -4px;
width: 50%;
height: 40px;
top: -44px;
border-left: 4px solid #1698d9;
border-top: 4px solid #1698d9;
transform: skewX(-40deg);
transform-origin: bottom left;
}
.test-block:after {
content: "";
position: absolute;
right: -4px;
height: 40px;
width: 50%;
top: -44px;
border-right: 4px solid #1698d9;
border-top: 4px solid #1698d9;
border-radius: 0 10px 0 0;
}
body {
background-image: linear-gradient(30deg, pink, yellow);
}
<div class="test-block">
</div>
I have problem when I tried to get this type of zigzag I tried a lot but unfortunately it didn't work.
I tried this way of coding
CSS
.zigzag:before {
content: "";
display: block;
position: absolute;
top: -10px;
width: 100%;
height: 10px;
}
.container2:before {
background:
linear-gradient(
45deg, transparent 33.333%,
#E2E2E2 33.333%, #E2E2E2 66.667%,
transparent 66.667%
),
linear-gradient(
-45deg, transparent 33.333%,
#E2E2E2 33.333%, #E2E2E2 66.667%,
transparent 66.667%
);
background-size: 20px 40px;
}
but i get like rectangle zigzag but what i need is like line not rectangle
i want like this
div{
height: 50px;
background:
linear-gradient(135deg, white 35%, transparent 25%) -25px 0,
linear-gradient(225deg, white 35%, transparent 25%) -25px 0,
linear-gradient(315deg, white 35%, transparent 25%),
linear-gradient(45deg, white 35%, transparent 25%);
background-size: 50px 50px;
background-color: black;
}
http://jsfiddle.net/4ay1uduz/
Simply change all 50px to your element's height, and change all 25px to half its height.
Take a look JsFiddle here. Hope this will help you.
HTML:
<div class="container4 zigzag"></div>
CSS:
.zigzag {
position: relative;
width: 100%;
height: 200px;
}
.zigzag:before {
content: "";
display: block;
position: absolute;
top: -10px;
width: 100%;
height: 10px;
}
.container4 {
background: #CCC;
}
.container4:before {
background:
linear-gradient(
45deg, transparent 33.333%,
#CCC 33.333%, #CCC 66.667%,
transparent 66.667%
),
linear-gradient(
-45deg, transparent 33.333%,
#CCC 33.333%, #CCC 66.667%,
transparent 66.667%
);
background-size: 20px 40px;
}
Html:
<div class="container1">
</div>
<div class="container2">
</div>
Css:
.container1 {
background: white;
}
.container1:after {
background: linear-gradient(-45deg, black 16px, transparent 0), linear-gradient(45deg, black 16px, transparent 0);
background-position: left-bottom;
background-repeat: repeat-x;
background-size: 32px 32px;
content: " ";
display: block;
bottom: 0px;
left: 0px;
width: 100%;
height: 32px;
}
.container2 {
margin-top: -27px;
}
.container2:after {
background: linear-gradient(-45deg, white 16px, transparent 0), linear-gradient(45deg, white 16px, transparent 0);
background-position: left-bottom;
background-repeat: repeat-x;
background-size: 32px 32px;
content: " ";
display: block;
bottom: 0px;
left: 0px;
width: 100%;
height: 32px;
}
Here is a fiddle.