Adding glow to border-style dotted - html

I have a question regarding on styling the border-style: dotted.
What I want to achieve is adding the glow on each of the circle/dot. Is it possible or achievable?
Since each time I try to add the glow effect, it will go directly towards whole edge of the div border.
I would like to add glow effect to those tiny little dots.
Hope anyone could enlighten me on this matter.
Thank you!

You can try a drop-shadow filter:
.box {
display:inline-block;
padding:30px 80px;
position:relative;
z-index:0;
}
.box::before {
content:"";
position:absolute;
z-index:-1;
inset:0;
border-radius:100px;
border:10px dotted red;
filter:drop-shadow(0 0 3px green);
}
<div class="box">
Some text
</div>
Even a blur filter can work to give a different output:
.box {
display:inline-block;
padding:30px 80px;
position:relative;
z-index:0;
}
.box::before {
content:"";
position:absolute;
z-index:-1;
inset:0;
border-radius:100px;
border:10px dotted red;
filter:blur(2px);
}
<div class="box">
Some text
</div>

Related

Hover effect transition not working

I have been trying to create a hover image effect in my website. I attached the script in the below link.
I can't able to set a hover image transition fade effect and 2s time delay.
Please help me.
<div class="imagecontainer">
<img class="myhoverimg" src="http://www.gettyimages.ca/gi-resources/images/Homepage/Category-Creative/UK/UK_Creative_462809583.jpg" alt="">
<div class="myhoveroverlay"></div></div>
<style>
.imagecontainer {
position:relative;
width:361px;
height:181px; }
.myhoverimg{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
}
.myhoveroverlay{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
z-index:100;
}
.myhoveroverlay:hover{
background:url(http://css3.bradshawenterprises.com/images/Windows%20Logo.jpg);
}
</style>
https://jsfiddle.net/nhu2wmdg/
You can use opacity attr to fade image...
.myhoveroverlay{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
z-index:100;
opacity : 1;
}
.myhoveroverlay:hover{
background:url(http://css3.bradshawenterprises.com/images /Windows%20Logo.jpg);
opacity : 0.9;
}
Thanks for the help #Leo. Exactly what i was looking for.
jsfiddle.net/nhu2wmdg/1

CSS Opacity for a button

I have a button in HTML and I have to add opacity to it. I want to use CSS to do that. Here is my existing CSS code for button:
.btn_nav{
position:fixed;
width:100%;
height:68px;
background-color:#323232;
border-bottom:2px solid #777777;
}
There are few different ways to apply opacity to a button. Here is one of them.
.btn_nav{
position:fixed;
width:100%;
height:68px;
background-color:#323232;
border-bottom:2px solid #777777;
/*Below are two new line which enable opacity*/
opacity: 0.9;
filter: alpha(opacity=90);
}
add this css property
opacity:0.2; // change values as you like

Fade out sides of div tag with image background CSS

I'm building a site, and I have an animating image in my header. This image is a coloured bar that animates from right to left on a loop to give the impression of it infinitely moving left.
What I would like to accomplish, is to have a fade in/out effect on the left and the right side of the image, without affecting the animation of it's background image.
This is my HTML code:
<div id="hbaranim"><div id="hbarchild"></div></div>
And my current CSS (with just the animating image):
#hbaranim {
width: 100%;
height: 5px;
overflow-x: hidden;
padding-bottom: 10px;
padding-top: 10px;
}
#hbaranim #hbarchild {
position: relative;
width: 8524px;
height: 5px;
background-image: url("img/colorbartile.png");
background-repeat: repeat-x;
-webkit-animation: hbaranim_roll linear 245s infinite;
}
#-webkit-keyframes hbaranim_roll {
from { right: 0px; }
to { right: 2131px; }
}
JSFiddle
Eddit: Currently using the HTML is using two div tags, but they don't have any content in them, so using just one would probably be better (not sure how to that to be honest...)
Eddit 2: Just to clarify, the animating image is positioned over a gradient background, so just putting another gradient over the image like some of you suggested won't work in this case. It really need's to be transparent at the sides.
Eddit 3: Some of you also suggested using a CSS gradient instead of an image, but the image I use on my actual site contains some other details that would be impossible to replicate in CSS. For this example I used an image that could indeed be replicated with a CSS gradient quite easily.
Eddit 4: Updated the fiddle to include the whole header
You could use absolutely positioned pseudo elements on the parent element with gradient backgrounds to achieve this. You can also achieve the same effect with a single div.
UPDATE: Following on from edit 3 in the original question, the rainbow gradient I've used below can be replaced with an image file, the exact same principles apply.
More information on pseudo elements
More information on gradients
EXAMPLE
*{box-sizing:border:box;}
body{margin:0;}
.header{
background:radial-gradient(ellipse at center,#242424 0%,#141414 100%);
box-shadow:0px 0px 10px 3px rgba(0,0,0,.75);
height:150px;
position:relative;
}
h1{
color:#fff;
font-family:arial;
font-size:48px;
padding:25px 0 0;
margin:0;
text-align:center;
}
h2{
color:#fff;
font-family:arial;
font-size:24px;
line-height:25px;
margin:0;
text-align:center;
}
#hbaranim{
-webkit-animation:hbaranim_roll linear 10s infinite;
animation:hbaranim_roll linear 10s infinite;
background:linear-gradient(90deg,#f00 0%,#ff0 16.667%,#0f0 33.333%,#0ff 50%,#00f 66.667%,#f0f 83.333%,#f00 100%) 0 0 repeat-x;
background-size:200%;
bottom:10px;
height:5px;
position:absolute;
width:100%;
}
#hbaranim::before,#hbaranim::after{
content:"";
display:block;
height:100%;
position:absolute;
top:0;
width:25%;
z-index:1;
}
#hbaranim::before{
background:linear-gradient(90deg,rgba(20,20,20,1),rgba(20,20,20,0));
left:0;
}
#hbaranim::after{
background:linear-gradient(90deg,rgba(20,20,20,0),rgba(20,20,20,1));
right:0;
}
#-webkit-keyframes hbaranim_roll{
0%{
background-position:0 0;
}
100%{
background-position:200% 0;
}
}
#keyframes hbaranim_roll{
0%{
background-position:0 0;
}
100%{
background-position:200% 0;
}
}
<div class="header">
<h1>Name of Site</h1>
<h2>www.site.nl</h2>
<div id="hbaranim"></div>
</div>
If you're feeling adventurous, you can do this without the nested div (Fiddle) or even without the parent div (Fiddle)
The following snippet was provided as an example while awaiting Ties' confirmation that removing the child div was an option and is included below as a matter of record.
#hbaranim{
overflow:hidden;
padding:10px 0;
position:relative;
width:100%;
}
#hbaranim #hbarchild{
background-color:#000;
height:20px;
position:relative;
width:8524px;
z-index:1;
}
#hbaranim::before,#hbaranim::after{
content:"";
display:block;
height:20px;
position:absolute;
top:10px;
width:20%;
z-index:2;
}
#hbaranim::before{
background:linear-gradient(90deg,rgba(255,255,255,1),rgba(255,255,255,0));
left:0;
}
#hbaranim::after{
background:linear-gradient(90deg,rgba(255,255,255,0),rgba(255,255,255,1));
right:0;
}
<div id="hbaranim">
<div id="hbarchild"></div>
</div>

How to make the CSS width property go from bottom to top

I'm making a web app for Google Chrome (so no need for cross browser support) and I'm making an animated tutorial that will run when it first boots. I'm drawing a box on the screen by having four different div elements with -webkit-transistions for width and height properties respectively. Then I'm using javascript to add classes to these borders and make them draw on the screen. It was all working fine until I got to the border on the right-hand side. I want my borders to draw like this: left goes down, bottom goes right, right goes up and then top goes left. It all worked properly until I got to the right border. It draws from top to bottom instead of bottom to top. I tried rotating it with -webkit-transform:rotate(180deg) but that didn't really help. Here's the code:
<html>
<head>
<style>
button {
background-color:lime;
background-image:-webkit-linear-gradient(top, lime, green);
border:solid 1px 000000;
cursor:hand;
border-radius:10;
outline:none;
width:50px;
}
.left {
width:5px;
height:0%;
border-right:solid 1px 000000;
background-color:ffffff;
-webkit-transition:height 2s;
}
.bottom {
width:0%;
height:5px;
border-top:solid 1px 000000;
background-color:ffffff;
position:absolute;
left:13px;
-webkit-transition:width 2s;
}
.right {
width:5px;
height:0%;
border-right:solid 1px 000000;
background-color:ffffff;
position:absolute;
right:11px;
top:10px;
-webkit-transform:rotate(180deg);
-webkit-transition:height 2s;
}
.top {
width:0%;
height:5px;
border-bottom:solid 1px 000000;
background-color:ffffff;
position:absolute;
left:13px;
top:7px;
-webkit-transition:width 2s;
}
.leftdraw {
height:99%;
}
.bottomdraw {
width:98%;
}
.rightdraw {
height:96.5%;
}
.topdraw {
width:98%;
}
</style>
<script>
function begintut() {
document.getElementById("left").classList.add("leftdraw")
setTimeout("document.getElementById('bottom').classList.add('bottomdraw')",2000)
setTimeout("document.getElementById('right').classList.add('rightdraw')",4000)
setTimeout("document.getElementById('top').classList.add('topdraw')",6000)
}
</script>
<title>Tutorial - Inscribe</title>
</head>
<body onload="begintut()">
<div class="left" id="left"></div><div class="bottom" id="bottom"></div><div class="right" id="right"></div><div class="top" id="top"></div>
</body>
</html>
The issue lies with your initial position of the top and right divs. If you make the following changes to your right and top classes, I think you will achieve your desired effect.
.right
change top:10px; to bottom:10px;
.top
change left:13px; to right:13px;

Is it possible to shift the color of a div using css?

Update: The original phrasing of this question was vague so i've modified it to better express what i'm asking.
Lets say I have two divs
<div class='button'>A</div>
<div class='button green-button'>A</div>
with the following styles:
div.button {
/* define position, size, etc ...*/
color:#FBB
background-color:#F00
}
div.button.green-button{
color:#BFB
background-color:#0F0
}
In this example it was easy to shift the hue of the first button from red to green by simply changing shifting the values of color and background-color by 1 digit. If I wanted to make a blue button I could do the same shift again for a 3rd button.
However, in the case where I don't want to shift completely from one color to the next its a bit trickier.
Additionally I want to color shift everything in the div, not just the background-color and color properties. So if I were to place and image in the div the colors of the image would get shifted as well.
Is this possible in CSS? If not can you do it in Javascript?
Since everyone is posting wild guesses, I'll jump right into it.
You could achieve something using CSS filters (in your case hue-rotate)
Or the same using a CSS preprocessor like LESS.
Do you mean like this:
DEMO
HTML:
<a class="button">A</a>​
CSS:
.button{
font-family:sans-serif;
font-size: 80px;
display:block;
line-height:100px;
text-align:center;
color:rgba(255,255,255,0.5);
width:100px;
height:100px;
background-color:green;
}
.button:hover{
background-color:red;
}
​
Or are you looking for something that figures out the color offset on it's own?
If you are there is CSS3's filter: hue-rotate(angle);
DEMO
HTML:
<a class="button">A</a>​
CSS:
.button{
font-family:sans-serif;
font-size: 80px;
display:block;
line-height:100px;
text-align:center;
color:rgba(255,255,255,0.5);
width:100px;
height:100px;
background-color:green;
}
.button:hover{
-webkit-filter:hue-rotate(250deg);
-moz-filter:hue-rotate(250deg);
-ms-filter:hue-rotate(250deg);
filter:hue-rotate(250deg);
}
​
Yeah, you'll need multiple elements though.
HTML:
<div>
<span class="over-bg"></span>
<span>A</span>
</div>​
CSS:
div, span { height:100px; width:100px; vertical-align:middle;
text-align:center; }
div { background-color:#ff3300; position:relative; margin:20px; float:left; }
span { position:absolute; left:0; top:0; height:100%; width:100% }
span.over-bg { background-color:#22FF00; display:none; }
div:hover span.over-bg { display:block; }
http://jsfiddle.net/TeCvr/1/
Another approach using pseudo-elements:
HTML:
<div>
<span>A</span>
</div>​
CSS:
div, span { height:100px; width:100px; vertical-align:middle;
text-align:center; }
div { background-color:#ff3300; position:relative; margin:20px; float:left; }
span { position:absolute; left:0; top:0; height:100%; width:100% }
div:hover:before { display:block; content:""; position:absolute; left:0;
top:0; height:100%; width:100%; background-color:#22FF00; }
http://jsfiddle.net/TeCvr/2/
Well you could use CSS3 supported transition style rules like:
.button:hover {
background-color: #F0F0F0;
-webkit-transition: background-color 1ms linear;
-moz-transition: background-color 1ms linear;
-o-transition: background-color 1ms linear;
-ms-transition: background-color 1ms linear;
transition: background-color 1ms linear;
}
Is there any specific reason as to why you would like to achieve this..? I can't think of any application as such; unless you came across this while reverse engineering a design and couldn't find the CSS that caused this behaviour..?
Reference:
http://www.css3.info/preview/css3-transitions/
I don't know if i understand you. You can change the class of the div. For example .button to .buttongreen with diferent properties.
Without using color and background-color properties, you can still use:
background-image: linear-gradient(to bottom, #006e2e 0%,#006e2e 100%)
That's a gradient from a given color to the same color but the whole gradient is not a color in CSS.