guys. I style little form with submit button.
It looks like:
As you can see there is some white background around submit image and I don't have idea why! Image is cut fine and I always cut image with transparent background.
my HTML:
<form action="#">
<textarea rows="4" cols="50"> </textarea>
<input type="submit" class="join-us" value="PŘIDEJ SE K NÁM">
</form>
CSS:
.join-us{
background-image: url("images/join_us.png");
background-repeat: no-repeat;
width:181px;
height: 114px;
line-height: 114px;
color: #f7f7f7;
vertical-align: top;
margin-top: 10px;
margin-left: 10px;
cursor:pointer;
white-space: nowarp;
}
Live website can be find on http://funedit.com/andurit/new
Can you help me to remove that white backgroun from there?
It's not a white background, it's the input element's border. Just remove it using CSS by adding the following rule to the .join-us class:
border: none;
It seems that you also need to adjust the height of the button to 106px, so your final class definition will look like this:
.join-us{
background-image: url("images/join_us.png");
background-repeat: no-repeat;
width:181px;
height: 106px;
line-height: 106px;
color: #f7f7f7;
vertical-align: top;
margin-top: 10px;
margin-left: 10px;
cursor:pointer;
white-space: nowrap;
border: none;
}
Setting
border: none;
is an important part to remove the standard <button>-style. However, in your case it is not quite enough: You also have to set
height: 106px;
Since your image is only that high.
It's not a Background of input.
You can easily remove this white border, by setting the CSS property border:none;,
And the bottom white background is due to your Image. It's because your image have some transparent area at the bottom.
If you want to remove it, you can try to set height: 106px; into CSS class .join-us.
After doing this your Input look like this : -
As buttons have there default border style, you need to overwrite that:
border:none;
so ur css should be:
.join-us{
background-image: url("images/join_us.png");
background-repeat: no-repeat;
width:181px;
height: 114px;
line-height: 114px;
color: #f7f7f7;
vertical-align: top;
margin-top: 10px;
margin-left: 10px;
cursor:pointer;
white-space: nowarp;
.join-us{
background-image: url("images/join_us.png");
background-repeat: no-repeat;
width:181px;
height: 114px;
line-height: 114px;
color: #f7f7f7;
vertical-align: top;
margin-top: 10px;
margin-left: 10px;
cursor:pointer;
white-space: nowarp;
}
Just add the following CSS to your .join-us class
border:none;
.join-us {
height:106px;
border:none;
}
Add both of these styles to your .join-us class.
border: none;
background-size: 100% 108%;
The border style will remove the small while line around your image. The background-size style will stretch out the image to fit perfectly into your class background with no white space.
You need to remove border: 2px outset buttonface; from your stylesheet.
Your background image height and input height are not equals. So as you see under image you have a void space that shows background-color.
So yaou have to set background-color equals transparent or change input height.
Use this:
background-color: rgba(0, 0, 0, 0);
background-image: url("images/join_us.png");
background-repeat: no-repeat;
border: 0 none;
color: #F7F7F7;
cursor: pointer;
height: 114px;
line-height: 114px;
margin-left: 10px;
margin-top: 10px;
vertical-align: top;
width: 181px;
Related
In blue there are my div.
I would like with CSS make sure that the space between the div and the image there is and the button over the black top bar but I do not know how to do, any ideas?
My CSS
.login_reg{
float: right;
color: #e0e0ba;
width: 200px;
height: 200px;
}
.login_reg button{
color: #FFF;
font-weight: bold;
background-color: Transparent;
background-repeat:no-repeat;
border: none;
cursor:pointer;
overflow: hidden;
outline:none;
}
You can use a margin-top to set how tall the border is and space it out
you can use clear:both to avoid float:right impact for next div
Use margin-top in div having class .login_reg`
.login_reg{
float: right;
color: #e0e0ba;
width: 200px;
height: 200px;
margine-top: 50px;
}
I add a simple decorative svg in my div:
.advantages {
color: #B3B3B3;
padding-top: 6px;
padding-bottom: 21px;
background: url(../svg/curvy-bg.svg) center bottom repeat-x, #FBFBFB;
background-size: 32%;
}
The problem is that the svg shows separate white space between the repeat-x...
Check the problem here
If you resize the screen in the jsfiddle you can see how the curvy background changes it's white space.
I don´t want the white spaces.
What´s the problem?
Edit background in your code
.advantages {
color: #B3B3B3;
padding-top: 6px;
padding-bottom: 21px;
background: #f5f5f5 url(http://imgh.us/curvy-bg2.svg) repeat-x center bottom;
background-size: 32%;
}
https://jsfiddle.net/q3geyevk/5/
Currently i have a lot of back buttons on my page:
<input type="button" id="Back" value="Back" onclick="back();" class="backButton">
I need to add icon to it to look something like this:
First how do I add icon above text and aligne them centrally.
And second is it possible to do it using only CSS. ( if not with only a minor modifications to HTML )
Thx in advance.
I need to add icon to it to look something like this:
First how do I add icon above text and align them centrally.
You should use button element for that. It exists for this very purpose (custom styling and markup). However, you need not to use a background-image for that. To be able to control everything via CSS, just make sure you have same markup for all the buttons you have and then control using classes.
For example:
Markup:
<button class="cancel">
<i></i>
<span>Cancel</span>
</button>
CSS:
button.cancel i::after {
content: '\00d7'; display: block;
font-size: 26px; font-style: normal; font-weight: 600; color: red;
}
Use the after psuedo-element on i (or span whatever) and depending on the class use the content property to insert your icon as text (glyph) which you can style as you want.
And second is it possible to do it using only CSS. ( if not with only
a minor modifications to HTML )
This is very much possible, but cumbersome. I would not recommend this method, it is not worth the effort. You have been warned.
To use the existing input as-is without any change in the markup, you need to style the input itself and will have to use a background-image (in fact two background images). The input styling has a problem, that it loses its platform style as soon as you tinker with its style. So, you will lose the button like behaviour and Windows like button gradient and effects. You will have to replicate all that functionality via CSS.
For example:
Markup:
<input type="button" value="Cancel" data-value="Cancel" />
CSS:
input[type=button] {
min-width: 72px; height: 64px; position: relative;
display: inline-block; vertical-align: top; padding-top: 36px;
background-image: url('https://upload.wikimedia.org/wikipedia/commons/1/1e/Emoji_u274c.svg'),
linear-gradient(#f5f5f5, #dfdfdf);
background-repeat: no-repeat, no-repeat;
background-position: center 4px, center center;
background-size: 24px, auto;
border: 1px solid #aaa; border-radius: 3px;
}
input[type=button]:active {
background-image: url('https://upload.wikimedia.org/wikipedia/commons/1/1e/Emoji_u274c.svg'),
linear-gradient(#dfdfdf, #f5f5f5);
background-repeat: no-repeat, no-repeat;
background-position: center 4px, center center;
background-size: 24px, auto;
outline: 0px;
}
input[type=button]:focus { outline: 0px; }
The above code uses first background-image to show the icon, and second background-image to show the gradient (like Windows platform style). It uses padding-top to push the text down and :active state to set the behaviour of inverting the gradient when clicked. :focus state to remove the outline.
All this to mimic the behaviour of a button! It is much better to use button itself.
Here is a combined demo of both the techniques:
Fiddle: http://jsfiddle.net/abhitalks/yw7wmvwh/1/
Snippet:
button {
min-width: 72px; height: auto;
display: inline-block; vertical-align: top;
}
button.ok i::after {
content: '\2713'; display: block;
font-size: 23px; font-style: normal; font-weight: 600; color: green;
}
button.cancel i::after {
content: '\00d7'; display: block;
font-size: 26px; font-style: normal; font-weight: 600; color: red;
}
input[type=button] {
min-width: 72px; height: 64px; position: relative;
display: inline-block; vertical-align: top; padding-top: 36px;
background-image: url('https://upload.wikimedia.org/wikipedia/commons/1/1e/Emoji_u274c.svg'),
linear-gradient(#f5f5f5, #dfdfdf);
background-repeat: no-repeat, no-repeat;
background-position: center 4px, center center;
background-size: 24px, auto;
border: 1px solid #aaa; border-radius: 3px;
}
input[type=button]:active {
background-image: url('https://upload.wikimedia.org/wikipedia/commons/1/1e/Emoji_u274c.svg'),
linear-gradient(#dfdfdf, #f5f5f5);
background-repeat: no-repeat, no-repeat;
background-position: center 4px, center center;
background-size: 24px, auto;
outline: 0px;
}
input[type=button]:focus { outline: 0px; }
<button class="ok">
<i></i>
<span>Ok</span>
</button>
<button class="cancel">
<i></i>
<span>Cancel</span>
</button>
<hr/>
<input type="button" value="Cancel" data-value="Cancel" />
just add your class to css file
.backButton{
background: url(https://cdn3.iconfinder.com/data/icons/musthave/24/Delete.png) no-repeat;
background-position:center top;
height: 40px;
width: auto;
text-align: center;
padding:24px 10px 10px 10px;
border: 1px solid #555555;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
<input type="button" id="Back" value="Back" onclick="back();" class="backButton">
I hope this will help
HTML
button {
font-size: 20px;
width: 100px;
height: 100px;
}
#rock {
padding:10px;
background: url(https://upload.wikimedia.org/wikipedia/commons/6/65/Crystal_button_cancel.svg) top center ;
background-repeat: no-repeat;
background-position: 50% 10%;
}
<button id="rock" onClick="choose(1)">Cancle</button>
HTML
<button id="btnCancel" onClick="choose(1)">Cancel</button>
CSS
button {
font-size: 20px;
width: 100px;
height: 100px;
}
#btnCancel {
padding:10px;
background: url(https://upload.wikimedia.org/wikipedia/commons/d/da/Crystal_button_cancel.png) top center ;
background-repeat: no-repeat;
background-position: 50% 10%;
border-radius : 20px;
}
I have an input that is positioned inside of a div. When I set the div background color it also changes the input background color. The input has a background image, so I can't simply set the background color for the input.
Thus, I need a way to change the background color of the input that is inside of the div while keeping the background image of the div.
CSS:
#searchDiv{
background:#606060;
position:relative;
}
#topSearch{
font: 40px Segoe UI Light;
width:94%;
height:60px;
text-indent: 62px;
background:white;
background: url('search_icon.png');
background-repeat: no-repeat;
background-position: left;
background-size: 60px;
margin: 10px 3% 10px 3%;
}
HTML:
<div id="searchDiv">
<input type="search" id="topSearch"></input>
</div>
Change the input's style like this:
#topSearch {
font: 40px Segoe UI Light;;
width:94%;
height:60px;
text-indent: 62px;
background-color:white;
background-image: url('search_icon.png');
background-repeat: no-repeat;
background-position: left;
background-size: 60px;
margin: 10px 3% 10px 3%;
}
add an !important to your input background color
#topSearch{
font: 40px Segoe UI Light;;
width:94%;
height:60px;
text-indent: 62px;
background:white !important;
background: url('search_icon.png');
background-repeat: no-repeat;
background-position: left;
background-size: 60px;
margin: 10px 3% 10px 3%;
}
try background: #fff url('search_icon.png') no-repeat center left;
or if you declare multiple backgrounds as shown in your code, comma separate them
In your css for #TopSearch you have the 'background' attribute twice. It will always read the last one. So even thought you are setting it to white you are overwriting it with the very next line for the image.
Change
background: white;
to
background-color: white;
And change
background: url('search_icon.png');
to
background-image: url('search_icon.png');
Can someone one please give me a hand with the CSS for displaying an image as the background of a TD and fitting some text correctly over it.
It seems that for double digits works fine but with a single I am getting some clipping.
CSS:
.bkgImg {
background: url('/Images/circle.png') no-repeat;
background-size:32px 32px;
padding: 6px 8px 6px 8px;
color: white;
}
HTML:
<table>
<tr>
<td class="bkgImg">50</td>
</tr>
</table>
SEE LINK
Fiddle: http://jsfiddle.net/7kM3R/
I've updated your fiddle:
http://jsfiddle.net/7kM3R/7/
Here's full css for your class:
.bkgImg {
background-image: url("http://www.charlespetzold.com/blog/2012/12/BezierCircleFigure3.png");
background-repeat: no-repeat;
background-position: center center;
background-size:32px 32px;
color: white;
width: 32px;
height: 32px;
text-align: center;
vertical-align: middle;
}
Firstly I removed padding.
Then set fixed size for table cell (width&height):
width: 32px;
height: 32px;
and added background position (center)
background-position: center center;
width: 15px;
text-align: center;
Adding these lines to ur css will give you an ans
check the impact in your fiddle which I have updated
Your background image is cutted by the width of your td element. Give your td a fixed width and it will work. Have a look at this fiddle
You can use min-width for <td> like this link.
you only need to set fixed block bkgImg sizes width:32px; height:32px; or change the padding: 6px 11px;
.bkgImg {
width: 32px;
height: 32px;
background: url("http://www.charlespetzold.com/blog/2012/12/BezierCircleFigure3.png") no-repeat;
background-size:32px 32px;
/*padding: 6px 8px 6px 8px;*/
color: white;
text-align:center;
}
DEMO
You need to specifiy width and height
You should avoid use background-image for circle but border-radius
.value {
width: 30px;
height: 30px;
border-radius: 30px;
background-color: orange;
color: white;
}
avoid also to use table for non tabular data
Just change background-size:32px 32px to background-size:100% 100%;
DEMO
You need to set width and height of your element. For example add:
bkgImg {
width:450px;
height:450px;
}
Example:
http://jsfiddle.net/pndz/WFQLC/
Add following css
.value {
width: 30px;
height: 30px;
}