I'm following the example at http://bootsnipp.com/snippets/featured/simple-vertical-tab. I'm not quite able to figure out how to modify the size of the arrow mark that points towards the right when a menu item is selected.
Could I please request help to identify the element in question in the CSS?
You need to open ::after inside <a> element. And then you can change the value of borders.
for example
div.bhoechie-tab-menu div.list-group>a.active:after {
content: '';
position: absolute;
left: 100%;
top: 50%;
margin-top: -13px;
border-left: 0;
border-bottom: 13px solid transparent;
border-top: 13px solid transparent;
border-left: 57px solid #5A55A3;
}
Change border value according to your needed.
CSS:
div.bhoechie-tab-menu div.list-group > a.active::after {
content: "";
position: absolute;
left: 100%;
top: 50%;
margin-top: -13px; //change as your needed
border-bottom: 13px solid transparent; //change as your needed
border-top: 13px solid transparent; //change as your needed
border-left: 10px solid #5A55A3; //change as your needed
}
Related
hi everyone i am not good at front but i need to make a text bubble like this:
speechBubble
my best attempt was this but I need to lower the diamond in half to make it look acceptable: myspeechBubble
if anyone knows how to do it in css I would really appreciate it, i need to place 3 different bubbles with one pointer in the middle, left and right
You can use the below as your starting point and adjust the positions according to your needs.
Make use of psuedo selectors to achieve the same. ( there may be limitations on the styling properties)
.box {
width: 150px;
height: 75px;
background-color: black;
color: #fff;
padding: 20px;
position: relative;
margin: 40px;
float: left;
}
.box.arrow-top {
margin-top: 40px;
}
.box.arrow-top:after {
content: " ";
position: absolute;
right: 30px;
top: -15px;
border-top: none;
border-right: 15px solid transparent;
border-left: 15px solid transparent;
border-bottom: 15px solid black;
}
.box.arrow-right:after {
content: " ";
position: absolute;
right: -15px;
top: 15px;
border-top: 15px solid transparent;
border-right: none;
border-left: 15px solid black;
border-bottom: 15px solid transparent;
}
.box.arrow-bottom:after {
content: " ";
position: absolute;
right: 30px;
bottom: -15px;
border-top: 15px solid black;
border-right: 15px solid transparent;
border-left: 15px solid transparent;
border-bottom: none;
}
.box.arrow-left:after {
content: " ";
position: absolute;
left: -15px;
top: 15px;
border-top: 15px solid transparent;
border-right: 15px solid black;
border-left: none;
border-bottom: 15px solid transparent;
}
<div class="box arrow-top">
This is a box with some content and an arrow at the top.
</div>
<div class="box arrow-right">
This is a box with some content and an arrow on the right.
</div>
<div class="box arrow-bottom">
This is a box with some content and an arrow at the bottom.
</div>
<div class="box arrow-left">
This is a box with some content and an arrow on the left.
</div>
So I want to create a button that looks like this when it's active (you can see that it has a little arrow pointing to the right)
Currently I have something like that, it stays blue after clicked, text turns white and all that. I used .addClass for that, but I have no idea if I should use it again to glue on a triangle onto my button, there has to be a better way right?
While I'm at it, how can I make the shadow/sidebar?
Please, experienced people, give this beginner some enlightenment
add below css for
.active {
height: 50px;
width: 100px;
background: blue;
height: 50px;
width: 100px;
background: blue;
position: relative;
}
.active:after {
content: "";
border-right: 10px solid transparent;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-left: 10px solid black;
height: 0;
width: 0;
position: absolute;
right: -20px;
top: 50%;
transform: translateY(-50%);
}
<div class="active"></div>
try
.active {
height: 50px;
width: 200px;
background: #0092ff;
}
.active:after {
content: "";
border-style: solid;
border-width: 10px 0 10px 10px;
border-color: transparent transparent transparent #0092ff;
display: block;
margin-left: 200px;
transform: translateY(75%);
}
.active:hover:after {
content: "";
border-left: 0px solid #0092ff;
transition: border-left 0.2s ease-in;
}
<div class="active"></div>
Please Check following working example.
$(function() {
$('.btn').click(function() {
$(this).closest('ul').find('.active').removeClass('active');
$(this).addClass('active');
});
});
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
li a {
padding: 10px;
background: teal;
position: relative;
display: block;
width: 60px;
cursor: pointer;
}
.active::after {
content: " ";
border-right: 10px solid transparent;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-left: 10px solid teal;
height: 0;
width: 0;
position: absolute;
right: -20px;
top: 50%;
transform: translateY(-50%);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul>
<li><a class="btn active">Home</a></li>
<li><a class="btn">News</a></li>
<li><a class="btn">Contact</a></li>
<li><a class="btn">About</a></li>
</ul>
you need to add position:relative to the selector ul li.
after that, you can use the following code below to add content through the pseudo element after of the active link.
change the size of the borders, as well as positions for top and right to suit your needs.
ul li.active:after {
content: "";
width: 0;
height: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-left: 20px solid #0092ff;
position:absolute;
top: 15px;
right:-15px;
}
i am working to create error message similar to Facebook signup page error message as shown bellow
i have tried and got the rectangular box as here
but i dont know how to get arrow pointed to my particular text ,as shown in Facebook.
my css class
.nameAndNumReq {
color:red;
width:100px;
left:180px;
top:10px;
font-size:small;
padding-top:2px;
padding-bottom:2px;
position: absolute;
border: 1px solid red;
background-color: white;
border-radius: 2px;
}
Take a look at the demo;
Also, google 'css triangle' technique to understand the working of the arrows. Example: http://css-tricks.com/snippets/css/css-triangle/
.bar {
position: relative;
background: #C03737;
border: 1px solid #830303;
width: 100px;
height: 40px;
border-radius: 5px;
}
.bar:after, .bar:before {
position: absolute;
content: "";
width: 0;
height: 0;
top: 50%;
}
.bar:before {
right: -8px;
margin-top: -8px;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
border-left: 8px solid #830303;
}
.bar:after {
right: -7px;
margin-top: -7px;
border-top: 7px solid transparent;
border-bottom: 7px solid transparent;
border-left: 7px solid #C03737;
}
I'm trying to create a shape in menu header which indicates that is selected (active class), but I can't bring the shape up and align it.
This is what I've tried:
HTML
<li class="active">Market</li>
CSS
.active {
z-index: -1;
position: absolute;
border-bottom: 2px solid #b6ff00;
border-left: 1px solid transparent;
border-right: 1px solid transparent;
}
EXPECTED RESULT:
JSFIDDLE: http://jsfiddle.net/Q2Dra/
You're on the right track with the border. You just needed to apply it to a pseudo element instead of the li.
Full Example:
http://jsfiddle.net/Q2Dra/4/
Relevant Code:
.active:after {
content:'';
border:10px solid transparent;
border-bottom:10px solid #b6ff00;
position:absolute;
bottom:0;
left:50%;
margin-left:-10px;
}
You need to use a psuedo element: http://jsfiddle.net/webbymatt/QL7Qr/
HTML
Home
CSS
a {
position: relative;
background: red;
padding: 6px 10px;
}
a:after {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid #fff;
content: " ";
position: absolute;
bottom: 0;
left: 50%;
margin-left: -5px;
}
I created tooltip arrows for this navigation. They show up on hover but they also show up in the bottom of the drop down. I am wondering what code is keeping them there!
Here is the code i am using to implement them.
Link to dev site
.cftopnavrightlower ul > li:hover:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
left: 50%;
bottom: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #FFC700;
margin-left: -10px;
}
You need greater specificity for the UL you are targeting for the arrows. ul.flyout is being styled with an arrow given your current selector.
This may work better:
#menu-header-nav > li:hover:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
left: 50%;
bottom: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #FFC700;
margin-left: -10px;
}