css3 pie not working on dynamic css change - css

I'm using css3 PIE in order to create circle through border-radius(in IE8). It is working fine normally.
but when i'm trying to change the background color of circle, that element is turning into square.
my code looks like this.
.menuIco {
width:16px;
height:16px;
border-radius:8px;
position:relative;
z-index:101;
background-color:#38B6E7;
}
.active .menuIco {
background-color:#F1F1F1;
}
my html looks like this..
<div> <!-- i am adding .active class to this div using jquery -->
<div class="menuIco"> </div>
</div>
when i add active class to parent div(using Jquery dynamically) the menuIco (circle) should change its color. But the border-radius property is collapsing.
can anyone help me how to fix this!
Thanks in advance.

Set your border-radius to 100%.
Here's a LIVE DEMO for you to see.
.menuIco {
width:100px;
height:100px;
border-radius:100%;
position:relative;
z-index:101;
background-color:#38B6E7;
}
I have made the width and height to 100px so as to show it on a larger scale. (this can be resized as necessary)
EDIT
Depending on your browser, you should look to include the other prefixes, is shown in this fiddle
the border radius is defined by:
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
border-radius: 100%;

Related

Does IE/Edge animate calc() CSS specs appropriately?

Demonstration Link: https://codepen.io/jodriscoll/pen/wRpQOw
I'm working on a "sidewards blind-like" animation behavior, where when a user hovers over an object (anchor), it expands the object (anchor) in width and creates a perception of showing more of the objects contain within (think of a clipping mask of sorts).
Initially the video/image object is styled in a way to prevent it from moving 1:1 with the "clipping mask" (anchor wrapping the video/image). Meaning, it is already offset to the position it should be when the user hovers over the anchor.
Both the image and the video are initially styled to fill the entirety of the anchor AND the gutter gaps; this helps when animating to create the perception that we're just showing more of the photo, no actually resizing it and causing it to move on screen (sorry, that might be confusing...):
left: -24px; // the width of each gutter gap
width: calc(100% + 48px); // fill the parent + fill the gutter gaps
When the user hovers over the anchor, the child elements change their CSS specs to:
left: 0; // stay flush with the anchor object
width: 100%; // fill the parent, which now includes the gutter gap(s)
Everything appears to work correctly when viewing the animation behaviors on Chrome / Safari / Firefox:
http://svg-gmmb-cis.pantheonsite.io/wp-content/uploads/2019/01/debugging_animations.mp4
Unfortunately, there is a slight hiccup on IE11/Edge:
http://svg-gmmb-cis.pantheonsite.io/wp-content/uploads/2019/01/IE_animation_bug.mp4
Questions and hopeful helpful insight towards reaching an answer:
After viewing the animation glitch, does IE11/Edge have issues with animating CSS measures using calc()?
Do I need to create a CSS animation with keyframes to remedy this hiccup in IE11/Edge?
Am I approaching this wrong and should be animating different properties?
You can do this easily with margin and avoid the use of calc.
Here is a simplified example:
.container {
border:1px solid;
padding: 0 24px;
height:100px;
}
.box {
height:100%;
background:red;
transition:.5s all;
}
.box:hover {
margin:0 -24px;
}
<div class="container">
<div class="box"></div>
</div>
Or like this:
.container {
border:1px solid;
margin: 0 24px;
height:100px;
}
.box {
height:100%;
background:red;
transition:.5s all;
}
.box:hover {
margin:0 -24px;
}
<div class="container">
<div class="box"></div>
</div>

CSS div opacity only on outer div

I've got two divs, the outer and the inner div. I have a background image and the outer div has an opacity set however i just cannot seem to get the inner div to not inherit the opacity of outer div. i would like the inner div to be a solid colour.
my code is below and a jsfiddle here: http://jsfiddle.net/3TK3U/
<style type="text/css">
body
{
background-image:url('http://media-bubble.info/images/layout/background.png');
}
.outsideBox {
width:70%;
height:200px;
background-color: #ffffff;
opacity:0.7;
filter:alpha(opacity=70);
text-align:center;
}
.insideBox {
width:40%;
height:80px;
background-color: #999;
z-index:999999;
}
</style>
<div id="Introduction" class="outsideBox">
<div id="Introduction" class="insideBox">This is the inside box which should not inherit transparancy</div>
</div>
Try using
background-color: rgba(255,255,255,0.7);
with no opacity or filter that should make the background transparent but not effect the contents of the element.
This is an old question but still comes up in a search so an update to highlight that you can also set the opacity with hex colour values too (not sure when this was introduced or how far back compatibility is across browsers).
For example if you have a background colour like this:
background-color: #5D5C61;
you can set the opacity by adding two hex digits to the end:
background-color: #5D5C61F5;
The range is 00 (fully transparent) to (FF).
It avoids having to convert to RGB if you don't want to in your page or app.
.outsidebox {
//Add your other properties as needed
background-color: #5D5C61F5;
}
.insidebox {
//No opactity needed here if you don't
//want it transparent.
//Add your other properties as needed
background-color: #1F2833;
}

Transparent border over image

I am trying to create a transparent border for my image and place it over the image using CSS.
For example please see the image below:
To achieve this I tried the following code but I am facing the following problems:
The border is not over the image; its around the image and not allowing the image to fit 100% inside the parent div
To Make the border transparent I used "opacity" but its making the image transparent too which I don't want.
You can check the code live here: http://jsfiddle.net/6GK45/
I could create a div and made the border color transparent and then place it over the image but the problem is the width of my image is fixed (277px) but the height is not. So this will not work for me.
Could you please tell me how to create the transparent image border and place it over the image just like in the image above.?
HTML:
<div class="box" >
<img class="lightbox" src="myimage.jpg" />
This is text
</div>
CSS
.box {
width:277px;
background:#FCFBDF;
}
.lightbox {
border: 5px solid red;
z-index:999;
opacity:0.3;
}
img {
width:277px;
}
How's this - it uses :after to create a pseudo-element which places the border on top of the image, not outside it. http://jsfiddle.net/6GK45/8/
.imgWrap:after{
content:"";
position:absolute;
top:0; bottom:0; left:0; right:0;
opacity:0.5;
border:5px solid red;
}
UPDATE: If it's important to preserve the ability to right-click on the image, you can do it like this with an additional wrapper: http://jsfiddle.net/6GK45/24/
For anyone still googling for this: It is possible to achieve this effect with CSS only by using the outline property:
img {
outline: 15px solid rgba(255, 0, 0, .75);
outline-offset: -15px;
}
<img src="http://i.dailymail.co.uk/i/pix/2012/12/04/article-2242647-0F79C42300000578-201_634x429.jpg" width=250 />
As Donovan said, rgba for the border-color – but the border on an element containing the image, and then the image “pulled” outwards under the border using a negative margin and z-index – like this, http://jsfiddle.net/6GK45/7/
<div class="box" >
<span class="lightbox"><img …></span>
…
</div>
.lightbox{
display:block;
width:267px;
border:5px solid rgba(255,255,255,.75);
}
.lightbox img{
display:block;
width:277px;
margin:-5px;
position:relative;
z-index:-1;
}
If you want a border with opacity, you can use RGBA code. The 'A' signify alpha, so you can modify opacity.
border: 5px solid rgba(255,0,0, 0.3) ;
You can use z-index to put your box with border above your image if you put image and box in position absolute, relative.
I updated your fiddle. http://jsfiddle.net/6GK45/21/
What you need to do is set the image as the background of the parent div and then adjust the width/height of the child div to hug the image accordingly.
//make js fiddle work

Setting border to overflown image in CSS

Here is an example: http://jsfiddle.net/7zhLm/5/
The image inside is larger than the div supports.
Therefore it is cropping the rest (overflow-x: hidden).
I am trying to create a white border around the image, but it doesn't seem to work.
After checking what's going on there with dev tool I saw that the lower part overlays the white border.
How to I fix that?
I see you're using both overflow-x and overflow-y. You can just use overflow:hidden; as it works on any browser while -x and -y are not supported by older ones.
Anyway, to avoid it you can add another <div>. Check the live demo, and here is the updated code:
<div id="fixed_event_1" class="splashTabLogout" >
<div>
<img src="http://www.twospy.com/galleriffic/demo/Sample%202.jpg" width="300" />
</div>
</div>
.splashTabLogout {
width: 300px;
height: 100px;
cursor: pointer;
background: #fff;
padding: 10px;
/* border-radius and box-shadow stuff */
}
.splashTabLogout > div {
max-width:100%;
max-height:100%;
overflow:hidden;
}
JSFiddle
You tried to set a border with a padding. Change it to a 10px white border.
The HTML you have is fine. It's semantic, simple -- don't change it. Change the details about it, and fix the CSS, and you'll be rockin': http://jsfiddle.net/7zhLm/9/
CSS
.splashTabLogout {
border: white solid 10px;
border-radius: 3px;
box-shadow: rgba(0,0,0,.22) 0 2px 6px;
overflow: hidden;
}
.splashTabLogout img { width:300px }
HTML
<div id="fixed_event_1" class="splashTabLogout" >
<img src="your-pic.jpg" />
</div>
Note: Including width/height inside an img tag is valid. Period. In a gallery of images, or anywhere else, where you may have multiple images with the same dimensions, it's often easier, and less code to declare the width/height from the CSS file. FYI

Scroll bar in modal overlay and absolute positioned element

I'm using the jquery modal overlay pretty much out of the box as shown here:
http://flowplayer.org/tools/demos/overlay/index.htm
However, I have a dynamic search box within my overlay and when the contents are long I want to have a vertical scroll bar. So I added overflow:auto; to the CSS like this:
.simple_overlay {
/* must be initially hidden */
display:none;
overflow:auto;
/* place overlay on top of other elements */
z-index:10000;
/* styling */
background-color:#333;
width:675px;
min-height:200px;
max-height:600px;
border:1px solid #666;
/* CSS3 styling for latest browsers */
-moz-box-shadow:0 0 90px 5px #000;
-webkit-box-shadow: 0 0 90px #000;
}
Unfortunately, this automatically adds a horizontal scroll bar because of the close button:
/* close button positioned on upper right corner */
.simple_overlay .close {
background-image:url(../img/overlay/close.png);
position:absolute;
right:-15px;
top:-15px;
cursor:pointer;
height:35px;
width:35px;
}
I've played around with a few different options but with no luck. I don't have a huge amount of CSS knowledge unfortunately. If anyone could help me get the overlayed cross but no horizontal scroll bar that would be lovely.
Thank you
Tom
EDIT A friend on twitter helped me fix it. Basically I've just added another div inside the popup and set the scroll on that like this:
HTML:
<div class="simple_overlay" id="asearch">
<div id="searchbox">
<form id="amazonsearch" style='float:left;'>
<input class="title" id="amazon-terms">
<button>Search!</button>
</form>
<div id="amazon-results"></div>
</div><!--seachbox-->
</div><!--Overlay-->
CSS:
#searchbox {
overflow:auto;
width:500px;
min-height:200px;
max-height:500px;
}
Then the close cross is always positioned correctly and doesn't intefere with the scroll since the scroll only applies to the inner div :)
Maybe try overflow-y:auto instead? I'm unsure of level of browser support of that property these days.

Resources