[英]w3.css changes my custom styles
I am using the following html code with wordpress for creating tabs. 我将以下html代码与wordpress一起使用来创建标签。 I am also using a custom css which tries to modify some of the title formats.
我也在使用自定义的CSS,它试图修改某些标题格式。 When I remove the 4th line of the following code () my style works fine.
当我删除以下代码()的第四行时,我的样式正常。 But when I include this line my styles are changing, including the font type.
但是,当我包括这行内容时,我的样式就会发生变化,包括字体类型。 How can I resolve this?
我该如何解决?
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css"/>
<body>
<div class="w3-container" style="margin-top: -50px;">
<ul class="w3-navbar w3-black">
<li><a href="javascript:void(0)" class="tablink w3-blue" onclick="openCity(event, 'London');">London</a></li>
<li><a href="javascript:void(0)" class="tablink" onclick="openCity(event, 'Paris');">Paris</a></li>
<li><a href="javascript:void(0)" class="tablink" onclick="openCity(event, 'Tokyo');">Tokyo</a></li>
</ul>
<div id="London" class="w3-container w3-border city">
<h2>London</h2>
<p>London is the capital city of England.</p>
</div>
<div id="Paris" class="w3-container w3-border city" style="display:none">
<h2>Paris</h2>
<p>Paris is the capital of France.</p>
</div>
<div id="Tokyo" class="w3-container w3-border city" style="display:none">
<h2>Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>
</div>
</div>
<script>
function openCity(evt, cityName) {
var i, x, tablinks;
x = document.getElementsByClassName("city");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tablink");
for (i = 0; i < x.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" w3-red", "");
}
document.getElementById(cityName).style.display = "block";
evt.currentTarget.className += " w3-red";
}
</script>
</body>
</html>
I have also faced same problem and found solution 我也遇到了同样的问题并找到了解决方案
open up your w3.css file and remove styles applied globally. 打开w3.css文件并删除全局应用的样式。
like html{ //styles} 像html {// styles}
body{styles }. 正文{styles}。
just keep styles applied based on classes. 只需保持基于类的样式即可。 like .w3-green{ //styles}.
例如.w3-green {// styles}。 w3-input{ //styles}
w3-input {// styles}
In your case remove lines from 1 to 37 in w3.css file then it will work fine without changing your styles 在您的情况下,请删除w3.css文件中从1到37的行,然后在不更改样式的情况下可以正常工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.