I just get stucked on a quite simple thing:
I'm using <i class="glyphicon glyphicon-remove-sign"></i> which I want to add to the upper right corner of an image:
<div class="relative">
<i class="glyphicon glyphicon-remove-sign"></i>
<img src="anything.jpg">
</div>
But the X is transparent. So if I change the background-color to white, the square space around the icon also gets white - which shouldn't.
I just want to get a black Icon with an white X - and if possible a white border around the circle.
So I also tried to use glyphicon glyphicon-remove-circle and set the color to white. But if I set the background color to black, I'm getting the same problem
Finally I did it, I hope I've got it right.
container{
position: relative;
}
i{
left: 240px;
top: 0;
color: white;
background: black;
border-radius: 50%;
padding: 5px;
border: 2px solid white;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<div class="container">
<img src="http://wallpaper.sc/en/ipad/wp-content/uploads/2014/10/ipad-2048x2048-thumbnail_00286-256x256.jpg" alt="">
<i class="glyphicon glyphicon-remove" style="position:absolute"></i>
</div>
Use a border radius with the same size as the font size.
.glyphicon-remove-sign {
background: white;
border-radius: 12px;
font-size: 12px;
padding: 5px;
}
Related
This question already has answers here:
Create a glossy light effect using CSS
(6 answers)
Closed last month.
I am trying to make a gradient like glow in a corner of a div like in a photo above ( color is not important )
I've tried:
<div style={{ background: `linear-gradient(#f79800,#03A678)` }}>
<Icon/>
</div>
.icon-wrapper {
background: linear-gradient(#f79800, #03A678);
display: inline-block;
padding: 8px;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" integrity="sha512-MV7K8+y+gLIBoVD59lQIYicR65iaqukzvf/nwasF0nqhPay5w/9lJmVM2hMDcnK1OnMGCdVK+iQrJ7lzPJQd1w==" crossorigin="anonymous" referrerpolicy="no-referrer"
/>
<div class="icon-wrapper">
<i class="fa-solid fa-umbrella"></i>
</div>
Looks like you are trying to get a "glassy look" (to give you a keyword to search for).
edit , the right keyword is glossy (excuse my average english) - a duplicate that seems fine to your needs : Create a glossy light effect using CSS
You may then see if adding a translucide radial-gradient on top of the linear-gradient does the job.
possible example to tune:
.icon-wrapper {
background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.25) 40%, transparent 45%), linear-gradient(#f79800, #03A678);
display: inline-block;
padding: 8px;
border-radius:0.3em;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" integrity="sha512-MV7K8+y+gLIBoVD59lQIYicR65iaqukzvf/nwasF0nqhPay5w/9lJmVM2hMDcnK1OnMGCdVK+iQrJ7lzPJQd1w==" crossorigin="anonymous" referrerpolicy="no-referrer"
/>
<div class="icon-wrapper">
<i class="fa-solid fa-umbrella"></i>
</div>
Here is an example of how you might adjust the code to create a "glow" effect in the top right corner of the div:
Please try this :
<div style={{
background: `linear-gradient(135deg, #f79800, #03A678, #f79800)`,
background: `-webkit-linear-gradient(135deg, #f79800, #03A678, #f79800)`,
background: `-o-linear-gradient(135deg, #f79800, #03A678, #f79800)`,
background: `-moz-linear-gradient(135deg, #f79800, #03A678, #f79800)`
}}>
<Icon/>
</div>
I think :after pseudo could help you to have a transparent cover over your background so you can achieve your aims like that,
here you can find an example of what you aims to get.
i wish it helps
div {
height:150px;
width:150px;
background:radial-gradient(coral,lightpink);
border:3px solid lightgray;
border-radius:15px;
margin:auto;
text-align:center;
align-content:center;
display:flex;
align-items:center;
justify-content:center;
font-size:8rem;
font-weight:bold;
font-family:cursive;
}
div:after {
content:"";
height:140px;
width:140px;
position:absolute;
background:linear-gradient(45deg, white,lightgray);
opacity:0.1;
border-radius:15px;
margin:5px;
}
span {
color: lightgray;
text-shadow: 0 0 3px gray;
}
<div><span>©</span></div>
I am working on various contact form 7 controls.
The one that I am having issues with so far is making a radio button bigger, changing the background color and adding a huge gap between the label and the button.
I have looked on the suggested popups here including the subject Make radio button bigger but none seems to make any difference.
Here is a screenshot that contains two images, top image is the out I am getting from my version.
The image below is my preferred version.
Here is what I have tried so far.
I made an ID code of customized-radio in the ID attribute of the radio button control I am using.
On my form, I added the id attribute:
[radio rehireable id:customized-radio label_first "Yes"]
Then custom CSS:
#cuustomized-radio {
background-color:#f1f1f1 !important;
gap: 3.3em; /* space between label and button */
appearance: none;
background-color: #fff;
margin: 0;
font: inherit;
color: currentColor;
width: 1.15em;
height: 1.15em;
border: 0.15em solid currentColor;
border-radius: 50%;
}
Any ideas what I could do differently to make this work?
I hope this simple CSS code will work for you
#cuustomized-radio {
background-color:#f1f1f1 !important;
background-color: #fff;
font: inherit;
color: currentColor;
width: 1.15em;
height: 1.15em;
border: 0.15em solid currentColor;
float:right;
margin:5px;
}
.divdiv {
width:50%;
margin-top:10px;
padding:10px;
background-color:#f1f1f1;
border:1px dashed #000;
border-radius: 5px;
font-size:18px;
}
body {
padding:5%;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap#3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<body>
<h4>SUBJECT TO REHIRE? <span style="color:red;">*</span></h4>
<div class="divdiv">
<label> Yes </label>
<input id="cuustomized-radio" type="radio" name="test">
</div>
<div class="divdiv">
<label> No </label>
<input id="cuustomized-radio" type="radio" name="test">
</div>
</body>
I am trying to make a website in local using React.
It is my codes, I surrounded those two elements with a div tag and applied border css looking like related elements, but when I applied a Link tag to go to another page to the div elements, the border started not surrounding under the element. In shortly, how can I use the css file that before apply Link tag?
Here is my code.
div{
border: 1px black solid;
width: 250px;
height: 300px;
}
.p {
text-align: center;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
<Link to='/tests/'>
<div>
<i class='fas fa-check fa-5x'></i>
<p>take tests</p>
</div>
<Link>
You have to add a class to the div and fix your CSS.
.tests{
border: 1px black solid;
width: 250px;
height: 300px;
}
.p {
text-align: center;
}
The jsx
<Link to='/tests/' style={{ textDecoration: 'none' }}>
<div className="tests">
<i class='fas fa-check fa-5x'></i>
<p>take tests</p>
</div>
<Link>
I have a requirement to create an icon as shown below.
I have tried as shown below.
.html
<ion-content padding>
<div style="background:lightblue;width: 50px;height: 50px;border-radius: 50%;">
<ion-icon name="heart"></ion-icon>
</div>
</ion-content>
Plunker is here
Q1: Is this the correct approach to create this kind of icon appearance?
Q2: How can I make it same as above image?
Q3: After that, I need to use that icon any place on any component.If I use margins to center the heart icon, hope it'll not work on any place no? In other words, I need to use it as a single unit.
Hope you'll give a feedback for this.
.heart-icon {
background: lightblue;
width: 50px;
height: 50px;
border-radius: 50%;
line-height: 50px;
text-align: center;
color: #FFF;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<div class="heart-icon">
<i class="fa fa-heart" aria-hidden="true"></i>
</div>
Hope it is what you want to achieve. You can use ionic icon instead of font awesome.
scss
.heart-icon {
background: lightblue;
border-radius: 50%;
color: #FFF;
}
and for HTML
<ion-icon class="heart-icon" name="heart" item-start></ion-icon>
I was wondering is it possible to give each tooltip a different background color in materialize.css framework?
When the tooltip is activated I don't see any additional markup generated in the inspector, therefore can not target with CSS.
Tooltip color can be changed using css. You have to override default css as follow. Assign your color code to background-color in backdrop class.
<style>
.backdrop{
background-color: purple;
}
</style>
Following is sample working code snippet for 4 buttons which show tooltip.
<!DOCTYPE html>
<html>
<head>
<title>Tooltip</title>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!--CSS for tooltip-->
<style>
.backdrop{
background-color: purple;
}
</style>
</head>
<body class="row">
<div class="col s12" >
<div class="col s12"> <h4> Click following</h4> </div>
<!-- data-position can be : bottom, top, left, or right -->
<!-- data-delay controls delay before tooltip shows (in milliseconds)-->
<a class="btn tooltipped col s2" data-position="bottom" data-delay="50" data-tooltip="I am tooltip"> Bottom</a>
<p class="col s1"></p><!--for making space-->
<a class="btn tooltipped col s2" data-position="top" data-delay="150" data-tooltip="I am tooltip"> Top</a>
<p class="col s1"></p><!--for making space-->
<a class="btn tooltipped col s2" data-position="left" data-delay="250" data-tooltip="I am tooltip"> Left</a>
<p class="col s1"></p><!--for making space-->
<a class="btn tooltipped col s2" data-position="right" data-delay="550" data-tooltip="I am tooltip"> Right</a>
</div>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
</body>
</html>
Tooltips appear like this in materialize:
I guess if you figure out the ID of the tooltip you want to change the background of you can do something like this: #TOOLTIP-ID.backdrop {background-color: red;}
You can customise a tooltip with the following css (Materialize 1.0.0)
.material-tooltip {
padding: 10px 8px;
font-size: 1rem;
z-index: 2000;
background-color: transparent;
border-radius: 2px;
color: #fff;
min-height: 36px;
line-height: 120%;
opacity: 0;
position: absolute;
text-align: center;
max-width: calc(100% - 4px);
overflow: hidden;
left: 0;
top: 0;
pointer-events: none;
visibility: hidden;
background-color: #323232;
font-family: "Roboto Mono";
font-size: 0.8em;
font-weight: 700;
}
To specify diffrent color for each tooltip you can do it like this:
while initializing tooltips add this function:
$('.tooltipped').tooltip({delay: 50}).each(function () {
var background = $(this).data('background-color');
if (background) {
$("#" + $(this).data('tooltip-id')).find(".backdrop").addClass(background);
}
});
and then on your tooltip specify it like this:
<a href="#!" class="tooltipped"
data-position="bottom"
data-delay="50"
data-tooltip="I'm a tooltip"
data-background-color="red lighten-3">
as you can see I'm changing the class attribute so you can use materialize-css colors
I solved it like this
$('.tooltipped').tooltip({delay: 50});
.material-tooltip .backdrop{
background-color: #DB0000;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.99.0/js/materialize.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.99.0/css/materialize.min.css" rel="stylesheet"/>
<div class="tooltipped" data-position="bottom" data-delay="50" data-tooltip="I am tooltip" >
Test Tooltip
</div>
For current version of materialize.css (1.0.0) you should style .material-tooltip and .tooltip-content
like this (sass):
.material-tooltip
background-color: white
border-color: gray
border-style: solid
border-width: 1px
.tooltip-content
padding: 3px
font-size: .8rem
background-color: transparent
color: #000
max-width: 250px
Updated Answer for 1.0
To style the tooltip's background etc:
.material-toolip {
background:#000;
}
To style the actual text within the tooltip use the following:
.material-tooltip .tooltip-content
{
font-size:12px;
}