Use a new CSS file to override current website's CSS

前端 未结 12 868
梦如初夏
梦如初夏 2020-11-30 10:04

My website has currently 3 CSS files that are automatically included as a part of the website and I do not have access to the source i.e. index.html

12条回答
  •  北海茫月
    2020-11-30 10:19

    Unfortunately, I have to agree with phari.

    Quote:

    1) You cannot modify the HTML of the page at all, and therefore cannot include another CSS file. 2) You can modify the CSS files, but the developers may modify them again later and remove any changes you made. Hence you cannot permanently modify the CSS files. 3) You cannot/do not want to use Javascript and JQuery). If all of these things are true, there is no solution to your problem.

    Commented by phari on Mar 26 at 14:29

    Let me break it down. I will try my best to explain why there's no solution (correct me if I am wrong at any of these options);

    Option1: Using jQuery or Javascript.
    You cannot modify the HTML of the page at all!! You do not want to use jquery nor javascript. This means that all answers to your question mentioned on this page which involves jquery or javascript are disregarded. This does not mean the answers given on this page are wrong. In your case it's not possible.

    Option2: @import url(css4.css); Your website has 3 css files that are automatically included as a part of the website, but unfortunately, you DO NOT have access to ANY of these css files. You can not place this piece of code in css3.css, or any of these files. You can modify the CSS files, but the developers may modify them again later and remove any changes you made, which means @import url(css4.css); can also be removed. Also using @import url(css4.css); would be completely useless. You'll have to place @import url(css4.css); at the end of css3.css, but this won't work because @import rules must always be first in a document. If I am not mistaking ilia (who commented on Mar 23 at 9:42) meant the code can be place anywhere in the file. @import url(css4.css); must be at the top. The link ilia provided as "prove" also specify that it's a requirement to place it at the beginning.. Check the two links below. More Info visit http://webdesign.about.com/cs/css/qt/tipcssatimport.htm or https://developer.mozilla.org/en/docs/Web/CSS/@import#Specifications. Option 2 is disregarded too.

    I don't think there could be another way to do what you want to do. Hence, there is no solution to your problem.

提交回复
热议问题