为什么CSS样式只有在我的形式而不是在关联的CSS文件中的样式标签中才会产生影响? [英] Why do CSS styles only take affect when placed in a style tag in my form and not in the associated CSS file?

查看:266
本文介绍了为什么CSS样式只有在我的形式而不是在关联的CSS文件中的样式标签中才会产生影响?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

感谢[这个问题] [1]关于重新定位AJAX工具包的CalloutExtender控件,以解决我在网络表单上定位Validator CallOuts的问题。

Thanks to [this question][1] about repositioning the AJAX toolkit's CalloutExtender control, for an answer to my problem of positioning Validator CallOuts on a web form.

有人可以告诉我为什么在< style> 元素中将CSS类直接添加到我的网页有一个想要的效果,但是当把相同的类添加到链接的CSS文件时,它们没有效果?

Can someone tell me why adding the CSS classes directly to my web page within a <style> element has the desired effect but when adding the same classes to a linked CSS file, they have no effect?

所以,添加:

<style>

.CustomValidator {position:relative;margin-left:-80px;}

.CustomValidator div {border:solid 1px Black;background-color:LemonChiffon; position:relative;}

.CustomValidator td {border:solid 1px Black;background-color:LemonChiffon;}

.CustomValidator .ajax__validatorcallout_popup_table {display:none;border:none;background-color:transparent;padding:0px;}

.CustomValidator .ajax__validatorcallout_popup_table_row {vertical-align:top;height:100%;background-color:transparent;padding:0px;}

.CustomValidator .ajax__validatorcallout_callout_cell {width:20px;height:100%;text-        align:right;vertical-align:top;border:none;background-color:transparent;padding:0px;}

.CustomValidator .ajax__validatorcallout_callout_table {height:100%;border:none;background-color:transparent;padding:0px;}

.CustomValidator .ajax__validatorcallout_callout_table_row {background-color:transparent;padding:0px;}

.CustomValidator .ajax__validatorcallout_callout_arrow_cell {padding:8px 0px 0px 0px;text-align:right;vertical-align:top;font-size:1px;border:none;background-color:transparent;}

.CustomValidator .ajax__validatorcallout_callout_arrow_cell .ajax__validatorcallout_innerdiv {font-size:1px;position:relative;left:1px;border-bottom:none;border-right:none;border-left:none;width:15px;background-color:transparent;padding:0px;}

.CustomValidator .ajax__validatorcallout_callout_arrow_cell .ajax__validatorcallout_innerdiv div {height:1px;overflow:hidden;border-top:none;border-bottom:none;border-right:none;padding:0px;margin-left:auto;}

.CustomValidator .ajax__validatorcallout_error_message_cell {font-family:Verdana;font-size:10px;padding:5px;border-right:none;border-left:none;width:100%;}

.CustomValidator .ajax__validatorcallout_icon_cell {width:20px;padding:5px;border-right:none;}

.CustomValidator .ajax__validatorcallout_close_button_cell {vertical-align:top;padding:0px;text-align:right;border-left:none;}

.CustomValidator .ajax__validatorcallout_close_button_cell .ajax__validatorcallout_innerdiv {border:none;text-align:center;width:10px;padding:2px;cursor:pointer;}

</style>

直接到我的页面,但如果我将类粘贴到我的CSS文件)它们似乎被忽略,而其他样式表更改(对于其他页面元素)被反映。

directly to my page works but if I paste the classes into my CSS file (without the style tag naturally) they seem to be ignored while other stylesheet changes (for other page elements) are reflected.

我已经去了从CSS文件中删除所有其他样式仍然没有快乐。对顶部.CustomValidator样式中的margin-left的更改没有效果,而其他更改(如.CustomValidator div中的background-color)可以正常工作。

I've gone to the point of removing all other styles from the CSS file and still no joy. Changes to the "margin-left" in the top .CustomValidator style have no effect while other changes, like background-color in .CustomValidator div, work correctly.

是在一个表内,并添加margin-left = -80 t .CustomValidator表样式,在CSS文件中向左移动调用,但没有很远,运动是一样的,无论你做什么值。

The field is inside a table and adding the margin-left=-80 t the .CustomValidator table style, in the CSS file moves the call out to the left, but no very far and the movement is the same, no matter what you make the value.

推荐答案

请确保您的链接标记上有正确的语法,例如:

Make sure you have the syntax right on your Link Tag, like so:

<link rel="stylesheet" type="text/css" href="css/main.css" />

我输入错误一次,但是:

I made a typo once, and did:

<link rel="stylesheet" type="text/css" href="css\main.css" />

它会在一些浏览器上显示良好,但在其他浏览器上则不会显示。

and it would render fine on some browsers, but not at all on others.

这篇关于为什么CSS样式只有在我的形式而不是在关联的CSS文件中的样式标签中才会产生影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆