We have created a dynamic JQUERY table with dynamic columns (Depending upon count value) and assigned it to DIV tag. However the thead and tbody is going outside DIV tag in IE7.
Looks like the width is automatically set dynamically by CSS, we are not able to override it.
Did anyone faced similar issues. Please help.
use important keyword like this.
width: 100px !important;
Added the following lines in DataTable.css file and it worked perfectly!!
table.display thead th div.DataTables_sort_wrapper
{
/*Fix for width issue*/
position: relative;
clear: both;
width:50px;
overflow:hidden;
word-wrap:break-word;
}
Related
I'm using Rotativa to generate some pdf's in a mvc application, now, I need to define an image as a watermark for the pdf, I was trying setting some custom css properties to the body tag, but in this case. I need to define the margin as 0, also I have a custom switch for a footer and with the margin 0 this is a problem.
I'm looking for a way t define a watermark, maybe using a custom switch.
Anyone knows if is possible?
Thanks,
Try this....
In your view put this HTML
<div class="watermark" style="background: url('../Images/watermark.png');"></div>
Also, add this style to your css file (or in a style section inside you view)
.watermark {
height: 100%;
width: 90%;
position: absolute;
top: 0;
bottom: 0;
z-index: 999;
opacity: 0.25;
}
I have an asp.net gridview and have just added sorting to the columns. This has now obviously changed the column headers to links and they have changed to a blue colour but for some reason my modifications to change the colour of the links isn't working and they just wont pick-up the correct style.
Here is some CSS that I tried, I have tried it a few other ways too but wanted to test it using the most basic setup:
a:link {
color:white;
}
a:visited {
color:white;
}
use !important with Sachin's answer
a{
color:white !important;
}
Try this
div #something .gridview td a{
Color: red! important;
}
Try to set style more specific to your anchor tag.
I have a DIV that I would like to modify the CSS for programmatically in VB.Net/C#.
I know that, for example, I could add style attributes simply by
divMyDiv.Style.add("color","#ff0000")
but I want to add a new CSS class, together with its attributes to the DIV. So in an ideal world I would like to write something like
divMyDiv.Style.add(".smallRedText", "{font-size:10px; color:#ff0000}")
Is this even possible ? Am I missing the bigger picture ?
All help gratefully received :-)
What about:
divMyDiv.Attributes.Add("class", "new-class")
I suggest that you define the variations in css ahead of time that you know you'll need. Then, you can manipulate the class attribute of whatever control you need to change on the fly.
For example, you could define:
.smallRedText { font-size: 10px; color: #ff0000 }
.smallBlueText { font-size: 10px; color: #0000ff }
Then when comes time to select dynamically:
divMyDiv.Attributes.Add("class", whateverClassWeNeed);
Can someone tell me how to set a:visited and a:hover programmatically? I am dynamically building up some hyperlinks server-side and want to know how to specify unique css behaviour for each link. Otherwise I would set them all in a stylesheet.
If you want to set the style for a single item, you can use the CssClass attribute, then set up the classes in your css.
.linkA:visited {
color: red;
}
.linkB:visited {
color: blue;
}
In your codebehind:
LinkOne.CssClass = "linkA";
LinkTwo.CssClass = "linkB";
not sure I understand - wouldnt this work?
Hyperlink1.CssClass = MyAnchorClass;
Unless things have changed, you can't specify the a:visited and a:hover within an HTML anchor (a) tag, so in the end you will need CSS somewhere (on the page, in a file) and assign the class to each anchor tag, like what willoller said.
Here's how you do it inside code:
imageButton.Attributes.Add("onmouseout",
"this.src='../../../App_Themes/White/Images/default.png';");
imageButton.Attributes.Add("onmouseover",
"this.src='../../../App_Themes/White/Images/default.hover.png';");
imageButton.ImageUrl = "~/App_Themes/White/Images/default.png";
I am trying to get the value of a "Background-image"-tag in a stylesheet which is used on my web-site. The style-sheets are referenced from the HTML file as follows:
<style media="all" type="text/css">
#import "master.css";
</style>
<style media="all" type="text/css">
#import "layout.css";
</style>
The layout.css file contains:
#frontpage-main-features {
background: url('../elms/frontpage-main-gradient.jpg') no-repeat left top;
margin-bottom: 10px;
}
#frontpage-main-features-inner {
width: 700px;
padding: 20px 20px 10px 20px;
background: url('../elms/frontpage-main-gradient-bottom.jpg') no-repeat left bottom;
}
In the master.css file a background image is referenced which is then overloaded in the layout.css file by the #frontpage-main-features-inner section. I would very much like to access the "background"-tag in order to see which background image is currently being shown in a specific part of the page. Any suggestions?
Best,
Michael
Why not just use FireBug / the IE8 dev console? load the page, open the console, find the piece of html you are looking for and inspect the css properties, it will give you all applied styles for that element, overridden properties will be striked through...
You're talking about looking at the markup of the page from C#, i.e. this is the markup that is not an ASP.Net server control and is not viewable by ASP.Net.
Sorry, that's not possible using ASP.Net. You can only view data that is marked for server to view.
Why do you need this? There could be another way to do whatever you are trying to do. Maybe you need to turn the problem around (get markup to get the class name from c#) which is easier.
The problem is that CSS rules are not applied or enforced on the server, they are applied by the client browser. You could perhaps create a parser that goes through the referenced CSS files and figures out what image should be displayed but you really can't know with certainty how the client browser will interpret and apply the CSS rules.