简体   繁体   English

可应用检查器样式表中对CSS所做的更改,但那些相同的更改将不适用于我的CSS文件

[英]Changes to CSS in inspector stylesheet apply but those same changes will not apply in my CSS file

Bit of a strange occurrence with my web page, currently trying to resize the font of a facebook like button I have on my website. 我的网页有点奇怪,目前正在尝试调整我网站上的按钮之类的Facebook字体的大小。

Currently the HTML I'm targeting is: 目前,我定位的HTML是:

<span id="u_0_3">2.1k people like this. Be the first of your friends.</span>

In the google chrome console adding either of the following will change the font 在谷歌浏览器控制台中,添加以下任意一项将更改字体

1. 1。

#u_0_3 { font-size: 14px }

2. 2。

span#u_0_3 { font-size: 14px }

but adding either of these lines of code to my web pages stylesheet has absolutely no effect. 但是将这两行代码添加到我的网页样式表中绝对没有效果。 No clue how to proceed from here as it works in one stylesheet and not the other? 不知道如何从这里开始,因为它只能在一个样式表中工作,而不能在另一个样式表中工作?

The reason the styles aren't updating when adding the code to your stylesheet as opposed to in the browser is because you're trying to a stylesheet on an iframe, which isn't possible. 将代码添加到样式表中而不是在浏览器中时,样式未更新的原因是因为您尝试在iframe上创建样式表,而这是不可能的。 You can however add the styles using jQuery or something along those lines. 但是,您可以使用jQuery或类似方式添加样式。

Try this... 尝试这个...

$("iframe#idhere").contents().find("span#u_0_3").css('font-size', '14px');

Ensure that you have added CSS file reference in your HTML. 确保已在HTML中添加CSS文件引用。

Also, clear browser cache and load the page. 另外,清除浏览器缓存并加载页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM