This question already has answers here:
How to make an inverse transparent circle in CSS [duplicate]
(2 answers)
Transparent hollow or cut out circle
(7 answers)
Closed 8 years ago.
Is there a way to get this effect in CSS ?
I try to play with this css but it cuts only first layer.
div{
width:300px;
height:300px;
position:relative;
overflow:hidden;
}
div:before{
content:'';
position:absolute;
bottom:50%;
width:100%;
height:100%;
border-radius:100%;
box-shadow: 0px 300px 0px 300px #448CCB;
}
The simplest way is to use a transparent DIV with overflow hidden (the gray one)
than inside simply put a circle with box-shadow with really large spread.
html, body{height:100%;}
body{
background: url(http://web-vassets.ea.com/Assets/Richmedia/Image/Screenshots/FIFA-Street-London1web.jpg?cb=1330546446) 50% / cover;
}
.hasCircle{
width:150px;
height:300px;
position:relative;
overflow:hidden;
float:left;
}
.hasCircle:after{
content:" ";
position:absolute;
left:0; right:0;
margin:100px auto;
width:100px;
height:100px;
border-radius:50%;
box-shadow: 0 0 0 1000px #444;
}
<div class="hasCircle"></div>
<div class="hasCircle"></div>
<div class="hasCircle"></div>
As you can see above I've used the :after pseudo element which might prevent some text in .hasCircle to be visible (due to the overlapping pseudo-element), but it's just to get an idea, you can do it using a real element like:
<div class="boxTransparentOverflow">
<div class="theTransparentCircleWithGraySpread"></div>
Some text
</div>
Related
How would I create a "short" vertical border between columns in xaringan / remark?
I want to add a vertical border between columns in my slides, but one that's only about 80% the height of the div. Here's the xaringan example for two column layout: https://slides.yihui.name/xaringan/#15
I suppose the css for the border of the left column could look something like this:
.pull-left {
border-right-width: 1px;
border-right-style: solid;
padding-right: 2px
}
But how can I get it to be a little shorter than the height of the div?
Yes, you can create 80% height from the parent div
<div></div>
div {
height:200px;
width:500px;
background:gold;
position:relative;
border-top:10px solid grey;
border-bottom:2px solid #000;
}
div:after {
content:"";
position:absolute;
top:20%;
right:0;
width:2px;
height:60%;
background:#000;
}
This question already has answers here:
Image inside div has extra space below the image
(10 answers)
Why is there a gap between my image and its containing box?
(6 answers)
Closed 4 years ago.
I have a simple absolute div and an image inside it.
I don't know why there is this strange small gap/empty space underneath the image. I used other images in the same div and it seems to be the same!
This is what I have:
.adHolder {
width:100%;
/*height: auto;*/
position:absolute;
bottom:0;
left:0;
/*border-top:solid 1px #fff;*/
padding:0;
margin:0;
z-index:1;
}
.adHolder img {
width:100%;
height:100% !important;
padding:0 !important;
margin:0 !important;
border:none;
}
<div class="adHolder">
<img src="http://t.wallpaperweb.org/wallpaper/nature/3840x1024/9XMedia1280TripleHorizontalMountainsclouds.jpg">
</div>
if you look at the bottom of the image, there is a small line (empty space) which I need to get rid of.
Any pointers would be appreciated.
add display:block to image
.adHolder {
width:100%;
/*height: auto;*/
position:absolute;
bottom:0;
left:0;
/*border-top:solid 1px #fff;*/
padding:0;
margin:0;
z-index:1;
}
.adHolder img {
width:100%;
height:100% !important;
padding:0 !important;
margin:0 !important;
border:none;
display: block;
}
<div class="adHolder"><img src="http://via.placeholder.com/350x150"></div>
I'm trying to create semi-transparent borders like on this screenshot. I could only achieve this.
How to make the borders look like those on the screenshot?
There is a CSS3 property for the background that you can use in order to have a semi-transparent borders that stay outside the background of the element. It's called background-clip. By default its property is background-clip: border-box;.
In you case you should probably use:
background-clip: padding-box;
That way the background will touch the borders but will not cover them so they will stay semi-transparent.
Reference: http://www.w3schools.com/cssref/css3_pr_background-clip.asp
Another options is using box-shadow in stead of border. For example:
element { box-shadow: 0 0 0 5px rgba(255, 255, 255, .5; }
It will have the same effect.
you dont. you just create an element behind your box and style it to look like a border:
body{
background:url(http://fc07.deviantart.net/fs70/f/2013/174/3/e/recycled_texture_background_by_sandeep_m-d6aeau9.jpg) 1000px 1000px;
}
.boxContainer{
width:500px;
height:200px;
display:block;
margin:0 auto;
position:relative;
}
.boxContainer .border{
width:100%;
height:100%;
display:block;
background:white;
opacity:0.3;
border-radius:10px;
position:absolute;
}
.boxContainer .box{
display:block;
margin:10px;
width:calc(100% - 20px);
height:calc(100% - 20px);
background:#EEEEEE;
position:absolute;
border-radius:5px;
}
<div class="boxContainer">
<div class="border"></div>
<div class="box"></div>
</div>
UPDATE:
here is an example of how it would look on your website:
Fiddle
This question already has answers here:
Multiple Background Images issues in ie7/ie8
(2 answers)
Closed 8 years ago.
I have next div with 2 background images,
But images are not visible in IE 7 and 8.
<div class="media" style="background-image: url('/play_video.png'), url('/video.jpg')">
<span>Click to play video</span>
</div>
.media {
background-position: center, center;
background-repeat: no-repeat;
width:245px;
height:150px;
cursor:pointer;
text-align:left;
position:relative;
}
.media span {
bottom: 0;
left: 0;
color: black;
}
is it possible to fix ?
Nether IE7 nor 8 support multiple background images. Source
For the sake of the community, here's a workaround using positioning.
HTML
<div class="media-back">
<span>Click to play</span>
<div class="media-play">
</div>
</div>
CSS
.media-back {
position:relative;
height:300px;
width:300px;
background-image:url(https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQIbNF1wUNRvdk13BTlt_KZ6HrspnBIpMIOXAkbHsioDTCxMT5r);
background-position:center center;
background-repeat:no-repeat;
background-size:cover;
}
.media-play {
position:relative;
background-image:url(http://tympanus.net/PausePlay/images/play.png);
background-position:center center;
background-repeat:no-repeat;
background-size:cover;
width:15%;
height:15%;
margin:0 auto;
top:50%;
transform:translateY(-50%);
}
span {
position:absolute;
bottom:0;
left:0;
cursor:pointer;
}
It's not finessed and I don't know what aesthetic you're going for, but you can fake the same effect using positioning.
I am trying to create background carve in CSS. Take a look in the picture below.
How can I add radius like this in CSS3? Anyone can help?
Use:
border-top-left-radius: 50%;
border-top-right-radius: 50%;
I made an example of it here: http://jsfiddle.net/DFs6H/2/
Add another div on the bottom with a border radius.
html:
<div class="content">
<div class="bottom_border"></div>
</div>
css:
.content{
background:#CCC;
height:100px;
width:100px;
position:relative;
overflow:hidden
}
.bottom_border {
position:absolute;
top:0;
bottom:0;
background:#FFF;
width:100px;
height:20px;
top:90px;
bottom:-10px;
border-radius: 50%
}