Asp.Net Elements Doesn't Get Style Properties From Css File
<link href="Style/Style.css" type="text/css" rel="Stylesheet" />
code.
And there are<div>
and <table>
elements.
The开发者_运维技巧 table has an id and its properties in the css file are working normal. But I can't say the same thing about <div>
and <a>
tags.
Let's take this example:
<div align="center" id="bla">
And I use id in css file in different ways. I first used #bla { }
or div#bla
or div #bla { }
, then I used .bla { }
or div.bla { }
or div .bla { }
with making class="bla"
instead of id="bla"
in Aspx page, they all did not work.
<style type="text/css"><style/>
tags, it worked normal.
The same behaviour happens in <a>
too. But it does not in <table>
.
Is there a different usage? What do I miss?
More info at http://jsfiddle.net/npTc6/
It could be a pathing issue to your CSS file. If you have multiple CSS files, it could also be the order of your CSS files. You should verify that you have the correct path to your CSS file and that you have the correct file name referenced in your code. Often, the most simple mistakes are the most frustrating.
UPDATE: Your CSS has a space between the "a" anchor and the class name, and I believe you need a leading slash on your image references (if not there already).
Example:
a .Russia
{
display: block;
background-image: url("/Images/Default/Russia.png");
width: 173px;
height: 173px;
}
try...
a.Russia
{
display: block;
background-image: url("/Images/Default/Russia.png");
width: 173px;
height: 173px;
}
It was a problem common in Asp.Net. Just about background properties. Standart CSS background-image code had some issues so there are variations. I tried many, then fixed it by using this one:
background: url(/Images/Default/Turkiye.png);
精彩评论