I applied a css for image button as follows
<style type="text/css">
.selected
{
padding-left:50px;
background: transparent url('Images/samplecopy.jpg') ;
background-repeat: repeat;
}
</style>
<asp:ImageButton ID="btnYes" CssClass="selected" runat="server" ImageUrl="~/Images/image.jpg" />
But i am not getting as per required. i would like to cover the whole image button with the background image that applied
I need to hover that black back ground exactly on the image can any one help me
Don't use the padding, that's what causing the problem.
Use the following code and see if it helps
<style type="text/css">
.selected
{
padding:0px;
background: transparent url('Images/samplecopy.jpg') ;
background-repeat: repeat;
}
</style>
UPDATE
clear: both;
padding: 5px;
border: 1px;
background: transparent url('Images/samplecopy.jpg') ;
background-repeat: repeat;
color: #FFF;
font-weight: bold;
font-size: 12px;
border-radius:3px;
Try these properties in CSS and tell me if it helps.
Related
So trying to add a custom #font-face font to my asp.net project. Got it working in chrome browser...
#font-face
{
font-family: "Century Gothic";
src: url('GOTHIC.TTF'),
}
body {
background-color: #fff;
border-top: solid 10px #000;
color: #333;
font-size: .85em;
font-family: "Century Gothic", Segoe UI, Verdana, Helvetica, Sans-Serif;
margin: 0;
padding: 0;
}
but need help with the others....(this is my attempt)...but not working:
#font-face
{
font-family: "Century Gothic";
src: url('../GOTHIC.eot');
src: url('../GOTHIC.eot?#iefix') format('embedded-opentype'),
url('../GOTHIC.woff') format('woff'),
url('../GOTHIC.ttf') format('truetype'),
url('../GOTHIC.svg#URWClassicoItalic') format('svg');
font-weight: normal;
font-style: normal;
}
Also not sure if I need the .eot, .woff etc extensions. I have only added
GOTHIC.TTF
GOTHICB.TTF
GOTHICBI.TTF
GOTHICI.TTF to my prjoect.
working from:
http://stackoverflow.com/questions/8115302/font-face-not-working-even-after-trying-everything-i-could-think-of?rq=1
http://stackoverflow.com/questions/6238737/font-face-with-embedded-font-does-not-work?rq=1
http://stackoverflow.com/questions/20659571/adding-a-custom-font-to-vs-2010-fontface
You need the eot, woff etc file extensions - IE678 doesn't support TTF format, only EOT
I think the problem is because of the use of a font across domains.
So the URL that starts “http://stackoverflow.com/questions/8115302/font-face-not-working-even-after-trying-everything-i-could-think-of?rq=1” is treated as being in a different domain than “http://www.stackoverflow.com/questions/8115302/font-face-not-working-even-after-trying-everything-i-could-think-of?rq=1” even if you see that the domain name refer to the same place of the system.
You need to switch to the relative url to get rid of the problem
You may also check Cross domain workaround for #font-face and Firefox which will help you.
First and foremost; I know that a lot of these CSS-type questions have been closed, so, hopefully I've been able to broaden the question to fit others aswell. Here goes:
I've been handed a project and am doing my best with adding the features my boss wants me to. But when I try to style a button differently from the rest, the changes don't "take".
The css file works as I am able to style other things:
<link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
Button:
<input type="submit" value="Print." class="fakeBtn" id="fakeBtn" />
CSS tries:
.fakeBtn
{
font-size: 0.8em;
border: 0px;
background-color: transparent;
color: #999;
cursor: hand;
}
input#fakeBtn
{
font-size: 0.8em;
border: 0px;
background-color: transparent;
color: #999;
cursor: hand;
}
As you can see I've tried using a class to change the style and also the id approach. None of which works though.
I've hardly done any mvc work and this, already existing, project is my first. Is it a logical error? What am I doing wrong?
EDIT:
Could any of these be overriding? These are all the css-snippets I could find with "input" in them. How does one know if something overrides something else?
input, textarea {
border: 1px solid #e2e2e2;
background: #fff;
color: #333;
font-size: 1.2em;
margin: 5px 0 6px 0;
padding: 5px;
width: 300px;
}
input:focus, textarea:focus {
border: 1px solid #7ac0da;
}
input[type="checkbox"] {
background: transparent;
border: inherit;
width: auto;
}
input[type="submit"],
input[type="button"],
button {
background-color: #d3dce0;
border: 1px solid #787878;
cursor: pointer;
font-size: 1.2em;
font-weight: 600;
padding: 7px;
margin-right: 8px;
width: auto;
}
td input[type="submit"],
td input[type="button"],
td button {
font-size: 1em;
padding: 4px;
margin-right: 4px;
}
input.input-validation-error {
border: 1px solid #e80c4d;
}
input[type="checkbox"].input-validation-error {
border: 0 none;
}
If this is pure html, then your code seems fine, and it is clear that either your css is simply not being loaded and read, or it is being overwritten at some later stage.
You could try applying important (like color: #999 ! important;), just to see if any of the changes become visible then. If so, you know that the CSS properties are being overwritten somewhere else.
On the other hand, I've seen Asp.Net and MVC caching cause some problems here. You might want to try deleting the site and publishing again from scratch, to see if there are any changes.
Update:
I believe this might be your problem:
input, textarea {
border: 1px solid #e2e2e2;
background: #fff;
color: #333;
font-size: 1.2em;
margin: 5px 0 6px 0;
padding: 5px;
width: 300px;
}
This specifies style for the type input, so if this comes after .fakeBtn { ...}, then that style will be applied instead (unless ofcourse, you have added ! important; to the end of some of the statements, in which case they will only be overridden by other statements which also contain ! important;).
Your best solution is probably to add specific classes to the section: input, textarea { ...}. That way, it will not override other input-fields in general.
CSS seems fine.
Try using Firebug to verify what styles are applied and what are overridden.
I suspect you have some other CSS rules that style the buttons and override your CSS.
I have a 1000px wide div, which contains a menu control. Inside this menu, I have 5 items (links). I want to use whole length of line, so in css file is wide of every item set to 200px.
.level1
{
border-width: 0px;
margin: 0px;
padding: 0px;
background-color: #99FF66;
font-family: Arial, Helvetica, sans-serif;
color: #FF0000;
height: 20px;
font-size: 12px;
line-height: 20px;
text-align: center;
width: 200px;
}
However, when page is loaded, I get two rows, because the last item doesn't fit.
See, that inserted black line is 200px wide (and the link "vzkazy" is longer). So the question is: Why is the MenuItem wider ? And how to set it's wide to 200px ? Thanks.
in your code at jsFiddle you applied your level1 class to ul and all anchor tags so i think you need not to applied same style to your ul tag you can do somethiong: ul.level1 li{ here your code }
I am having an issue with <hr> in IE8 (normal view) This is my CSS styling for that:
#ViewName hr
{
background-color: #CCCCCC;
border: none;
font-size: 14pt;
}
I can see the horizontal lines in IE8 (compatibility mode) but not in normal mode. What is going on here?
Border has to be 1px minimum for hr to work in IE8.
#ViewName hr
{
background-color: #CCCCCC;
border: 1px;
font-size: 14pt;
}
This is not the issue in IE9.
I am using a httphandler to dynamically resize images that are rendered on a page. I have a preset width that all images must confirm - and the height of the images can vary (proportions constrained to the original width and height). I am caching the images - however, when they are originally loaded, the httphandler is called after the page is rendered - so for longer images - sometimes on intial load, layout breaks with larger images as they overlap the content that is below it. Here is an example screenshot from here http://www.teakmonkeystudios.ca/photos/photo.aspx?id=10801:
Here is the css:
.gallery
{
margin-left:0px;
padding-left:5px;
}
ul.gallery div.top_frame
{
width:732px
}
ul.gallery div.view_frame
{
margin-left:5px;
}
ul.gallery div.image_frame
{
border: 1px solid #dddddd; padding-top: 5px; height:100%; min-height:490px;
padding-bottom: 5px; text-align: center;
}
ul.gallery div.button_frame
{
width: 732px; text-align: right; margin: 4px 0px 0px 0px;
}
ul.gallery div.name_frame, ul.gallery div.original_name_frame
{
margin: 0px 0px 0px 5px;
}
ul.gallery div.name_frame h2
{
margin: 2px 0px 3px 0px;
padding: 0px;
}
ul.gallery div.date_frame
{
margin-left:5px;
margin-bottom:5px;
}
ul.gallery div.update_frame
{
width: 732px; margin-bottom: 5px; margin-top: 5px;text-align:right;
}
ul.gallery div.desc_frame
{
margin-left:5px;
background-color:#eeeeee;
}
ul.gallery li
{
width: 732px;
display: -moz-inline-stack;
display: inline-block;
vertical-align:top;
margin: 5px;
zoom: 1;
*display: inline;
_height:100%;
color:#000000;
letter-spacing:0px;
line-height:normal;
}
ul.breadcrumbs li
{
float:left;
margin:0px;
padding:0px;
width:100%;
}
ul.breadcrumbs li a
{
font-size:12px;
}
Since the image in the screenshot below may be cached you may not see the broken layout. I wonder if rendering the images in a table would be better? Or is there a css fix? I've even tried Jquery and used document ready to adjust the height of the image containers - but the image may not be loaded - so I can't return the height of the image in the function. Any suggestions on how to solve this issue?
If your images are all going to be the same width, output the IMG tag with a width attribute. this may help.
<img src="..." width="720">
Using input type="image" for this type of application is a bit odd. Why not just use an A-tag wrapped around an image?
This is the key to your problem:
however, when they are originally loaded, the httphandler is called after the page is rendered
An IHttpHandler sees the request before the response is sent to the browser and can do whatever it needs, including responding with a resized image. I'm doing that a lot, never had a problem. Since it doesn't work for you, I'm 100% you've got a bug in your HttpHandler.
If i create the image and load it into the cache in the custom image's prerender event - it seems to have fixed this issue. Originally the control rendered the image info to the src string in the browser and the image was then intercepted by a httphandler that calls a cachemanager (if exists - return, if not - create). Since the problem above seemed to happen only when the image was initially created - I figured recreating it before it was 'requested' may help - and it appears it has. If there are consequences to this - I will edit my solution.