surround a div with a gradient border - css

How do you surround a div with a border?
this is what I am trying to accomplish
and was done with images.
I have the sides (or top and bottom) , I can not surround the div with the gray- silver border.
[JsFiddle code:
<div class="panel-body">
<ul>
<li>Locomotives</li>
<li>Radios</li>
<li>Televisions</li>
<li>Computers</li>
<li>Monitors</li>
<li>Satellites</li>
<li>Spaceships</li>
<li>Submarines</li>
<li>Scuba Divers</li>
</ul>
</div>
]Jsfiddle2

Use box-shadow instead:
http://jsfiddle.net/3knyndxz/1/
.panel-body {
float: left;
padding: 30px;
background: #fff;
border-radius: 10px;
box-shadow: inset 0 0 20px #ccc;
}

This can be done with multiple layers of box-shadows, its tricky if you need to build some kind metal texture.
.container {
border: 1px solid #999;
height: 200px;
width: 90%;
display: flex;
justify-content: center;
padding: 20px;
}
.children {
width: 30%;
border: 1px solid #555;
margin-right: 15px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 8px;
}
.metalone {
box-shadow: inset 0px -2px 0px 0px rgba(255, 255, 255, 0.62), inset 0px 2px 0px 0px rgba(255, 255, 255, 0.62), inset 0px 0px 1px 1px rgba(56, 8, 8, 0.91), inset 0px 0px 0px 2px rgba(192, 121, 121, 0.8), inset 0px 0px 0px 3px rgba(152, 47, 47, 0.85), inset 0px 0px 0px 4px rgba(152, 47, 47, 0.85), inset 0px 0px 1px 5px rgba(56, 8, 8, 0.945);
}
.metaltwo {
box-shadow: inset 0px 3px 0px 0px rgba(29, 29, 29, 0.62), inset 0px 0px 1px 2px rgba(46, 46, 46, 0.91), inset 0px 0px 0px 3px rgba(255, 255, 255, 0.8), inset 0px 0px 0px 4px rgba(112, 112, 112, 0.85), inset 0px 0px 0px 5px rgba(219, 219, 219, 0.85), inset 0px 0px 1px 6px rgb(250, 250, 250);
background: black;
color: white;
}
<div class="container">
<div class="metalone children">Metal Texture one</div>
<div class="metaltwo children">Metal Texture two</div>
</div>
box-shadow.

Related

How to add the same border-radius to element and box-shadows of element

I have an element on which i add two box-shadows and I want the corners of the element AND the box shadows to have the same border-radius. Somehow it's not happening.
The element appears with a different border-radius than the first box-shadow, and the first box-shadow appears with a different border radius than the second box-shadow.
Here's the code:
.stack_item{
overflow: hidden;
border-radius: 10px 10px 10px 10px;
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
transform: translate(-50%, 9%);
-webkit-box-shadow: 0px -15px 0px -7px rgb(206, 204, 204), 0px -29px 0px -13px rgb(168, 168, 168);
-moz-box-shadow: 0px -15px 0px -7px rgb(206, 204, 204), 0px -29px 0px -13px rgb(168, 168, 168);
box-shadow: 0px -15px 0px -7px rgb(206, 204, 204), 0px -29px 0px -13px rgb(168, 168, 168);
}
Since you are making your shadow shrink, the border-radius is also shrinking.
Set it on a larger pseudo-element and it will be ok
.stack_item{
width: 200px;
height: 100px;
position: relative;
border: solid 1px black;
border-radius: 10px 10px 10px 10px;
margin-top: 50px;
background-color: white;
}
.stack_item:before,
.stack_item:after {
content: "";
position: absolute;
top: 0px;
bottom: 50px;
border-radius: inherit;
}
.stack_item:before {
left: 7px;
right: 7px;
box-shadow: 0px -8px 0px 0px rgb(206, 204, 204);
z-index: -1;
}
.stack_item:after {
left: 13px;
right: 13px;
box-shadow: 0px -16px 0px 0px rgb(168, 168, 168);
z-index: -2;
}
<div class="stack_item"></div>

Applying CSS styling to range slider in Chrome disables dynamic updating of value

I've got a weird situation. I'm using AngularJS to dynamically set the position of a range slider based on the current position in the video. If I style just the thumb (by enabling the bottom two calls below) the thumb moves along the slider in real time as expected. If I style the input[type="range"] as in the first section below, the thumb doesn't move dynamically unless you mouse over it.
I have tried other CSS styles of range inputs that I pulled from various websites, and I experience the same outcome each time. This seems to affect only Chrome. The weirdest thing is that IE works just fine (who would have thought?!) with the styled slider and the thumb moves along nicely.
input[type="range"] //::-moz-range-track //::-ms-track
{
outline:none;
background: rgb(127, 183, 219);
width: 130px;
height: 6px;
-webkit-appearance: none;
border-radius: 8px;
-moz-border-radius: 8px;
-wekkit-border-radius: 8px;
}
input[type="range"]::-webkit-slider-thumb// ::-moz-range-thumb ::-ms-thumb
{
outline:none;
-webkit-appearance:none !important;
width:20px;
height:20px;
-webkit-appearance: none;
border-radius: 10px;
-moz-border-radius: 10px;
-wekkit-border-radius: 10px;
border:1px solid rgba(127, 183, 219, 1.0);
background: #FFF;
-webkit-box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.1), 0px 1px 1px 0px rgba(255, 255, 255, 0.05);
-moz-box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.1), 0px 1px 1px 0px rgba(255, 255, 255, 0.05);
box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.1), 0px 1px 1px 0px rgba(255, 255, 255, 0.05);
}
input[type="range"] ::-webkit-slider-thumb:hover// ::-moz-range-thumb:hover ::-ms-thumb:hover
{
outline:none;
-webkit-appearance:none !important;
width:22px;
height:22px;
-webkit-appearance: none;
border-radius: 10px;
-moz-border-radius: 10px;
-wekkit-border-radius: 10px;
border: 1px solid rgba(127, 183, 219, 1.0);
background: #FFF;
-webkit-box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.1), 0px 1px 1px 0px rgba(255, 255, 255, 0.05);
-moz-box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.1), 0px 1px 1px 0px rgba(255, 255, 255, 0.05);
box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.1), 0px 1px 1px 0px rgba(255, 255, 255, 0.05);
}

CSS absolute property

Fiddle link I want two div with 100% height.
1 div with background image and one color.
both should equally in height in any resolution.
please help me.
.loginImage { width: 100%; }
.loginBox {
background-color: #ffffff;
background: rgba(255, 255, 255, 0.2);
-webkit-box-shadow: 1px 0px 9px 0px rgba(50, 50, 50, 0.55);
-moz-box-shadow: 1px 0px 9px 0px rgba(50, 50, 50, 0.55);
box-shadow: 1px 0px 9px 0px rgba(50, 50, 50, 0.55);
height: 100%;
position: absolute;
}
<div class="wrapper-login">
<div class="col-xs-6"><img src="images/loginImage.jpg" alt="Cargo CRM" class="loginImage"></div>
<div class="col-xs-3 loginBox"></div>
</div>
Fiddle
.col-xs-6 {
width: 47.66666667%;
display:table-cell;
text-align:left;
}
.col-xs-3 {
width: 25%;
display:table-cell;
text-align:left;
}
.loginImage {
width: 100%;
}
.loginBox {
background-color: #ffffff;
background: rgba(255, 255, 255, 0.2);
-webkit-box-shadow: 1px 0px 9px 0px rgba(50, 50, 50, 0.55);
-moz-box-shadow: 1px 0px 9px 0px rgba(50, 50, 50, 0.55);
box-shadow: 1px 0px 9px 0px rgba(50, 50, 50, 0.55);
}
.wrapper-login {
margin: 0 auto;
width: 100%;
display:table;
}
Is it what you are looking for?

CSS3 black shadow

I have a question about box-shadow, so I have a picture with this effect.
I want to same effect like this image in my Jsfiddle example.
http://jsfiddle.net/aldimeola1122/EAb3V/2/
This is my css code :
#wrapper{
background:url("http://ealtinel.com/bg1.jpg") no-repeat;
width:1000px;
height:1000px;
}
#probe{
position: absolute;
margin-top:100px;
margin-left:200px;;
z-index: 9999;
height: 35px;
width: 138px;
background:#fff;
padding-left: 20px;
padding-top: 14px;
border-radius: 25px;
-moz-border-radius: 25px;
-webkit-border-radius: 25px;
transition: width 0.5s;
-moz-transition: width 0.s;
-webkit-transition: width 0.5s;
-o-transition: width 0.5s;
-webkit-box-shadow: 0px 1px 40px -13px rgba(0,0,0,0.75);
-moz-box-shadow: 0px 1px 40px -13px rgba(0,0,0,0.75);
box-shadow: 0px 1px 40px -13px rgba(0,0,0,0.75);
}
thanks in advance
I edited your css, I played around a while with different tweaks and got it as close as I think you will be able to:
http://jsfiddle.net/EAb3V/3/
Here is the css I modified:
Before:
-webkit-box-shadow: 0px 1px 40px -13px rgba(0,0,0,0.75);
-moz-box-shadow: 0px 1px 40px -13px rgba(0,0,0,0.75);
box-shadow: 0px 1px 40px -13px rgba(0,0,0,0.75);
After:
-webkit-box-shadow: 0px 1px 25px rgba(19, 19, 19, 0.50);
-moz-box-shadow: 0px 1px 25px rgba(19, 19, 19, 0.50);
box-shadow: 0px 1px 25px rgba(19, 19, 19, 0.50);
Here is another version I did, I added a 2px border slightly darker then the background:
http://jsfiddle.net/EAb3V/4/
-webkit-box-shadow: 0px 1px 20px rgba(19, 19, 19, 0.40);
-moz-box-shadow: 0px 1px 20px rgba(19, 19, 19, 0.40);
box-shadow: 0px 1px 20px rgba(19, 19, 19, 0.40);
border: 2px solid #cd870f;
Also there are tools out there to help out, like this one here I find is best for box shadows:
http://css3gen.com/box-shadow/

3d buttons in IE8

I am using css3pie to make IE8 and IE7 recognize more css declarations. This allows me to more easily use background gradients and similar on my site. However, I have found out that css3pie does not support the box-shadow style for inset shadows. This is a problem as I am using box shadows to make the buttons and interface elements on my site look 3d, like this:
a {
box-shadow: inset -2px -2px 2px rgba(0,0,0,0.5), inset 1px 1px 2px rgba(255,255,255,0.5), inset 0px 0px 0px 1px rgba(124, 124, 124, 1);
-moz-box-shadow: inset -2px -2px 2px rgba(0,0,0,0.5), inset 1px 1px 2px rgba(255,255,255,0.5), inset 0px 0px 0px 1px rgba(124, 124, 124, 1);
-webkit-box-shadow: inset -2px -2px 2px rgba(0,0,0,0.5), inset 1px 1px 2px rgba(255,255,255,0.5), inset 0px 0px 0px 1px rgba(124, 124, 124, 1);
}
a:hover {
box-shadow: inset 2px 2px 2px rgba(0,0,0,0.5), inset -1px -1px 2px rgba(255,255,255,0.5), inset 0px 0px 0px 1px rgba(124, 124, 124, 1);
-moz-box-shadow: inset 2px 2px 2px rgba(0,0,0,0.5), inset -1px -1px 2px rgba(255,255,255,0.5), inset 0px 0px 0px 1px rgba(124, 124, 124, 1);
-webkit-box-shadow: inset 2px 2px 2px rgba(0,0,0,0.5), inset -1px -1px 2px rgba(255,255,255,0.5), inset 0px 0px 0px 1px rgba(124, 124, 124, 1);
}
Here is a jsfiddle of the search bar from the site in action. I haven't included all the css, but the important thing in the background + border of the search bar, and the background + border + hover effects of the search button.
Here is the html + css:
<div class="searchbar">
<span class="searchFor" id="searchFor">search for</span>
<input id="txtSearch" type="text"/>
<span class="btn">
search
</span>
</div>
.searchbar {
padding:.75em;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
background-color: #ffd07d; /* fallback color if gradients are not supported */
background-image: -webkit-gradient(linear, left top, left bottom, #ffd07d, to(#ffa300));
background-image: -webkit-linear-gradient(top, #ffd07d, #ffa300);
background-image: -moz-linear-gradient(top, #ffd07d, #ffa300);
background-image: -ms-linear-gradient(top, #ffd07d, #ffa300);
background-image: -o-linear-gradient(top, #ffd07d, #ffa300);
-pie-background: linear-gradient(#ffd07d, #ffa300);
background-image: linear-gradient(top, #ffd07d, #ffa300);
box-shadow: inset 0 -1px 1px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.8);
-moz-box-shadow: inset 0 -1px 1px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.8);
-webkit-box-shadow: inset 0 -1px 1px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.8);
border: {
style:solid;
width:1px;
color: rgba(255,165,6,0.63);
}
behavior: url(PIE.htc); // ie hack: see http://css3pie.com
}
.btn {
margin-left:1em;
display:inline-block;
vertical-align:middle;
font-size:130%;
margin-right:0.5em;
}
.btn a {
padding: 0.2em 0.8em 0.2em 0.8em;
color: #ffffff;
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
background-color: #969696;
background-image: -webkit-gradient(linear, left top, left bottom, #969696, to(#080808));
background-image: -webkit-linear-gradient(top, #969696, #080808);
background-image: -moz-linear-gradient(top, #969696, #080808);
background-image: -ms-linear-gradient(top, #969696, #080808);
background-image: -o-linear-gradient(top, #969696, #080808);
-pie-background: linear-gradient(#969696, #080808);
background-image: linear-gradient(top, #969696, #080808);
behavior: url(PIE.htc);
box-shadow: inset -2px -2px 2px rgba(0,0,0,0.5), inset 1px 1px 2px rgba(255,255,255,0.5), inset 0px 0px 0px 1px rgba(8, 8, 8, 1);
-moz-box-shadow: inset -2px -2px 2px rgba(0,0,0,0.5), inset 1px 1px 2px rgba(255,255,255,0.5),inset 0px 0px 0px 1px rgba(8, 8, 8, 1);
-webkit-box-shadow: inset -2px -2px 2px rgba(0,0,0,0.5), inset 1px 1px 2px rgba(255,255,255,0.5),inset 0px 0px 0px 1px rgba(8, 8, 8, 1);
}
.btn a:hover {
box-shadow: inset 2px 2px 2px rgba(0,0,0,0.5), inset -1px -1px 2px rgba(255,255,255,0.5),inset 0px 0px 0px 1px rgba(8, 8, 8, 1);
-moz-box-shadow: inset 2px 2px 2px rgba(0,0,0,0.5), inset -1px -1px 2px rgba(255,255,255,0.5),inset 0px 0px 0px 1px rgba(8, 8, 8, 1);
-webkit-box-shadow: inset 2px 2px 2px rgba(0,0,0,0.5), inset -1px -1px 2px rgba(255,255,255,0.5),inset 0px 0px 0px 1px rgba(8, 8, 8, 1);
}
I need to do is somehow replace the box-shadow syntax with something else. What should I use? I'm pretty new to css + web development, so I don't really know what options I have available to me. Alternatively, is there a different approach I should take to the whole problem?
CSS3 Pie is sort of buggy. Try adding a position:relative;, and see what that does. Box-shadow should be supported in PIE.
Also, are you using a CSS framework? Otherwise your CSS isn't valid, as you cannot nest styles the way you do. Simply use shorthand:
border:solid 1px rgba(255,165,6,.63);
You can probably also ditch the first -webkit gradient, as it is only used in older Webkit browsers, which are in rapid decline.

Resources