I m trying to implement below button CSS, I tried to used box-shadow as well psuedo code i.e before after still not getting the output I wanted.
the button that I wanted:
my code:
.et_pb_button {
background-color: #f16922!important;
width: 65%;
outline: 3px solid #f16922;
outline-offset: 10px;
text-transform: uppercase;
font-size: 14px!important;
}
Button
Please see below snippet:
button {
position: relative;
display: inline-block;
vertical-align: top;
background-color: blue;
color: #fff;
border-radius: none;
text-transform: uppercase;
border: none;
padding: 10px 12px;
}
button::after {
content: '';
position: absolute;
top: 5px;
left: -5px;
right: -5px;
bottom: -5px;
border: 1px solid red;
display: block;
z-index: -1;
}
<button>View Project</button>
.btngroup button{
background-color: rgb(29, 174, 236);
border: 0;
padding: 10px 15px;
font-size: 15px;
color: white;
width: 150px;
height: 50px;
text-transform: uppercase
}
.btngroup .drop{
width: 165px;
height: 50px;
border: 1.5px solid red;
margin-top: -42.5px;
}
<center>
<div class="btngroup">
<button>view project</button>
<div class="drop"></div>
</div>
</center>
Here is an idea with one element and multiple background and border-image:
.button {
display:inline-block;
padding:10px 60px 20px;
margin:10px;
color:#fff;
border:2px solid transparent;
border-image:linear-gradient(to bottom,transparent 10px,red 0) 2;
background:
linear-gradient(blue,blue) top center/calc(100% - 20px) calc(100% - 10px),
linear-gradient(red,red) 0 8px /100% 2px;
background-repeat:no-repeat;
}
<span class="button">Button</span>
And with CSS variable to easily control the whole shape:
.button {
--t:10px; /* Distance of the border from the top*/
--p:10px; /* Distance between the border and background*/
--b:2; /* Thickness of the border (unitless to be used with slice)*/
--c:red; /* border color*/
display:inline-block;
padding:var(--p) 60px calc(2*var(--p));
margin:10px;
color:#fff;
border:calc(1px*var(--b)) solid transparent;
border-image:linear-gradient(to bottom,transparent var(--t),var(--c) 0) var(--b);
background:
linear-gradient(blue,blue) top center/calc(100% - 2*var(--p)) calc(100% - var(--p)),
linear-gradient(var(--c),var(--c)) 0 calc(var(--t) - 1px*var(--b))/100% calc(1px*var(--b));
background-repeat:no-repeat;
}
<span class="button">Button</span>
<span class="button" style="--c:green;--t:15px;--p:8px;--b:3;">Button</span>
<span class="button" style="--c:#000;--t:25px;--p:15px;--b:1;">Button</span>
Here's an alternative based on Hanif's suggestion, which uses both pseudo-elements instead of one with a negative z-index. For some backgrounds (e.g. an image or gradient), it might be necessary to adjust the background-position for the ::after
button {
position: relative;
display: inline-block;
vertical-align: top;
background-color: blue;
color: #fff;
border-radius: none;
text-transform: uppercase;
border: none;
padding: 10px 12px;
}
button::before {
content: '';
position: absolute;
top: 5px;
left: -5px;
right: -5px;
bottom: -5px;
border: 1px solid red;
display: block;
}
button::after {
content: '';
position: absolute;
top: 5px;
left: 0;
right: 0;
height: 1px;
background: inherit;
display: block;
}
<button>View Project</button>
Related
How can i achieve the top left part of this box like the image below with css?
I can't make the shadow below the yellow triangle.
some suggestions would be helpfull.
Below is my CSS + HTML so far:
:root {
--jaune: #FFF701;
--bleu: #212D55;
}
.book{
margin-bottom: 0px;
font-size: x-small;
color: #364165;
text-align: center;
}
.box {
border: 1px solid var(--bleu);
background-color: #fff;
position: relative;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 16px;
}
.box::before {
content: ' ';
border-top: 32px solid #d3d5dd;
border-right: 30px solid var(--jaune);
width: 0;
position: absolute;
}
.btn_book{
background-color: #212d55;
width: 128px;
margin-right:79px;
margin-left:79px;
border: 1px solid #212d55;
position: absolute;
color: white;
text-transform: uppercase;
cursor: pointer;
}
.btn_book:hover{
background-color: var(--jaune);
color:#212d55;
}
.btn_book:hover::before {
border-top: 10px solid #212d55;
}
.btn_book:before {
content: "";
height: 0;
width: 0;
border-top: 10px solid #fffa0a;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
position: absolute;
z-index: 1;
top:0;
left: 0;
transform-origin: left;
transform: translate(60%) translateY(-71%) rotate(135deg)
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="box" style="width: 18rem; height: 19rem;">
<img src="https://b2btolink.com/leboudoir/wp-content/themes/leboudoir/images/logo.png" style="width: 100px; margin-left:80px;">
<p style="text-align:center;color: #212d55;">
<b>NEW CANAAN</b>
</p>
<hr class="dashed">
<p class="book"> 160 Main Street</p>
<p class="book"> New Canaan CT 06840</p>
<p class="book"> 203-957-8600</p>
<hr class="dashed">
<button type="button" class="btn_book">BOOK NOW</button>
</div>
How can this be possible with shadow property
Here is an idea using multiple background with gradient and skew transformation:
.box {
border: 1px solid #212D55;
background-color: #fff;
position: relative;
margin: 10px;
background:
linear-gradient(to top left,transparent 50%,#d3d5dd 50%) top left/32px 32px no-repeat;
}
.box::before {
content: ' ';
position: absolute;
top:-1px;
left:-1px;
width:34px;
height:34px;
background:
linear-gradient(to bottom right,transparent 45%,grey 50%) bottom/100% 5px,
linear-gradient(to bottom right,transparent 45%,grey 50%) right/5px 100%,
linear-gradient(to bottom right,transparent 50%,yellow 50%);
background-repeat: no-repeat;
transform: skew(5deg,5deg);
}
<div class="box" style="width: 18rem; height: 19rem;">
</div>
You will need to adjust this a little, but you should be able to use clip-pathto create a triangle on another div, then change the z-index on your ::before to bring it in front of the triangle.
:root {
--jaune: #FFF701;
--bleu: #212D55;
}
.book{
margin-bottom: 0px;
font-size: x-small;
color: #364165;
text-align: center;
}
.box {
border: 1px solid var(--bleu);
background-color: #fff;
position: relative;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 16px;
}
.box::before {
content: ' ';
border-top: 32px solid #d3d5dd;
border-right: 30px solid var(--jaune);
width: 0;
position: absolute;
z-index: 100;
}
.shadow{
position: absolute;
top: 5px;
height: 41px;
left: 0px;
width: 37px;
background: #A0A0A0;
clip-path: polygon(83% 0%, 4% 63%, 100% 91%);
z-index: 1;
}
.btn_book{
background-color: #212d55;
width: 128px;
margin-right:79px;
margin-left:79px;
border: 1px solid #212d55;
position: absolute;
color: white;
text-transform: uppercase;
cursor: pointer;
}
.btn_book:hover{
background-color: var(--jaune);
color:#212d55;
}
.btn_book:hover::before {
border-top: 10px solid #212d55;
}
.btn_book:before {
content: "";
height: 0;
width: 0;
border-top: 10px solid #fffa0a;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
position: absolute;
z-index: 1;
top:0;
left: 0;
transform-origin: left;
transform: translate(60%) translateY(-71%) rotate(135deg)
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="box" style="width: 18rem; height: 19rem;">
<div class="shadow"></div>
<img src="https://b2btolink.com/leboudoir/wp-content/themes/leboudoir/images/logo.png" style="width: 100px; margin-left:80px;">
<p style="text-align:center;color: #212d55;">
<b>NEW CANAAN</b>
</p>
<hr class="dashed">
<p class="book"> 160 Main Street</p>
<p class="book"> New Canaan CT 06840</p>
<p class="book"> 203-957-8600</p>
<hr class="dashed">
<button type="button" class="btn_book">BOOK NOW</button>
</div>
I have a div that has a background image but has 50% opacity.
Now I have a div that is child and I want what every the content it has to have 100% opacity. You can see in the snipplet headings and textbox and button has less opacity.
Can anyone help how to fix this thing? I tried to apply opacity 100% to child but it didn't work.
/* CSS to be fixed*/
#home_div
{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/1/1e/Shoppers_on_Dundas%2C_near_Yonge.jpg/1200px-Shoppers_on_Dundas%2C_near_Yonge.jpg");
opacity: 0.5;
filter: alpha(opacity=50);
/*background-color: #0050A0;*/
background-color: lightgrey;
padding-top: 200px;
color: white;
padding-bottom: 200px;
height: 100%;
}
#home_div_content
{
opacity: 1.0;
filter: alpha(opacity=100);
text-align: center;
}
#header
{
height: 70px;
border-bottom: 4px solid lightgrey;
}
#header_content
{
margin-top: 10px;
margin-left: 80px;
}
.brandmark
{
margin-top: -20px;
}
.link_to a
{
color: #0050A0 !important;
}
.featured_div
{
display: none;
}
.featured_close_anchor, .featured_anchor_close
{
text-align: center;
}
#heading, #tag_line
{
top: -300px;
position:relative;
color: #0050A0;
}
#search
{
border-radius: 0 !important;
border-color: #0050A0 !important;
width: 60%;
height: 35px;
padding: 8px 15px;
color: #0050A0; /* change color of text to be typed inside search box */
font-size: 13px;
line-height: 20px;
background-color: transparent;
border: 1px solid #ccc;
-webkit-box-shadow: none;
box-shadow: none;
}
.btn-custom {
color: #FFFFFF;
background-color: #0050A0; /* change button color */
border-radius: 0!important; /* button border radius */
padding: 5px 11px; /* Button size change*/
margin-top: -3.5px;
border-top: 2px solid #0050A0;
border-bottom: 3px solid #0050A0;
margin-left: -3px;
}
.btn-custom:hover{
background-color:#9AC94B; /* change button color on hover */
border-radius: 0!important;
}
.left_categories
{
padding-top: 5px;
padding-bottom: 5px;
margin-bottom: 1px;
border-left: 4px solid #0050A0;
}
.left_categories:hover
{
border-top: 1px solid lightgrey;
border-bottom: 1px solid lightgrey;
border-left: 4px solid #E5002B;
}
.active_category
{
background-color: #0050A0;
color: white !important;
border-left: 4px solid #E5002B;
}
.search_section
{
margin-top: 30px;
}
a
{
text-decoration: none !important;
}
.flash_nav
{
height: 90px;
border: 0 !important;
background-color: #283442;
}
.gradient
{
background: -moz-linear-gradient(left, white 0%, white 45%, #12A8E0 85%, #0050A0 100%);
}
.flash_navbar a
{
color: black !important;
}
.search_form
{
width: 70%;
}
.nav_form
{
border-radius: 0;
margin-top: 27px;
}
#searchBar
{
border-color: #0050A0;
}
#searchButton
{
background-color: #0050A0;
color: white;
border: none;
}
<div id="home_div">
<div class="container" id="home_div_content">
<h1 id="heading">Find your product!</h1>
<h4 id="tag_line">Search what you are looking for.</h4>
<form method="GET" action="/product/search">
<input type="text" name="product" id="search" placeholder="Enter product name" class="searchTextBox" />
<button type="submit" id="quick-search" class="btn btn-custom"><span class="glyphicon glyphicon-search custom-glyph-color"></span></button>
</form>
<br />
view <i class="fa fa-chevron-down"></i> featuring
</div>
</div>
FIDDLE
An opacity rule will always affect child/descendant elements since they are part of the parent, and the rule says the parent should be 50% opacity.
To get round this, use a pseudo element and give that reduced opacity rather than the parent.
HTML
<div id='outer'>
<div id='inner'></div>
</div>
CSS
#outer { width: 200px; height: 200px; position: relative; padding: 2em; }
#outer::before { content: ''; position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: red; opacity: .5; z-index: -1; }
#inner { width: 100%; height: 100%; background: blue; }
Fiddle.
I want to make a circle <div>, like this image:
I have tried this code.
.discussion:after {
content: '\2807';
font-size: 1em;
background: #2d3446;
width: 20px;
height: 20px;
border-radius: 100px;
color:white;
}
<div class="discussion"></div>
How can I do this correctly?
You could just use :after pseudo-element with content: '•••' and transform: rotate. Note that this is the bullet HTML special character •, or \u2022.
div {
position: relative;
background: #3F3C53;
width: 50px;
height: 50px;
color: white;
border-radius: 50%;
box-shadow: 0px 0px 15px 1px #4185BC;
margin: 50px;
}
div:after {
content: '•••';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(90deg);
font-size: 15px;
letter-spacing: 4px;
margin-top: 2px;
}
<div></div>
Improving on Nenad Vracar's answer, here's one that doesn't use text (so it's font-independent) and everything is centered nicely:
div {
position: relative;
background: #3F3C53;
width: 50px;
height: 50px;
border-radius: 50%;
box-shadow: 0px 0px 15px 1px #4185BC;
margin: 50px;
}
div:after {
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 2px;
height: 2px;
margin-left: -1px;
margin-top: -1px;
background-color: white;
border-radius: 50%;
box-shadow: 0 0 0 2px white, 0 11px 0 2px white, 0 -11px 0 2px white;
}
<div></div>
Yet another answer, same as others except:
it uses the vertical ellipsis character (U+22EE)
text-align and line-height to center the content
does not use any pixel value
.discussion:after {
content: "\22EE";
/* box model */
display: inline-block;
width: 1em;
height: 1em;
/* decoration */
color: #FFFFFF;
background-color: #000000;
border-radius: 50%;
/* center align */
line-height: 1;
text-align: center;
}
<div class="discussion"></div>
<div class="discussion" style="font-size: 2em;"></div>
<div class="discussion" style="font-size: 3em;"></div>
<div class="discussion" style="font-size: 4em;"></div>
Note that U+2807 is actually a Braille pattern and the dots are not supposed to be centered.
Use this code.
.discussion {
width: 20px;
height: 20px;
border-radius: 50%;
position: relative;
background: #2d3446;
}
.discussion:after {
content: '\22EE';
font-size: 1em;
font-weight: 800;
color: white;
position: absolute;
left: 7px;
top: 1px;
}
<div class="discussion"></div>
Hope this helps!
I hope this is what you wanted! Otherwise feel free to ask.
.discussion{
display: block; /* needed to make width and height work */
background: #2d3446;
width: 25px;
height: 25px;
border-radius: 100px;
display: flex;
align-items: center;
justify-content: center;
}
.discussion:after {
content: '\2807';
font-size: 1em;
color: white;
margin-left: 15%;
}
<div class="discussion"></div>
Using text dots
.discussion{
width:50px;
height:50px;
text-align:center;
background-color:black;
border: 2px solid red;
border-radius: 100%;
}
.discussion text{
writing-mode: tb-rl;
margin-top:0.4em;
margin-left:0.45em;
font-weight:bold;
font-size:2em;
color:white;
}
<div class="discussion"><text>...</text></div>
.discussion:after {
content: '\2807';
font-size: 1em;
display: inline-block;
text-align: center;
background: #2d3446;
width: 20px;
height: 20px;
border-radius: 50%;
color: white;
padding:3px;
}
<div class="discussion"></div>
I have deleted (i found how to do it) all my post, the following code works for 3 vertical dot into a black circle
.discussion:after{
display:inline-block;
content:'\22EE';
line-height:100%;
border-radius: 50%;
margin-left:10px;
/********/
font-size: 1em;
background: #2d3446;
width: 20px;
height: 20px;
color:white;
}
<div class="discussion"></div>
I need to create div with angled corners (not rounded) with 2px border-width at my div:
I need a CSS-only solution
.center-link {
text-align: center;
}
.continue {
text-decoration: none;
border: 2px solid #26368d;
border-radius: 10px;
background-color: transparent;
margin: 0 auto;
padding: 10px 10px 9px;
font-family: 'Raleway';
text-transform: uppercase;
font-size: 11px;
font-weight: bold;
color: #26368d;
transition: all 0.5s ease;
}
<div class="center-link">Продолжить читать</div>
You could take a loook at gradient or single pixel image and background properties, background-size will help to draw the shapes
body {
text-align:center;
}
a {
display:inline-block;
text-decoration:none;
color:inherit;/* will use parent color if not reset */
margin:1em;
padding:0.5em 1em;
background: /* lets draw the background image via current color if text color is to be matched */
linear-gradient(45deg, transparent 0.5em, currentcolor 0.5em, currentcolor calc(0.5em + 2px), transparent calc(0.5em + 2px)),
linear-gradient(-45deg, transparent 0.5em, currentcolor 0.5em, currentcolor calc(0.5em + 2px), transparent calc(0.5em + 2px)),linear-gradient(225deg, transparent 0.5em, currentcolor 0.5em, currentcolor calc(0.5em + 2px), transparent calc(0.5em + 2px)),linear-gradient(-225deg, transparent 0.5em, currentcolor 0.5em, currentcolor calc(0.5em + 2px), transparent calc(0.5em + 2px)),
linear-gradient(to left, currentcolor, currentcolor) top no-repeat,
linear-gradient(to left, currentcolor, currentcolor) bottom no-repeat,
linear-gradient(to top, currentcolor, currentcolor) left no-repeat,
linear-gradient(to top, currentcolor, currentcolor) right no-repeat;
/* resize gradient/image in order to draw pieces needed */
background-size:
auto auto,
auto auto,
auto auto,
auto auto,
calc(100% - 1em - 6px ) 2px,
calc(100% - 1em - 6px) 2px,
2px calc(100% - 1em - 6px ),
2px calc(100% - 1em - 6px)
;
}
/* find out the purpose of currentcolor here */
:nth-child(1) {
color:purple
}
:nth-child(2) {
color:gold
}
:nth-child(3) {
color:pink
}
:nth-child(4) {
color:tomato
}
:nth-child(5) {
color:turquoise
}
/* increase size via padding ? */
:nth-child(6) {
padding:1em 2em;
color:gray
}
button link
button link
button link
button link
button link
button link
Demo pen to play with
You could use two span's for left and right border and then use :before and :after on those spans to create corners.
a {
text-decoration: none;
white-space: nowrap;
margin: 10px;
}
.el {
display: inline-flex;
align-items: center;
justify-content: space-between;
border-top: 1px solid black;
border-bottom: 1px solid black;
margin: 50px;
position: relative;
}
span {
height: 20px;
position: relative;
}
span.left {
border-left: 1px solid black;
}
span.right {
border-right: 1px solid black;
}
.left {
margin-left: -10px;
}
.right {
margin-right: -10px;
}
span:before,
span:after {
content: '';
position: absolute;
width: 1px;
background: black;
height: 15px;
}
.left:before {
transform: rotate(40deg);
top: -13px;
left: 4px;
}
.left:after {
transform: rotate(-40deg);
bottom: -13px;
left: 4px;
}
.right:before {
transform: rotate(-40deg);
top: -13px;
right: 4px;
}
.right:after {
transform: rotate(42deg);
bottom: -13px;
left: -5px;
}
<div class="el">
<span class="left"></span>
Lorem ipsum dolor.
<span class="right"></span>
</div>
You should be able to keep a hit test accurate by using a skew along with a perspective, allowing you to create this bevelled button without affecting the user experience.
Something like adding:
transform: perspective(25px) rotateY(45deg);
A quick demo would be:
button {
border: 0;
border-top: 5px solid tomato;
border-bottom: 5px solid tomato;
color: tomato;
margin-left: 20px;
margin-right: 20px;
background: transparent;
padding: 10px;
outline: none;
padding-left: 50px;
padding-right: 50px;
position: relative;
cursor: pointer;
}
button:before {
content: "";
position: absolute;
top: -5px;
left: 100%;
height: 100%;
width: 20px;
background: inherit;
transform: perspective(25px) rotateY(45deg);
transform-origin: center left;
border-top: 5px solid tomato;
border-right: 8px solid tomato;
border-bottom: 5px solid tomato;
}
button:after {
content: "";
position: absolute;
top: -5px;
right: 100%;
height: 100%;
width: 20px;
background: inherit;
transform: perspective(25px) rotateY(-45deg);
transform-origin: center right;
border-top: 5px solid tomato;
border-left: 8px solid tomato;
border-bottom: 5px solid tomato;
}
<button>Button</button>
As a side note, this solution can be shortened and made a lot more efficient by placing the duplicate rules within a single selector (button:before, button:after{})
So I've found this answer - CSS3 menu shape, style but have no idea on how to put it on the left side. I've searched for it already but with no luck.
This is what I'm trying to achieve:
And I've found this one also - Change the shape of the triangle. How can I make it work on the opposite side? I mean the arrow needs to be on the left side. And is it possible to do this with one div?
Want one that you can put over any background color?
jsBin demo
Only this HTML:
<span class="pricetag"></span>
And this CSS:
.pricetag{
white-space:nowrap;
position:relative;
margin:0 5px 0 10px;
displaY:inline-block;
height:25px;
border-radius: 0 5px 5px 0;
padding: 0 25px 0 15px;
background:#E8EDF0;
border: 0 solid #C7D2D4;
border-top-width:1px;
border-bottom-width:1px;
color:#999;
line-height:23px;
}
.pricetag:after{
position:absolute;
right:0;
margin:1px 7px;
font-weight:bold;
font-size:19px;
content:"\00D7";
}
.pricetag:before{
position:absolute;
content:"\25CF";
color:white;
text-shadow: 0 0 1px #333;
font-size:11px;
line-height:0px;
text-indent:12px;
left:-15px;
width: 1px;
height:0px;
border-right:14px solid #E8EDF0;
border-top: 13px solid transparent;
border-bottom: 13px solid transparent;
}
which basically follows this principles: How to create a ribbon shape in CSS
If you want to add borders all around:
jsBin demo with transform: rotate(45deg) applied to the :before pseudo
.pricetag{
white-space:nowrap;
position:relative;
margin:0 5px 0 10px;
displaY:inline-block;
height:25px;
border-radius: 0 5px 5px 0;
padding: 0 25px 0 15px;
background:#E8EDF0;
border: 1px solid #C7D2D4;
color:#999;
line-height:23px;
}
.pricetag:after{
position:absolute;
right:0;
margin:1px 7px;
font-weight:bold;
font-size:19px;
content:"\00D7";
}
.pricetag:before{
position:absolute;
background:#E8EDF0;
content:"\25CF";
color:white;
text-shadow: 0 0 1px #aaa;
font-size:12px;
line-height:13px;
text-indent:6px;
top:3px;
left:-10px;
width: 18px;
height: 18px;
transform: rotate(45deg);
border-left:1px solid #C7D2D4;
border-bottom:1px solid #C7D2D4;
}
Since the example image in the question has extra outer borders, achieving it with the border trick will involve multiple (pseudo) elements and will become complex (because in addition to the arrow shape, a circle is also needed in front). Instead, the same could be achieved by using transform: rotate() like in the below sample.
The approach is pretty simple and as follows:
The parent div container houses the text that should be present within the price-tag shape.
The :after pseudo-element has transform: rotate(45deg) and produces the triangle shape. This is then positioned absolutely with respect to the left edge of the parent. The background set on the pseudo-element prevents the left border of the parent container from being visible.
The :before pseudo-element forms the circle present on the left side (using border-radius).
The X mark at the end is added using a span tag and the × entity.
The parent div container's width is set to auto so that it can expand based on the length of the text.
Note: This sample uses transforms, so will require polyfills in lower versions of IE.
div {
position: relative;
display: inline-block;
width: auto;
height: 20px;
margin: 20px;
padding-left: 15px;
background: #E8EDF2;
color: #888DA3;
line-height: 20px;
border-radius: 4px;
border: 1px solid #C7D2DB;
}
div:after,
div:before {
position: absolute;
content: '';
border: 1px solid #C7D2DB;
}
div:after { /* the arrow on left side positioned using left property */
height: 14px;
width: 14px;
transform: rotate(45deg);
background: #E8EDF2;
border-color: transparent transparent #C7D2DB #C7D2DB;
left: -6px;
top: 2px;
}
div:before { /* the circle on the left */
height: 4px;
width: 4px;
border-radius: 50%;
background-color: white;
left: 0px;
top: 7px;
z-index: 2;
}
.right { /* the x mark at the right */
text-align: right;
margin: 0px 4px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<div>Home<span class='right'>×</span>
</div>
<div>Home Sweet Home<span class='right'>×</span>
</div>
<div>Hi<span class='right'>×</span>
</div>
Fiddle Demo
I wanted a simplified version of what was proposed here (without the hole effect and borders) but with the pointing side of it with rounded corner as well. So I came up with this solution. Visually this is what you get:
The HTML for it:
<div class="price-tag">Marketing</div>
<div class="price-tag">Sales</div>
<div class="price-tag">Inbound</div>
And the CSS for it:
.price-tag {
background: #058;
border-radius: 5px;
color: #fff;
cursor: pointer;
display: inline-block;
font-size: 0.875rem;
height: 30px;
line-height: 30px;
margin-right: 1rem;
padding: 0 0.666rem;
position: relative;
text-align: center;
}
.price-tag:after {
background: inherit;
border-radius: 4px;
display: block;
content: "";
height: 22px;
position: absolute;
right: -8px;
top: 4px;
-ms-transform: rotate(45deg); /* IE 9 */
-webkit-transform: rotate(45deg); /* Chrome, Safari, Opera */
transform: rotate(45deg);
width: 22px;
z-index: -1;
}
.price-tag:hover {
background: #07b;
}
original example
Modified: http://jsbin.com/ruxusobe/1/
Basically, it needs to float left, use border-right (instead of left) and modify the padding.
CSS:
.guideList{
font-size: 12px;
line-height: 12px;
font-weight: bold;
list-style-type: none;
margin-top: 10px;
width: 125px;
}
.guideList li{
padding: 5px 5px 5px 0px;
}
.guideList .active{
background-color: #0390d1;
color: white;
}
.guideList .activePointer{
margin-top: -5px;
margin-bottom: -5px;
float: left;
display: inline-block;
width: 0px;
height: 0px;
border-top: 11px solid white;
border-right: 11px solid transparent;
border-bottom: 11px solid white;
}
HTML:
<ul class="guideList">
<li><a>Consulting</a></li>
<li class="active"><span class="activePointer"></span>Law</li>
<li><a>Finance</a></li>
<li><a>Technology</a></li>
</ul>
Here is a simple example...
Orignal Version
Edited Version
CSS:
div {
margin-left: 15px;
background: #76a7dc;
border: 1px solid #CAD5E0;
padding: 4px;
width:50px;
position: relative;
}
div:after {
content:'';
display: block;
position: absolute;
top: 2px;
left: -1.3em;
width: 0;
height: 0;
border-color: transparent #76a7dc transparent transparent;
border-style: solid;
border-width: 10px;
}
Notice on border-color, only right is set with a color and everything else is set to transparent.
using pseudo element and a little bit playing with border you can achieve the exact thing. Check the DEMO.
HTML code is :
<a class="arrow" href="#">Continue Reading</a>
CSS Code is:
body{padding:15px;}
.arrow {
background: #8ec63f;
color: #fff;
display: inline-block;
height: 30px;
line-height: 30px;
padding: 0 12px;
position: relative;
border-radius: 4px;
border: 1px solid #8ec63f;
}
.arrow:before {
content: "";
height: 0;
position: absolute;
width: 0;
}
.arrow:before {
border-bottom: 15px solid transparent;
border-right: 15px solid #8ec63f;
border-top: 15px solid transparent;
left: -15px;
}
.arrow:hover {
background: #f7941d;
color: #fff;
border-radius: 4px;
border: 1px solid #f7941d;
}
.arrow:hover:before {
border-bottom: 15px solid transparent;
border-top: 15px solid transparent;;
border-right: 15px solid #f7941d;
}