css: inset shadow around of an arrow - html

I design an arrow top of an ul box menu like this picture:
You can see, I set a border around of box:
border: .1rem solid rgba(228,234,248,.5);
but Is there a way to set a border around of arrow?
.mega-dropdown-menu:before {
content: "";
border-bottom: 8px solid #fbfbfb;
border-right: 9px solid transparent;
border-left: 9px solid transparent;
position: absolute;
top: -7px;
left: 13.1rem;
z-index: 10;
}

Well, no ways to set a border around the arrow as the triangle you made is itself a border. But there's a solution, you can overlay the triangles on each other like, this will give you a border effect around your triangle.
div {
position: relative;
/* make sure you use this else your elements will fly in the wild */
}
div:before {
content: "";
border-bottom: 10px solid #aaa;
border-right: 11px solid transparent;
border-left: 11px solid transparent;
position: absolute;
left: -2px;
top: -2px;
}
div:after {
content: "";
border-bottom: 8px solid #ddd;
border-right: 9px solid transparent;
border-left: 9px solid transparent;
position: absolute;
}
<div></div>

Related

:before border in datapicker

I have datapicker like this http://pokit.org/get/?fec9e8af4aa6af07f290705fff6a5769.jpg
This is my code
#ui-datepicker-div:before{
content: '';
position: absolute;
display: block;
left: 15px;
top:-9px;
width: 0;
height: 0;
border-left: 9px solid rgba(0,0,0,0.01);
border-right: 9px solid rgba(0,0,0,0.01);
border-bottom: 9px solid rgba(0,0,0,0.01) !important;
overflow: hidden;
}
Border is white and not visible on white background if I put border-bottom: 9px solid #ddd. Background of caret has color #ddd.
I need only border like on datapicker in image.

add 2 :before's :after's on same div to create 2 triangles

I have the following, where I am creating a triangle (that looks like it has a border) with css.
I want to create another triangle, exactly the same, but about 50px to the right of the 1st one.
How would you do these 2 :before's :after's ???
JSfiddle Here
HTML
<div class="section-modules">
<div class="my-account">
<div class="section-module-light">
<h3>Register Here</h3>
<p>It’s quick and easy and you’ll be the first to know about new bits we release.</p>Register Now
</div>
</div>
</div>
CSS
.section-module-light:after,
.section-module-light:before {
content: '';
position: absolute;
}
/* Styling block element */
.my-account .section-module-light {
position: relative;
margin-bottom: 2em;
padding: 1em;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
background-color: transparent;
color: #444;
}
/* Stroke */
.my-account .section-module-light:before {
bottom: -0px;
left: 150px;
border-width: 36px;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-bottom: 20px solid #ccc;
}
/* Fill */
.my-account .section-module-light:after {
bottom: -1px;
left: 150px;
border-width: 34px;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-bottom: 20px solid white;
}
JSfiddle Here
you do not need to create the triangle with separate stroke and fill, use css3 transform rotate. Then you can use before for one triangle and after for the second one.
display: block;
width: 34px;
height: 34px;
transform: rotate(45deg);
border-left: 1px solid #ccc;
border-top: 1px solid #ccc;
background: white;
see the whole code here: http://jsfiddle.net/07jfLdwL/
You can use CSS3 transform rotate properties. See documentations.

How to use :after to rotate arrow as I want

I have a little issue.
I need to get image like bellow but can't set arrow as I want but I think that I am close :)
http://jsfiddle.net/LDhLv/
.d:after {
content: "";
position: absolute;
width: 0;
height: 0;
bottom: 95%;
left: 100px;
border-left: 10px solid #666;
border-right: 10px solid transparent;
border-bottom: 10px solid transparent;
border-top: 0px solid transparent;
}
Try this:
CSS:
.d{border:1px solid #666; background: #fff; width:100px; height:50px; margin:60px;position:relative}
.d:before, .d:after{
content: "";
position:absolute;
width: 0;
height: 0;
}
.d:before {
top: -10px;
right: -1px;
border-bottom: 10px solid #666;
border-left: 10px solid transparent;
}
.d:after {
top: -8px;
right: 0px;
border-bottom: 10px solid #fff;
border-left: 10px solid transparent;
}
JSFiddle
I've tweaked the top/bottom left/right positioning for a more stable position, relative to the parent element. Also, I created the arrow in such a way that no rotation is necessary.
You need to use the right border and the rest is just position
.d:after {
content: "";
position:absolute;
width: 0;
height: 0;
bottom: 40px;
left:80px;
border-left: 10px solid transparent;
border-right: 10px solid #666;
border-bottom: 10px solid transparent;
border-top: 10px solid transparent;
}
See modified JSFiddle
Change border-left: 10px solid #666 to border-left: 10px solid transparent.. and border-top: 0px solid transparent to border-top: 10px solid transparent.
To change shape of the triangle, set 0px on border-right or just remove it completely.
jsFiddle example
.d:after {
content: "\A";
position:absolute;
bottom: 50px;
left: 90px;
border-bottom: 10px solid #666;
border-left: 10px solid transparent;
border-top: 10px solid transparent;
}

Adding arrow to bootstrap dropdown

I can figure out how to do this. This topic help me out: adding the arrow to dropdown pills for twitter bootstrap?
By adding
.dropdown-menu::after {
position: absolute;
top: -6px;
left: 10px;
display: inline-block;
border-right: 8px solid transparent;
border-bottom: 8px solid white;
border-left: 8px solid transparent;
content: '';
}
I was able to get the arrow show. However, there is no border around the top of arrow so it just looks like a gap in the dropdown now. does anyone know how to add the border to the up arrow?
Add a rule for border-top. Something like
border-top: 8px solid white;
solved by adding following markup:
.savedsearchWrapper .dropdown-menu:after {
position: absolute;
top: -6px;
left: 23px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
border-left: 6px solid transparent;
content: '';
}
.advancedSearchDropDown .dropdown-menu:before {
position: absolute;
top: -7px;
left: 17px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
Those are bootstrap styles but the selector was too specific for my implementation.

Tooltip arrow right

I'm trying to make this tooltip arrow point to the right towards the link.
CSS
.tooltipside
{
position: relative;
cursor: help;
display: inline-block;
outline: none;
}
.tooltipside span
{
visibility: hidden;
position: absolute;
bottom: -22px;
z-index: 999;
width: 52px;
margin-left: -63px;
padding: 2px;
border: 1px solid #80a7ba;
background-color: white;
-moz-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 1px 0 rgba(255,255,255,.5) inset;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 1px 0 rgba(255,255,255,.5) inset;
box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 1px 0 rgba(255,255,255,.5) inset;
text-shadow: 0 1px 0 rgba(255,255,255,.4);
}
.tooltipside:hover
{
border: 0; /* IE6 fix */
}
.tooltipside:hover span
{
visibility: visible;
}
.tooltipside span:before,
.tooltipside span:after
{
content: "";
position: absolute;
z-index: 1000;
bottom: -7px;
left: 50%;
margin-left: -8px;
border-top: 8px solid #80a7ba;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 0;
}
.tooltipside span:before
{
border-top-color: #ccc;
bottom: -8px;
}
​
The html is
<a href='#' class='tooltipside'><span>
<img src='http://cdn2.iconfinder.com/data/icons/32pxmania/misc_57.png'
border='0' width='52' height='52'></span>LINK</a> TEST TEST TEST</b>​
It currently points down in the center of the tooltip I need it to point right towards the link. How would I do this?
Thanks
Is this what you are after? http://jsfiddle.net/kX5kH/
I used the positioning to move the arrow, then swapped around the transparent broders to make the arrow point the right way.
NOTE: I added a parent <div> and positioned it absolutely, because it was otherwise hugging the edge and you couldn't see the tool tip.
Also there's no starting <b> tag.
One last note, I noticed you had a IE6 fix, which is intriguing because none of this will work in IE6. Box shadows, before/after selectors, and transparent borders will not appear correctly. But honestly I wouldn't be concerned about IE6 =P
Hope this helps.