How does Google make his border? - html

I was on the google news page and I was wondering how do google make his border around each sections, because I can't find in the inspector any element with a border property. I find those borders very thin and I think it is not with the border property with CSS.

if you inspect well, then you will see its a box-shadow instead of border, Here is what they used in their css, Please check again,
box-shadow: 0 1px 3px 0 rgba(0,0,0,0.16), 0 0 0 1px rgba(0,0,0,0.04);
background-color: #fff;
Hint: check for class .lPV2Xe

Because this is not a border. It's a box-shadow.
this effect can be created by
.card {
background: white;
box-shadow: 0 1px 3px 0 rgba(0,0,0,0.16), 0 0 0 1px rgba(0,0,0,0.04);
}
.card:hover{
box-shadow: 0px 8px 10px 0 grey;
-webkit-transition: box-shadow .3s ease-in;
}
and create a div with the class card.
found a similar pen Link to example

Related

Hover image and glows [Bootstrap]

How would I make the image glow when hover? I would like to use white-color.
<img src="resources/img/email.png" class="img-circle">
image:
http://i.stack.imgur.com/Hx0kH.png
Can't post link. So, I would like to make it glow (inside), thanks. Any help would be great
I think what you are trying to do is accomplished with two versions of the same image (use of photo editing tools). Then use this code:
<img src="URL of darker image here"
onmouseover="this.src='URL of lighter image';"
onmouseout="this.src='URL of darker image here';">
</img>
You can give glow at the borders using
img:hover
{
-moz-box-shadow: 0 0 5px 5px #ddd;
-webkit-box-shadow: 0 0 5px 5px #ddd;
box-shadow: 0 0 5px 5px #ddd;
}
You can choose the color you want according to your requirements.
you can also visit http://codepen.io/anon/pen/ilqnb
or http://css3generator.com/
You can use box-shadow withInset property
.shadow { -moz-box-shadow: inset 0 0 10px #000000; -webkit-box-shadow: inset 0 0 10px #000000; box-shadow: inset 0 0 10px #000000; }

How to put a shadow in all four sides of an image? [duplicate]

This question already has answers here:
How to apply box-shadow on all four sides?
(15 answers)
Closed 8 years ago.
I need to know how to put shadow in all four sides of a div. I need a little explanation of:
filter:
progid:DXImageTransform.Microsoft.Shadow
This will give you shadow on all 4 sides:
div.shadow {
-moz-box-shadow: 0px 0px 10px #000;
-webkit-box-shadow: 0px 0px 10px #000;
box-shadow: 0px 0px 10px #000;
}
JSFiddle
The first two 0px's mean that the shadow won't explicitly protrude either left/right or up/down. The 10px gives it enough blur to protrude out all edges. The #000 is the color of the shadow. You can play around with it to get the look you like.
Use box-shadow
.class-name{
box-shadow: 2px 2px 2px #000;
/* horizontal, vertical, blurr-radius, colour */
}
Box-Shadow
CSS3 box-shadow property has following attributes: (W3Schools)
box-shadow: h-shadow v-shadow blur spread color inset;
The main prefix for shadow to support latest browsers is box-shadow.
There are 2 other prefix available that I recommend to use for older Mozilla and Webkit:
-moz-box-shadow
-webkit-box-shadow
Try it:
img{
-webkit-box-shadow: 0 0 5px 2px #000000;
-moz-box-shadow: 0 0 5px 2px #000000;
box-shadow: 0 0 5px 2px #000000;
}
Working Demo
Reference

Image shadow css3

This is the top of the sketch of my website, I've done this in a HTML editor.
The circle we can see in the image is my logo, it's an image with alpha color background.
Shadows, borders, etc are working perfectly even in IE.
Now I'm trying to do something similar with HTML5 and CSS3 but I'm having lots of problems with image shadows and borders.
box-shadow doesn't work because it's a square image (remember it's a image with alpha color background)
The last thing I've found for image shadow is filter: drop-shadow. In theory it should work on all browsers but it's only working with chrome.
On the other hand, i can't get a border like the one on the picture. As you know, my logo is a image with alpha color background and it always makes a square border.
Can anybody give me some help. I would appreciate it. Thanxs
After using the solution Lloan Alas gave me it's working perfectly but not on mobile phone
I use dolphin browser and this is what i get:
This is my code: css:
#logo {
margin-top: -100px;
height: 188px;
width: 300px;
background-image: url("../imagenes/logo.png");
border: 5px solid white;
border-radius: 50% ;
box-shadow: 0 10px 15px #000;
-moz-box-shadow: 0 10px 15px #000;
-webkit-box-shadow: 0 10px 15px #000;
-ms-box-shadow: 0 10px 15px #000;
-o-box-shadow: 0 10px 15px #000;
-khtml-box-shadow: 0 10px 15px #000;
}html:
<div id="logo"></div>
Here is a live demo - Let me know if it helps! LIVE DEMO JSBIN
Compatible with IE 9-10, Firefox, Safari and Opera. (Supposedly)
I don't get very well what are you looking for, but if you want to add a shadow to that ellipse what you need is box-shadow, as you know
The use is:
box-shadow: horizontal-shadow-position v-shadow-pos blur spread color inset;
where you can ommit a property but you cannot change its order.
So for instance your shadow will be something like
box-shadow: 3px 3px 8px 2px #666;
because it's not inset.
In addition, to be able to use it in more browsers, you will need the browser prefix, such as
box-shadow: 3px 3px 8px 2px #666; /*Firefox (and new versions of Opera)*/
-o-box-shadow: 3px 3px 8px 2px #666; /*Opera*/
-ms-box-shadow: 3px 3px 8px 2px #666; /*Internet Explorer*/
-webkit-box-shadow: 3px 3px 8px 2px #666; /*Webkit: Safari, Chrome, Chromium...*/
Also, remember that the alpha-filter you mentioned is just the equivalent to opacity property for Firefox, Chrome, Opera, ...

CSS double border (2 colors) without using outline?

I was wondering what you guys think is the easiest way to get a double border with 2 colors around a div? I tried using border and outline together and it worked in Firefox, but outline doesn't seem to work in IE and that's sort of a problem. Any good ways to go about this?
This is what I had but outline does not work with IE:
outline: 2px solid #36F;
border: 2px solid #390;
Thanks.
You can add multiple borders using pseudo elements, and then place them around your original border. No extra markup. Cross-browser compatible, this has been around since CSS 2.1.
I threw a demo up on jsfiddle for you....note, the spacing between border colors is there for the example. You can close it by altering the number of pixels in the absolute positioning.
.border
{
border:2px solid #36F;
position:relative;
z-index:10
}
.border:before
{
content:"";
display:block;
position:absolute;
z-index:-1;
top:2px;
left:2px;
right:2px;
bottom:2px;
border:2px solid #36F
}
http://jsfiddle.net/fvHJq/1/
Use box shadow fo 2nd border.
div.double-border {
border: 1px solid #fff;
-webkit-box-shadow: 0px 0px 0px 1px #000;
-moz-box-shadow: 0px 0px 0px 1px #000;
box-shadow: 0px 0px 0px 1px #000;
}
In this case box-shadow does not ignore border-radius property like outline does
A very simple solution you could use as a fall-back if nothing else would be to use two divs. Your main div, and then an empty one just wrapping it that you could use to set the second border.
Late to the party for this question, but I feel like I should record this somewhere. You can make a scalable function in something like Less or Stylus which will create any number of borders (Stylus here):
abs(n)
if n < 0
(-1*n)
else
n
horizBorder(n, backgroundColor)
$shadow = 0 0 0 0 transparent
$sign = (n/abs(n))
for $i in ($sign..n)
/* offset-x | offset-y | blur-radius | spread-radius | color */
$shadow = $shadow, 0 (2*$i - $sign)px 0 0 #000, 0 (2*$i)px 0 0 backgroundColor
return $shadow
Then,
$background: #FFF // my background was white in this case and I wanted alternating black/white borders
.border-bottom
box-shadow: horizBorder(5, $background)
.border-top
box-shadow: horizBorder(-5, $background)
.border-top-and-bottom
box-shadow: horizBorder(5, $background), horizBorder(-5, $background)
With box-shadow you can achieve as many different color borders as you want. E.g:
#mydiv{
height: 60px;
width: 60px;
box-shadow: inset 0 0 0 5px #00ff00, inset 0 0 0 10px #0000ff;
}
<div id="mydiv"> </div>
https://jsfiddle.net/aruanoc/g5e5pzny
A little trick ;)
box-shadow:
0 0 0 2px #000,
0 0 0 3px #000,
0 0 0 9px #fff,
0 0 0 10px #fff,
0 0 0 16px #000,
0 0 0 18px #000;
.border{
width: 200px;
height: 200px;
background: #f06d06;
position: relative;
border: 5px solid blue;
margin: 20px;
}
.border:after {
content: '';
position: absolute;
top: -15px;
left: -15px;
right: -15px;
bottom: -15px;
background: green;
z-index: -1;
}
<div class="border">
</div>
use the class name for .border given the vales border:2px solid #000 for single border.then you want another border try to .border:after given the values if you got second border check out above the code sample
example

How to create shaded divs like this with CSS

I need to create shaded divs like those shown in the image below, using only CSS. Any idea about how to create them using less coding?
Thank you!
Here's a method using CSS's box-shadow, which is compatible in Firefox 3.5+, Safari 3+, Chrome, Opera 10.5+ and IE9+.
http://jsbin.com/usabe4
Multiple box-shadows are being used to get closer to the desired effect than a single box-shadow is capable of:
#box1 {
background: yellow;
-moz-box-shadow: 1px 1px 0 orange, 2px 2px 0 orange, 3px 3px 0 orange;
-webkit-box-shadow: 1px 1px 0 orange, 2px 2px 0 orange, 3px 3px 0 orange;
box-shadow: 1px 1px 0 orange, 2px 2px 0 orange, 3px 3px 0 orange;
}
Did you try using box shadow in css 3:
box-shadow:5px 5px 0 #CCCCCC
For more details check:
http://css-class.com/test/css/shadows/box-shadow-blur-offset-light.htm
Put two div's on top of each other (use z-index) and move the lower one two pixels down/right.
Is a CSS3 box-shadow close enough?
http://jsfiddle.net/4kS4F/
.box {
width: 120px;
height: 60px;
border: 1px solid #000;
background: yellow;
-webkit-box-shadow: 3px 3px 0px #777;
-moz-box-shadow: 3px 3px 0px #777;
box-shadow: 3px 3px 0px #777;
}
It's supported in many browsers: http://caniuse.com/#search=box-shadow
The notable exceptions are IE 7 and 8. If you need it to work there, you could use CSS3 PIE to provide the box-shadow.
If you need only a white background (or any fixed background color) you can make the box an image with the colored part being transparent and the edges being your background color. Then you set that as the background image, while the background color can control the face color of the box.