I am trying to blur the outline of a button without blurring the inside image. The blur filter only applies to the whole image, but I only want the blue outline to be blurred. basically apply the filter: blur(4px) but only on the outline
button:focus {
outline-color: #054EBA;
outline-width: 2px;
outline-offset: 5px;
}
What I have
What I want
You need to dispatch the blur effect to another container, it can be pseudo container.
example
button {
position: relative;
margin: 3em;
padding: 0em 0.35em;
color: white;
background: #000;
border-radius: 50%;
border: none;
font-size:2em;
}
button:focus:after {
content: '';
position: absolute;
top: -10px;
bottom: -10px;
left: -10px;
right: -10px;
pointer-events: none;
border: solid #054eba 2px;
filter: blur(2px);
}
<button>?</button>
Select only the button and not the image inside
Related
My designer just gave me the design with text areas with styled resize grabber. The question is: Can I style it or not ?
WebKit provides the pseudo-element ::-webkit-resizer for the resize control it automatically adds to the bottom right of textarea elements.
It can be hidden by applying display: none or -webkit-appearance: none:
::-webkit-resizer {
display: none;
}
<textarea></textarea>
This displays as follows in Chrome 26 on OS X:
Note: Adding display: none to ::-webkit-resizer doesn’t actually prevent the user from resizing the textarea, it just hides the control. If you want to disable resizing, set the resize CSS property to none. This also hides the control and has the added benefit of working in all browsers that support resizing textareas.
The ::-webkit-resizer pseudo-element also allows for some basic styling. If you thought the resize control could use significantly more color you could add this:
::-webkit-resizer {
border: 2px solid black;
background: red;
box-shadow: 0 0 5px 5px blue;
outline: 2px solid yellow;
}
<textarea></textarea>
This displays as follows in Chrome 26 on OS X:
Instead of applying CSS to ::-webkit-resizer (which doesn't appear to be working in Chrome 56 or FireFox 51), you can create a "custom" handle using some markup. I found this example after a google search:
Custom CSS3 TextArea Resize Handle
Copied markup in case of future dead link:
<div class="wrap">
<div class="pull-tab"></div>
<textarea placeholder="drag the cyan triangle..."></textarea>
</div>
And the CSS from the example - of course, you can apply any style you like :
textarea {
position: relative;
margin: 20px 0 0 20px;
z-index: 1;
}
.wrap {
position: relative;
display: inline-block;
}
.wrap:after {
content:"";
border-top: 20px solid black;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
-webkit-transform: rotate(-45deg);
z-index: 1;
opacity: 0.5;
position: absolute;
right: -18px;
bottom: -3px;
pointer-events: none;
}
.pull-tab {
height: 0px;
width: 0px;
border-top: 20px solid cyan;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
-webkit-transform: rotate(-45deg);
position: absolute;
bottom: 0px;
right: -15px;
pointer-events: none;
z-index: 2;
}
textarea::-webkit-resizer {
border-width: 8px;
border-style: solid;
border-color: transparent orangered orangered transparent;
}
<textarea/>
Why not just show a background image?
http://jsfiddle.net/1n0d529p/
textarea {
background: url(https://image.flaticon.com/icons/svg/133/133889.svg)no-repeat rgba(71, 108, 193, 0.52) 99.9% 100%;
background-size: 12px;
}
I managed to do so this way:
.textarea-container:before {
content: '';
background-image: url(svg/textarea-resize.svg);
background-size: 16px;
background-repeat: no-repeat;
position: absolute;
width: 20px;
height: 20px;
bottom: 2px;
right: 0;
pointer-events: none;
}
Styling the resize grabber of textarea using #HorusKol's approach
Codepen url
textarea {
/* Ignore this part of code - basic textarea formatting */
margin-top: 20px;
margin-left: 20px;
width:300px;
padding:20px;
border:1px solid #CCC;
border-radius: 4px;
/* Comment below line to resize horizontal + vertical */
resize:vertical
/* Step 1 */
position: relative;
}
/* Step 2 */
.wrap {
position: relative;
display: inline-block;
}
/* Step 3 - - Sets the 1st line of resize icon */
.wrap:after {
content:"";
border-top: 2px solid #555;
width:16px;
transform: rotate(-45deg);
background:transparent;
position: absolute;
right: 1px;
bottom: 14px;
pointer-events: none;
border-radius:25%;
}
/* Step 4 - Sets the 2nd line of resize icon */
.pull-tab {
border-top: 2px solid #555;
width:10px;
transform: rotate(-45deg);
position: absolute;
bottom: 10px;
right: 1px;
pointer-events: none;
border-radius:25%;
}
/* Step 5 - Removes the default resizer grabber icon */
::-webkit-resizer{
display:none;
}
<div class="wrap">
<div class="pull-tab"></div>
<textarea placeholder="Customized resizer grabber...">
</textarea>
</div>
textarea {
resize: none;
}
<textarea cols="72" rows="14"></textarea>
I am trying to create an offset border effect. Can this be done with pure css.
These are buttons so will be different sizes and colours.
I use pseudo-element :after to create offset border effect.
body {
background: black;
padding: 30px;
}
div {
background: white;
height: 75px;
width: 175px;
position: relative;
}
div:after {
content: '';
background: transparent;
border: 1px solid white;
top: 7px;
right: 7px;
bottom: -7px;
left: -7px;
position: absolute;
z-index: -1;
}
<div></div>
Update
As web-tiki pointed out in comments on this answer, you can achieve the entire affect entirely with box-shadow. Take a look at their JSFiddle demo here: https://jsfiddle.net/5a0bvyup.
I'm going to leave my answer in the state I submitted it in because it does give some idea of how their implementation works (and if you look closely you'll see how their box-shadow differs from the one described below).
Note: In my answer I've made the foreground box red instead of white to demonstrate that this 'offset border' does not overlap the initial element. You'll need to change this back to white yourself.
The Left and Bottom Borders
You can achieve the left and bottom borders really easily with box-shadow. You simply need to create a solid shadow which matches the background colour, and then behind that add a second shadow which matches the foreground colour, offset by one pixel:
body {
background: black;
padding: 30px;
}
div {
background: red;
height: 72px;
width: 192px;
box-shadow: -2px 2px 0 5px black, -7px 7px 0 1px white;
}
<div></div>
The Top and Right Borders
You can then use pseudo-elements (::before and ::after) to fill in those extra borders:
body {
background: black;
padding: 30px;
}
div {
background: red;
height: 72px;
width: 192px;
box-shadow: -2px 2px 0 5px black, -7px 7px 0 1px white;
position: relative;
}
div::before {
background: white;
content: '';
position: absolute;
height: 1px;
width: 7px;
top: 6px;
right: 100%;
}
div::after {
background: white;
content: '';
position: absolute;
height: 7px;
width: 1px;
top: 100%;
right: 6px;
}
<div></div>
I'd like to create a simple arrow with a mouseover effect. I create a span and a triangle. But now I need a mouseover effect which should apply to the whole arrow. Any Idea? I put my Sourcetext in a fiddle.
HTML
<span id="series" class="rectangle"></span>
<div class="series-triangle"></div>
CSS
#series {
width: 60px;
}
.series-triangle{
float:left;
width: 0px;
position: relative;
}
.series-triangle:after {
content: '';
position: absolute;
top: 3px;
left: -3px;
width: 0;
height: 0;
border-color: transparent transparent transparent #EFDF00;
border-style: solid;
border-width: 31px;
}
.series-triangle:before {
content: '';
position: absolute;
top: 1px;
left: -2px;
width: 10;
height: 10;
border-color: transparent transparent transparent #444;
border-style: solid;
border-width: 33px;
}
.series-triangle:hover {
background-color: white;
}
.rectangle {
float:left;
height: 60px;
border: 2px solid #444;
padding: 2px;
text-align: center;
border-radius: 5px;
background-color: #EFDF00;
}
.rectangle:hover {
background-color: white;
}
http://jsfiddle.net/u7tYE/8089/
Put them in a parent element and react to the :hover state of the parent :
HTML :
<div class="parent">
<span id="series" class="rectangle"></span>
<div class="series-triangle">
</div>
</div>
CSS :
.parent:hover .rectangle, .parent:hover .series-triangle{
/* Do something */
}
Example with color change for both parts on parent hover :
http://jsfiddle.net/u7tYE/8091/
I need help turning the arrow white with a blue border like the box containing the text. I need to use the title inside an a tag as the content but feel free to edit everything else I managed to get it to a certain point but cant seem to get past this:
CSS
.toop {
position: relative;
padding: 0 5px;
line-height: 23px;
}
.toop:hover:after {
content: attr(title);
color: #474747;
font-size: 14px;
line-height: 150%;
text-align: left;
background-color: #ffffff;
border-radius: 5px;
border: 2px solid #2192ce;
padding: 5px 10px;
opacity: 0.9;
display: block;
width: 180px;
position: absolute;
left: 10px;
bottom: 40px;
z-index: 98;
}
.toop:hover:before {
content: "";
border: solid;
border-color: #2191ce transparent;
border-width: 10px 10px 0 10px;
opacity: 0.9;
display: block;
left: 30px;
bottom: 30px;
position: absolute;
z-index: 99;
}
HTML
<br>
<br>
<br>
<br>
<br>
Tooltip is here
you can not do that , you can not have a border around the "arrow" . making that arrow is a trick you can do with css to manipulate the :after and :before to make it appear like an arrow , but you can not have a border outside of that unless you wanted to use an image and put it in that place.
see an example I made of your code to show
outline: 2px solid #000;
outline can be used to make a border outside of the actual border, but it is not going to be anything like what you wanted.
http://jsfiddle.net/pp9t0vqb/4/
The best you can do is fake the arrow with an entire block:
.toop:hover:before {
content: "";
width:10px;
height:10px;
background:white;
border: 2px solid #2192ce;
border-width:0 2px 2px 0;
transform:rotate(45deg);
display: block;
left: 30px;
bottom:35px;
position: absolute;
z-index: 99;
}
But in this case you can't handle the opacity property.
Check this Demo Fiddle
My designer just gave me the design with text areas with styled resize grabber. The question is: Can I style it or not ?
WebKit provides the pseudo-element ::-webkit-resizer for the resize control it automatically adds to the bottom right of textarea elements.
It can be hidden by applying display: none or -webkit-appearance: none:
::-webkit-resizer {
display: none;
}
<textarea></textarea>
This displays as follows in Chrome 26 on OS X:
Note: Adding display: none to ::-webkit-resizer doesn’t actually prevent the user from resizing the textarea, it just hides the control. If you want to disable resizing, set the resize CSS property to none. This also hides the control and has the added benefit of working in all browsers that support resizing textareas.
The ::-webkit-resizer pseudo-element also allows for some basic styling. If you thought the resize control could use significantly more color you could add this:
::-webkit-resizer {
border: 2px solid black;
background: red;
box-shadow: 0 0 5px 5px blue;
outline: 2px solid yellow;
}
<textarea></textarea>
This displays as follows in Chrome 26 on OS X:
Instead of applying CSS to ::-webkit-resizer (which doesn't appear to be working in Chrome 56 or FireFox 51), you can create a "custom" handle using some markup. I found this example after a google search:
Custom CSS3 TextArea Resize Handle
Copied markup in case of future dead link:
<div class="wrap">
<div class="pull-tab"></div>
<textarea placeholder="drag the cyan triangle..."></textarea>
</div>
And the CSS from the example - of course, you can apply any style you like :
textarea {
position: relative;
margin: 20px 0 0 20px;
z-index: 1;
}
.wrap {
position: relative;
display: inline-block;
}
.wrap:after {
content:"";
border-top: 20px solid black;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
-webkit-transform: rotate(-45deg);
z-index: 1;
opacity: 0.5;
position: absolute;
right: -18px;
bottom: -3px;
pointer-events: none;
}
.pull-tab {
height: 0px;
width: 0px;
border-top: 20px solid cyan;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
-webkit-transform: rotate(-45deg);
position: absolute;
bottom: 0px;
right: -15px;
pointer-events: none;
z-index: 2;
}
textarea::-webkit-resizer {
border-width: 8px;
border-style: solid;
border-color: transparent orangered orangered transparent;
}
<textarea/>
Why not just show a background image?
http://jsfiddle.net/1n0d529p/
textarea {
background: url(https://image.flaticon.com/icons/svg/133/133889.svg)no-repeat rgba(71, 108, 193, 0.52) 99.9% 100%;
background-size: 12px;
}
I managed to do so this way:
.textarea-container:before {
content: '';
background-image: url(svg/textarea-resize.svg);
background-size: 16px;
background-repeat: no-repeat;
position: absolute;
width: 20px;
height: 20px;
bottom: 2px;
right: 0;
pointer-events: none;
}
Styling the resize grabber of textarea using #HorusKol's approach
Codepen url
textarea {
/* Ignore this part of code - basic textarea formatting */
margin-top: 20px;
margin-left: 20px;
width:300px;
padding:20px;
border:1px solid #CCC;
border-radius: 4px;
/* Comment below line to resize horizontal + vertical */
resize:vertical
/* Step 1 */
position: relative;
}
/* Step 2 */
.wrap {
position: relative;
display: inline-block;
}
/* Step 3 - - Sets the 1st line of resize icon */
.wrap:after {
content:"";
border-top: 2px solid #555;
width:16px;
transform: rotate(-45deg);
background:transparent;
position: absolute;
right: 1px;
bottom: 14px;
pointer-events: none;
border-radius:25%;
}
/* Step 4 - Sets the 2nd line of resize icon */
.pull-tab {
border-top: 2px solid #555;
width:10px;
transform: rotate(-45deg);
position: absolute;
bottom: 10px;
right: 1px;
pointer-events: none;
border-radius:25%;
}
/* Step 5 - Removes the default resizer grabber icon */
::-webkit-resizer{
display:none;
}
<div class="wrap">
<div class="pull-tab"></div>
<textarea placeholder="Customized resizer grabber...">
</textarea>
</div>
textarea {
resize: none;
}
<textarea cols="72" rows="14"></textarea>