This question already has answers here:
remove the thin line in header images in bootstrap
(2 answers)
Closed 5 years ago.
I have this image with a rounded shape, but how do I get rid of the square square edges/border?
HTML
<div id="picture">
<input type='file' id="input">
<img [src]="url" id="Image">
<label for="uploadinput" id="uploadlabel">Upload Picture</label>
CSS
#Image {
background-image: url('http://i.stack.imgur.com/Dj7eP.jpg');
border-radius: 200px;
width: 200px;
height: 200px;
background-size: 240px;
display: block;
margin: 0 auto;
outline: none;
border:none;
border-radius: none; }
The thin border that appears when there is no src is because chrome is showing that in fact no image exists in the space that you defined. (Thanks to #Patrick Mlr for pointing it out.)
#Image {
background-image: url('http://i.stack.imgur.com/Dj7eP.jpg');
border-radius: 200px;
background-size: 240px;
display: block;
margin: 0 auto;
width:0px;
height:0px;
padding: 100px;
outline: none;
border-style: none;
border-radius: none; }
<div id="picture">
<input type='file' id="input">
<img [src]="url" id="Image">
<label for="uploadinput" id="uploadlabel">Upload Picture</label>
By modifying the color you can change the border width
{ border-width: 1px; border-color: rgb(160,160,255); }
Try removing the border on #picture:
#picture{
border:none;
}
Try this:
#Image {
background-image: url('http://i.stack.imgur.com/Dj7eP.jpg');
border-radius: 200px;
width: 200px;
height: 200px;
background-size: 240px;
display: block;
margin: 0 auto;
outline: none;
border:0;
border-radius: none;
}
Related
This question already has answers here:
border curved css - circle with curved end
(2 answers)
Closed 2 years ago.
I want to have a tabs like image below, but I don't have any idea to make it.
Make the tab into a png image. Here is one I did really quick. I have a border on the top and no border on the bottom so it will overlay the existing border making appear as it curves up
Then combine it with some styling to get your result
*:focus {
outline: none;
}
.content {
box-sizing: border-box;
background-color: #F7F7F7;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border: 1px solid #d5d1d1;
}
.tabs {
margin-bottom: -1px;
background-color: white;
border: 1px solid #F4C949;
border-radius: 20px;
margin: -1px;
padding: 0px 20px;
padding-top: 8px;
text-align: right;
}
.tab {
position: relative;
z-index: 2;
display: inline-block;
width: 175px;
height: 30px;
margin-bottom: -6px;
padding-top: 8px;
text-align: center;
}
.tab:focus {
background: url(https://i.stack.imgur.com/45ecy.png);
background-size: contain;
background-position: top;
background-repeat: no-repeat;
}
.tab-content {
height: 175px;
}
<div class="content">
<div class="tabs">
<div class="tab tab-active" tabindex="0">
Tab 1
</div>
<div class="tab" tabindex="0">
Tab 2
</div>
</div>
<div class="tab-content">
Click tab to get the effect
</div>
</div>
This question already has answers here:
Can I use a :before or :after pseudo-element on an input field?
(22 answers)
Closed 4 years ago.
I am trying to add a close button on each of input element by using psudo class after. but not working. same works with button element.
here i my code :
.textBox {
padding: 15px ;
text-decoration: none;
display: inline-block;
position: relative;
}
.textBox:after {
content: "";
width: 15px;
height: 15px;
background: #ff0 url("http://www.gentleface.com/i/free_toolbar_icons_16x16_black.png") no-repeat -30px -75px;
border:1px solid red;
display: inline-block;
border:1px solid red;
}
<input type="text" class="textBox" value="mytext" name="" id="">
<button class="textBox">Click me</button>
Use wrap div and set there textBox class instead of in input
.textBox {
padding: 15px ;
text-decoration: none;
display: inline-block;
position: relative;
}
.textBox:after {
content: "";
width: 15px;
height: 15px;
background: #ff0 url("http://www.gentleface.com/i/free_toolbar_icons_16x16_black.png") no-repeat -30px -75px;
border:1px solid red;
display: inline-block;
border:1px solid red;
}
<div class="textBox">
<input type="text" value="mytext" name="" id="">
</div>
<button class="textBox">Click me</button>
This question already has answers here:
How do I disable the resizable property of a textarea?
(20 answers)
Closed 4 years ago.
I am creating a simple text editor - the text input is a textarea element. I want to remove the two lines used to change the box size (in fact, if possible, I'd like to fix the box size so it can't be changed).
This is what I'm talking about:
EDIT: Here's the code:
// HTML
<textarea id="canvas" placeholder="Write something..."></textarea>
// CSS
#canvas {
border: 1px dashed #999;
background: transparent;
width: 500px;
height: 400px;
margin: 0 auto;
padding: 5px;
font-size: 20px;
}
You can try CSS properties resize and appearance:
#textbox {
border: 1px dashed #999;
background: transparent;
width: 500px;
height: 400px;
margin: 0 auto;
padding: 5px;
font-size: 20px;
resize:none;
-webkit-appearance: textfield;
-moz-appearance: textfield;
appearance: textfield;
}
<textarea id="textbox" placeholder="Write something..."></textarea>
Add the property resize:none to the textarea.
Here is the working code:
#canvas {
border: 1px dashed #999;
background: transparent;
width: 500px;
height: 400px;
margin: 0 auto;
padding: 5px;
font-size: 20px;
resize:none;
}
<textarea id="canvas" placeholder="Write something..."></textarea>
Hope this helps!
HTML
<div class="select">
<div>
<label for="kitty" class="kitty-label kitty-label-1 l-center">
</label>
<input type="checkbox" name="cats" value="1">
<label>Kitty One</label>
</div>
<div class="cly-pam" style="width:50%; float: left">
<label for="kitty" class="kitty-label kitty-label-2 l-center">
</label>
<input type="checkbox" name="cats" value="2">
<label>Kitty Two</label>
</div>
</div>
<div>
css
label{
cursor: pointer;
}
.kitty-label{
position: relative;
width: 100%;
&:hover,
&:focus,
&:active{
border-radius: 6px solid #fff;
}
}
.kitty-label-1{
display: inline-block;
background: url(../img/kitty1.png) no-repeat 0 0;
height: 142px;
width: 142px;
}
.kitty-label-2{
display: inline-block;
background: url(../img/kitty2.png) no-repeat 0 0;
height: 144px;
width: 144px;
}
.select input[type="checkbox"]{
display: none;
&:checked + label:before{
background: url(../img/tick.png) no-repeat;
}
}
The labels would have background image but the issue is that when focus, active or hover, the border-radius does not appear behind the images. Also the kitty images do not have border-radius edges. Wonder if should have image in circle shape or css3 can do that?
Also checkbox seems not to show the tick or anything. Tried to click on label (as in kitty image), tick doesn't appear?
Not sure where I might go wrong. Help will be very much appreciated.
Updated
<div>
<input type="radio" name="type" value="designer" id="designer">
<label for="designer" id="designer" class="inline-block testsign" style="background: url(../img/face.png) no-repeat center;">
</label></div>
CSS
.testsign{
width: 170px;
height: 170px;
border-radius: 100%;
&:hover,
&:focus,
&:active{
border: 15px solid #f3f3f3;
}
}
// [type="radio"]:not(:checked),
// [type="radio"]:checked {
// visibility: hidden;
input[type="radio"]:checked + label:after {
content:"";
display: block;
position: absolute;
height: 60px;
width: 60px;
background: #f0f1f1 url(../img/tick.png) no-repeat center center;
border-radius: 100%;
border: 10px solid #fff;
}
Attempted the example from #misterMan
Couldn't get the label:after to be positioned at the right bottom - tried top and left to position the tick circle, but the problem is that when checked, it will appear in the position which followed top and left. So if check extra element or image, tick circle will appear in the same place which is not right. Removed the top and left. There is no way to have tick circle positioned in right bottom appearing in each label whenever radio is checked?
Also another problem is that when border radius on the label is hovered on background image, and if checked radio, the tick circle (label:after) will appear, the tick circle will be "jumpy" whenever hovered on label. How to stop the jump? I tried to add absolute center and position relative but the labels will be out of the container.
Help or insight will be appreciated.
I love this type of stuff so I made this for you, if you are still looking for a solution. I have added the images with <img> as they are not decoration, they are primary content :)
It's nice and simple, and I think does what you want. Let me know!
Updated
Have an updated fiddle!
HTML
<form>
<input type="checkbox" id="pic1" />
<label for="pic1">
<img src="http://www.placehold.it/200" />
</label>
<input type="checkbox" id="pic2" />
<label for="pic2">
<img src="http://www.placehold.it/200" />
</label>
</form>
CSS
body {
margin: 0;
}
input[type=checkbox] {
display: none;
}
label {
position: relative;
display: block;
width: 200px;
cursor: pointer;
float: left;
margin: 10px 0 10px 10px;
}
input[type=checkbox] + label img:hover {
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
border-radius: 100px;
}
input[type=checkbox]:checked + label img {
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
}
input[type=checkbox]:checked + label img:hover {
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
border-radius: 100px;
}
input[type=checkbox]:checked + label:after {
content:"";
display: block;
position: absolute;
bottom: 10px;
right: 10px;
height: 50px;
width: 50px;
background: url(http://i.imgur.com/i7379jf.png) no-repeat right bottom;
background-size: 50px;
}
input[type=checkbox]:checked + label:hover:after {
}
I have an HTML input field like this. I would like to place an image inside the textbox on the right side. Can someone help me out with its CSS for that?
<input type="text" id="name"/>
In the picture is an image which is inside the text field email address, which is what I want. How do you do this?
HTML
<div class="fake-input">
<input type="text" />
<img src="http://www.zermatt-fun.ch/images/mastercard.jpg" width=25 />
</div>
CSS
.fake-input { position: relative; width:240px; }
.fake-input input { border:none; background-color:#fff; display:block; width: 100%; box-sizing: border-box }
.fake-input img { position: absolute; top: 2px; right: 5px }
Working demo
http://jsfiddle.net/HnJZa/
try this:
input {
background-image: url("icon.png");
background-position: right top;
background-repeat: no-repeat;
background-size: contain;
}
you can try something like this
.textBox{
background-image:url(iconimage.jpg);
background-position:right;
background-repeat:no-repeat;
padding-left:17px;
}
Then apply this style to your text box:
<input type="text" class="textBox" />
Use background-image and background-position property
DEMO
CSS:
input {
height: 70px;
width: 200px;
background-image:url("http://cloud.ohloh.net/attachments/25869/plone-icon-64_med.png");
background-repeat:no-repeat;
background-position: 133px 3px;
}
.text3 {
width: 300px;
height: 30px;
}
#text3 {
background-image: url(https://cdn3.iconfinder.com/data/icons/interface-8/128/InterfaceExpendet-09-128.png);
background-size: 30px;
background-repeat: no-repeat;
}
input {
text-align: center;
}
<p class="email">
Email
</p>
<input type="text" placeholder="Email_ID" class="text3" id="text3">
The answers above didn't replicate the format shown in the questioners image, or provide any explanation. This is a solution using background images.
Explanation of the background image syntax.
background: url('https://d1ululg65bfe3q.cloudfront.net/images/troy/email-icon.png') no-repeat 97.25% 10px white;
Location of image: url('https://d1ululg65bfe3q.cloudfront.net/images/troy/email-icon.png')
Show image once: no-repeat
Distance from left: 97.25%
Distance from top: 10px
Background color: white
.bg-email-icon {
background: url('https://d1ululg65bfe3q.cloudfront.net/images/troy/email-icon.png') no-repeat 97.25% 10px white;
padding-left: 5px;
padding-right: 50px;
width: 255px;
height: 30px;
border: 1px gray solid;
border-radius: 5px 5px 0px 0px;
}
.bg-lock-icon {
background: url('https://d1ululg65bfe3q.cloudfront.net/images/troy/lock-icon.png') no-repeat 96.75% 10px white;
padding-left: 5px;
padding-right: 50px;
width: 255px;
height: 30px;
border: 1px gray solid;
border-top-width: 0px;
border-radius: 0px 0px 5px 5px;
}
<input name="exampleEmail" class="bg-email-icon" placeholder="Email" type="email">
<input name="examplePassword" class="bg-lock-icon" placeholder="Password" type="password">
You can add class to your input
<input type="text" id="name" class="inputImage" />
and then background image to class in css
.inputImage
{
background:#FFFFFF url('img.jpg') no-repeat top right;
}
You need to add class like this:
CSS:
.bgInput {
background: url(path of your image.jpg) top right no-repeat;
}
HTML:
<input type="text" class="bgInput" id="name"/>
A small answer: you can do this by setting as a background image of input field.
try:
#name {
background: url('path/image.png') right no-repeat;
}