How to correctly use the Thumbnail component in React Bootstrap? - react-bootstrap

This is my mark-up:
<Thumbnail src="/path/to/image" />
This is the generated html:
<div src="/path/to/image" class="thumbnail" ><img src="/path/to/image" ></div>
This is the CSS (which comes from bootstrap-sass):
.thumbnail {
display: block;
padding: 4px;
margin-bottom: 20px;
line-height: 1.42857;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: border 0.2s ease-in-out;
-o-transition: border 0.2s ease-in-out;
transition: border 0.2s ease-in-out;
}
.thumbnail > img, .thumbnail a > img {
display: block;
max-width: 100%;
height: auto;
margin-left: auto;
margin-right: auto;
}
And this is the result:
The issue is that the border is on the div. Because the image is smaller than the div this looks odd. I would prefer the border to be on the image. The second selector above, thumbnail > img, uses max-width, and this is essential to prevent a hi-resolution image springing out of its container. So - given these CSS rules to prevent the image springing out it looks the Thumbnail has correctly put the .thumbnail class on the containing div. But then the border is on the containing div, not on the img tag.
If I just put the Bootstrap img-thumbnail class directly on the image (and forget React-Bootstrap Thumbnail altogether) I get the result I want.
.img-thumbnail has the max-width and the border.
It looks like .thumbnail is coming from bootstrap-sass. So, overall, I'm not sure if this is a problem with react-bootstrap or bootstrap-sass. At any event the React-Bootstrap Thumbnail component does not work as I would expect. Is this an error or user error?

Related

Apply webkit blur filter to parent only? ( Disable filter on child! )

I am not very experienced with coding as I've just started not too long ago, and am currently working on a Tumblr theme for here; http://heavenlyblue-theme.tumblr.com/ and I would like to make it so hovering over the posts will reveal the permalink and blur the entry only ( I want the permalink to be the focus ).
I'm not really sure how to go about doing such a thing, as applying the filter to the entry on hover makes it apply to the permalink.
I'm using Chrome atm.
#content .entry {
background-color: {color:COLOR06};
width: 500px;
margin: 0px 20px 20px;
display:inline-block;
padding: 50px;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
position: relative;
}
.entry:hover {
-webkit-filter: blur(1px);
}
.perma {
position: absolute;
width: 460px;
background-color: #fff;
height: auto;
padding: 20px;
top: 50%;
transform: translate(0, -50%);
opacity:0;
}
.entry:hover .perma {
opacity:1;
}
The HTML looks like this.
<div class="entry">
<div class="perma">
<center>▶ <a href="{Permalink}">
{NoteCountWithLabel}</a>
▶ {TimeAgo}
▶ via ✚ source
<font size="3">↻</font>
</center>
<div class="tags">{block:Tags}
✚ {Tag}
{/block:Tags}
</div>
</div>
I've searched around and I see some similar questions, but I don't really understand the solutions or, rather, how to apply them to my code here. Any help is appreciated! Thank you!

Border-Radius with position absolute images (no overlap)

I've got a inside and 's. My problem: the outer div got border-radius and overflow: hidden. The images are wider than it's parent . But overflow: hidden works well to hide the rest of the image. Only the border-radius works not on the images. Why?
My HTML structure:
<div class="teaser-container tc1-sidebar">
<a href="#">
<img class="teaser-image bottom" src="dist/img/teaser/bigteaser-bonus-hover.jpg" alt="teaser"><img class="teaser-image top" src="dist/img/teaser/bigteaser-bonus.jpg" alt="teaser">
</a>
</div>
CSS for outer :
position: relative;
overflow: hidden;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
CSS for inner 's:
position: absolute;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
Thanks for any workaround!
Look at my problem: http://jsfiddle.net/7h4SD/
see if this works simple work around
fiddle
CSS ---
.box-s1 {
width: 360px;
height:360px;
border: 1px solid #515355;
margin: 10px 0px 10px 0px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 60px;
background: url('http://weirdmovievillage.files.wordpress.com/2010/12/dexter-main-iamge1.jpg');
}
HTML
<!--
* basic problem: image is wider than box.
* round-corners don't grip
-->
<div class="teaser-image-box box-s1 tib-ef1">
</div>
Let me know if the workaround doesnot suit you. Basically setting the height and width will be equal to the image height and width :) you can also keep the image added to check its height but change visibility
display:none
In case you want the image to be there :)

White corner showing on black box with Border-radius

I am getting a odd effect (currently in chrome). I have created my own overlay dialog box. which has a semi transparent background sitting on top of my website with a box on top of that. the top of the bar as you can see has a black background. The main part of the box is white thought.
Its not the easyist to see but it is annoying me.
The white is showing through from behind. (I know as if i change it to red it changes colour) Which you can see in the top right hand corner of the screenshots, just above the "X"
Both the header and the box has a border radius 3px
.blockUI .overlay {
background: #f00;
border-radius: 3px;
margin: 0 auto;
padding: 10px;
overflow: hidden;
position: relative;
top: 20%;
text-align: inherit;
width: 600px;
z-index: 10009;
}
blockUI .overlay h1 {
background: #000;
border-bottom: 2px solid #F48421;
border-radius: 3px 3px 0 0;
color: #FFF;
font-family: 'Roboto', sans-serif;
font-weight: 300;
margin: -10px;
padding: 10px;
}
Since overflow: hidden; along with border-radius seems to cause some rendering inconsistencies in some engines (take a look at this), one should use border-radius on both the parent and the child elements to achieve rounded corners.
As you have noticed, you still get some wierd results with extra pixels "shining" through. Just reduce the border-radius of the child (or the other way round) to compensate this.
blockUI .overlay h1 {
border-radius: 2px 2px 0 0;
}
I had same problem. But I solved.
.blockUI .overlay {background:#000;}
and remake some!
You should try on the parent div:
-webkit-background-clip: padding-box;
Finally fixed this completely by adding this on parent and child divs.
-webkit-perspective: 1000;
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0,0,0);
outline:none;
border:none;
text-decoration:none;

css3 border radius animation transition in safari not working

Trying to have a css3 ease transition work on border radius of an image in Safari.
It just kinda blinks into the hover state instead of smooth transition.
Any help is much appreciated. My code is below:
CSS:
.all a:hover img {
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=100);
-moz-opacity:1;
-khtml-opacity: 1;
opacity: 1;
-webkit-filter: grayscale(0%);
}
.all a img {
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
width: 50%;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=90);
-moz-opacity:0.9;
-khtml-opacity: 0.9;
opacity: 0.9;
}
.all a img {
-moz-transition: all .3s ease;
-webkit-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
.all a img {
-webkit-filter: grayscale(100%);
transition: border-radius .3s ease;
-moz-transition: -moz-border-radius .3s ease,border-radius .3s ease;
-webkit-transition: -webkit-border-radius .3s ease,border-radius .3s ease;
}
HTML:
<ul class="thumbs">
<li class="all identity">
<img src="https://imjoeybrennan.com/images/logos_t.jpg" alt="Logos"/>
</li>
</ul>
Link to the site:
https://imjoeybrennan.com
The following applied to the parent element with the border radius applied to kick webkit back into line for me:
-webkit-mask-image: -webkit-radial-gradient(white, black);
Another option is to wrap the element in two border radius parents.
Seems hacky to me, but far better than the double wrap option – interested to hear other solutions.
This is a simple fix, Safari does not support the transition from pixels to percentages. If you change your hover styles from 50% to 100px you will see that your transitions will work smoothly.
.all a:hover img {
-webkit-border-radius: 100px;
-moz-border-radius: 100px
border-radius: 100px;
}
You may want to set them to any value that is double the height and width of your images to ensure they will always be rounded when hovered.

Animation partly works but not completely

At the moment I have this, a small DIV that slides in from the top to the center of a container DIV when the mouse hovers over the container DIV; but on mouseout, it slides back out to where it came from. What I'd like to do is have the DIV slide out of the other side of the DIV, directly opposite where it entered.
Is this possible using just CSS? (I imagine with JQuery it would be more straightforward)
<div class="blocks">
<div class="blocks_title">
</div>
</div>
<div class="blocks">
<div class="blocks_title">
</div>
</div>
.blocks {
position: relative;
float: left;
margin: 20px;
width: 100px;
height: 100px;
border: 1px dotted #333;
overflow: hidden;
}
.blocks_title {
position: relative;
width: 20px;
height: 20px;
top: 0px;
left: 40px;
background: #333;
opacity: 0;
-webkit-transition: all .25s;
-moz-transition: all .25s;
transition: all .25s;
}
.blocks:hover .blocks_title {
top: 40px;
opacity: 1;
}
And just when everyone is convinced that it's not gonna work with css only:
http://jsfiddle.net/Xkee9/36/
I used an animation for the mouseenter and a transiton for the mouseleave
Edit: added firefox fix
Edit: Explanation:
(I always use -webkit- -prefixes, just to explain it in Chrome and Safari, Firefox uses the -moz- -prefix, opera the -o- - prefix)
When nothing happens:
the block is at the bottom of the div.blocks (top:80px;), with an opacity of 0, also there is no animation running
When hovering:
the block moves instantaneous to the top with no transition (see:-webkit-transition: none;), because then the animation down-1 is running. That animation moves the block from top:0 to top:40px; in .25s. After the animation, the block stays at top:40px; because that's what I added in .blocks:hover .blocks_title.
When mousleaving:
there is no animation running anymore, but the block moves from top:40px to top:80px; in .25s because of -webkit-transition: all .25s;

Resources