Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pure css close button

JSFiddle

Is there any way to make something like the X on that link with pure css?

enter image description here

like image 227
qwertymk Avatar asked Apr 04 '12 21:04

qwertymk


People also ask

How do I add a close button in CSS?

The task is to make the close button using Pure CSS. There are two approaches that are discussed below. Approach 1: Create a <div> inside another <div> which has alphabet 'X' in it which helps in displaying the close button. When the “click” event occurs on 'X', then perform the operation.

How do you close CSS?

Close Button CSS 2: Plus You can also create a close button using the plus( + ) symbol. You will need to rotate the plus sign so that it looks like a cancel button.

How do I create a close button in HTML?

A close button is a <button> element with the class . close-button . We use the multiplication symbol ( &times; ) as the X icon. This icon is wrapped in a <span> with the attribute aria-hidden="true" , so screen readers don't read the X icon.

How Add Close button to div?

In the function, we select the close button with document. getElementById('close') . And we set the onclick property to a function that removes the the parent of the close button, which is the div. We get the parent of the close button with this.


1 Answers

I spent more time on this than I should have, and haven't tested in IE for obvious reasons. That being said, it's pretty much identical.

http://jsfiddle.net/adzFe/14/

a.boxclose{     float:right;     margin-top:-30px;     margin-right:-30px;     cursor:pointer;     color: #fff;     border: 1px solid #AEAEAE;     border-radius: 30px;     background: #605F61;     font-size: 31px;     font-weight: bold;     display: inline-block;     line-height: 0px;     padding: 11px 3px;        }  .boxclose:before {     content: "×"; } 
like image 127
Mike Robinson Avatar answered Sep 18 '22 04:09

Mike Robinson