Display arrow when there is overflow:hidden - html

Following is my jsfiddle which works fine without overflow:hidden but I have to use this property cause if I dont use it i am not able to put ... when there is an overflow of text above certain width. Kindly help me how Display arrow when there is overflow:hidden?
http://jsfiddle.net/rP5q3/1/
.arrow_box {
position: relative;
background: #1D2027;
border: 4px solid #1D2027;
width:50%;
color:white;
display:inline-block;
float:left;
margin-left:2px;
color:#FFF;
text-overflow: ellipsis;
white-space: nowrap;
overflow:hidden !important;
}
.arrow_box:after, .arrow_box:before {
left: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.arrow_box:after {
border-color: rgba(29, 32, 39, 0);
border-left-color: #1D2027;
border-width: 14px;
margin-top: -14px;
}
.arrow_box:before {
border-color: rgba(29, 32, 39, 0);
border-left-color: #1D2027;
border-width: 20px;
margin-top: -20px;
}

You can use jQuery to run what you are trying. Of course is an example, if you could explain a bit more what are you trying to do I think I will be able to make a simple code to make it work with jQuery.
var arrowBox = $("div").find(".arrow_box");
if (arrowBox.css({"overflow" : "hidden"}){
// jQuery code to display the arrow when "overflow:hidden;"
};
Here you have a demo on JSFiddle.

Related

Dynamic speech bubble in CSS

I'm trying to make something like this:
I'd like to use pure CSS. Bootstrap v3 is already loaded.
I've gotten pretty close with something like
.bubble {
position:relative;
left: 15px;
padding: 10px;
background: #FFFFCC;
margin: 5px 5px;
max-width: 250px;
border: #FFCC00 solid 1px;
}
.bubble:before {
position:absolute;
content: "";
top:15px;left:-10px;
border-width: 10px 15px 10px 0px;
border-color: transparent #FFFFCC;
border-style: solid;
}
But the result is not quite what I'm looking for.
I've searched around and fiddled a bit, but have not found an elegant solution that fits my needs.
Years ago I would have done this with tables and images, but surely there's a better way in 2015?
Here is a 2015 version...
.bubble {
position: relative;
background: #FFFFCC;
border: 1px solid #FFCC00;
max-width:250px;
padding:10px;
font-family:arial;
margin:0 auto;
font-size:14px;
border-radius:6px;
}
.bubble:after,
.bubble:before {
right: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.bubble:after {
border-color: rgba(255, 255, 204, 0);
border-right-color: #FFFFCC;
border-width: 15px;
margin-top: -15px;
}
.bubble:before {
border-color: rgba(255, 204, 0, 0);
border-right-color: #FFCC00;
border-width: 16px;
margin-top: -16px;
}
SEE IT IN ACTION:
http://jsfiddle.net/ajahb5p1/
NOTE:
You can adjust the size of the arrow simply by changing the border-width and margin-top values in the .bubble:after definition (currently set to 15px and -15px)
To make sure it retains it's border, you would also need to change these same 2 values in the .bubble:before definition (currently set to 16px and -16px)

Border-bottom and border-image issues

I'm having some issues with border-bottom and border-image.As I understand it I can set an image for my border , in this case I want the image to be :
However I do not get the image and it just stays a normal 3px border with the color I've specified.And it seems that the image is not taken into consideration.
Can anyone point me to the right direction(Check bootply):
http://www.bootply.com/G5LTvI8YR9
You can do it through css only without using any image
Demo
ul.nav a:hover {
position: relative;
border-bottom: 4px solid #f39385;
}
ul.nav a:hover:after, ul.nav a:hover:before {
bottom: 0px;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
ul.nav a:hover:after {
border-color: rgba(243, 147, 133, 0);
border-bottom-color: #f39385;
border-width: 3px;
margin-left: -3px;
}
ul.nav a:hover:before {
border-bottom-color: #f39385;
border-width: -6px;
margin-left: -6px;
border-color: rgba(243, 147, 133, 0);
}
In your case, using a background image on hover state is much simpler than using an image for the border.
I made up this example based on you bootply that should show what you are looking for (The background image is the one you posted, you might need to tweak it and remove unused white parts on the left and right of it so that the triangle is centered) :
DEMO
CSS :
a:hover {
color: #f39385!important;
background: url(http://i.stack.imgur.com/fIzS3.png) right bottom no-repeat;}
a {
text-transform: uppercase;
color: #b9b9b9;
font-size: 11px;
padding-bottom: 30px;
width:112px;
display:inline-block;
text-align:center;
}
Here's a FIDDLE if you are interested in CSS solution.
<span class="border"></span>
.border {
position: relative;
display: block;
width: 70px;
background: #f0745f;
border: 4px solid #f0745f;
}
.border:before,
.border:after {
bottom: 100%;
left: 50%;
border: solid transparent;
content: "";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.border:before {
border-color: transparent;
border-bottom-color: #f0745f;
border-width: 10px;
margin-left: -10px;
}
.border:after {
border-color: transparent;
border-bottom-color: #f0745f;
border-width: 4px;
margin-left: -4px;
}

CSS3: Change shape of button on hover

I created a button:
http://jsfiddle.net/fy2zG/#&togetherjs=xaJ1VA8PBN
My css so far is:
.button {
padding: 5px 20px;
background: orange;
position: relative;
float:left;
text-align: center;
border-radius: 10px;
text-decoration: none;
color: white;
}
My goal is to have (only) the right side of the button turning to an arrow peak on hover. The result should be something similar like this:
When hovering out, the button shall transit to its original shape.
Is this something that can be achieved with CSS or is jQuery needed?
Working example
jsfiddle
EDIT, now with transition
jsfiddle
EDIT, now with transition on mouseout
jsfiddle
HTML
login
CSS
.button {
padding: 5px 20px;
background: orange;
position: relative;
float:left;
text-align: center;
border-radius: 10px;
text-decoration: none;
color: white;
position:relative;
}
.button:after {
content: " ";
border: solid transparent;
border-width: 0;
border-left-color: orange;
position: absolute;
-webkit-transition: all 1s ease;
left: 100%;
top: 50%;
}
.button:hover:after {
content: " ";
display:block;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(0, 0, 0, 0);
border-left-color: orange;
border-width: 25px;
margin-top: -25px;
margin-left: -10px;
}
Can't make that with css or jQuery (unless i don't know some plugin).
Basically you must have two images. One for normal button, one for arrow shaped button. And onNover just change background image using background transition. But i think it will look ugly.

css3 arrow too large and not opaque

I have the following css arrow fiddle:
<div class="arrow"></div>
.arrow { background-color: #F4922D; width: 300px; background: rgba(244,146,45,0.9); padding: 40px 30px; min-height: 100px; position: relative; }
.arrow:after { left: 100%; top: 0; bottom: 0; border: solid transparent; content: " "; width: 0; position: absolute; pointer-events: none; border-color: rgba(244, 146, 45, 0); border-left-color: #F4922D; border-width: 90px; }
My questions are
1: how would I make the arrow tip thinner - ie at the moment to get the point it has to be 90px border-width but I would like the point to show at around 30px but if I change the border width the point just gets cut off
2: how would I make the tip opaque, I tried using border-color: rgba(244, 146, 45, 0.5); but that didn't change anything
Adjust only the width of the left border on it to get the 'thin-ness' I think you mean. To make give the tip the same transparency as the <div> itself, again, you need to target only the left border:
.arrow:after {
left: 100%;
top: 0; bottom: 0;
border: solid transparent;
content: " ";
width: 0;
position: absolute;
pointer-events: none;
border-color: transparent;
border-left-color: rgba(244,146,45,0.9);
border-width: 90px;
border-left-width: 160px;
}
JSFiddle
To solve the opacity issue,
just simply set
opacity: 0.9;
on the pseudo :after element that should solve the issue,
and if you want a cross browser implementation of it then take a look at this
http://css-tricks.com/snippets/css/cross-browser-opacity/

Speech bubble background for arrow as well

Hi I have done a speech bubble but I want to get the background image to come into the arrow as well. I did find some examples as well but editing them to fit my needs is confusing because I cant position the arrow to the place I want it to be in the end.
.bubble {
position: relative;
width: 227px;
height: 310px;
background-color:white !important;
background: url(../images/thepartypeople/assets/main-bg.png) repeat 0 0;
}
.bubble:after {
content: "";
position: absolute;
top: 128px;
left: -15px;
border-style: solid;
border-width: 15px 15px 15px 0;
border-color: transparent #000;
display: block;
width: 0;
z-index: 1;
}
This is my code that I have for my speech bubble.
Any help would be appriciated
Thanks alot.
Here is the question answered elsewhere
Creating a transparent arrow above image in CSS3
But, I'll give you the HTML and CSS for your specific answer. I changed your HTML a little bit by the way.
<div class="bubble">
<img class="test" src="http://placekitten.com/241/310" alt="kitten" />
</div>
You can keep it with just the div .bubble and have background: url('http://placekitten.com/241/310'); but the image would have to be exactly the height and width of the div.
.bubble {
position:relative;
width:241px;
height: 310px;
}
.bubble:before, .bubble:after {
content:'';
position:absolute;
width:0;
border-left:15px solid white;
left:0;
}
.bubble:before {
top:0;
height:128px;
border-bottom:15px solid transparent;
}
.bubble:after {
top:143px;
bottom:0;
border-top:15px solid transparent;
}
.test {
display:block;
width:100%;
}
Here is a fiddle http://jsfiddle.net/WUXQd/2/ the fiddle has comments in it explaining a bit how it works.
EDIT: By the way this creates a mask around the image and two reverse triangles to make it look like there is a transparent triangle.
is this similar to what you wanted?
.bubble {
position: relative;
width: 250px;
height: 120px;
padding: 0px;
background: #FFFFFF;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
background: url(border.jpg) repeat 0 0;
}
.bubble:after {
content: "";
position: absolute;
top: 45px;
left: -15px;
border-style: solid;
border-width: 15px 15px 15px 0;
border-color: transparent #FFFFFF;
display: block;
width: 0;
z-index: 1;
border-image: url(border.jpg);
}
EDIT: This link can help you: http://www.sitepoint.com/pure-css3-speech-bubbles/