我是新来的代码,我正在慢慢学习使用W3schools,但我仍然需要帮助,并不完全理解某些事情。

<html>
<body style="background-color:#D2563C;">
<a href="">
<img src="C:\Users\Burke\Desktop\hillbilly
 \Pictures\bert.png" alt="HTML tutorial"
 style="width:725px;height:90px;">
</a>
 <style>

a:link, a:visited #tabs{
    box-align: center;
    border-style: solid;
    border-color: white;
    border-width: 1px;
    background-color: #057A8C;
    color: white;
    padding: 10px 31px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    list-style-type:none
}


a:hover, a:active #tabs{
     background-color: white;
     color: #057A8C
}
</style>
</head>
<body>



<div class="center">
<a href="\Desktop\bob\cool.html"
 target="_blank">Home</a>
<a href="\Desktop\bob\Contact Us.html"
target="_blank">Contact Us</a>
<a href="Desktop\bob\Printing.html" target="_blank">Printing</a>
<a href="Desktop\bob\Technology.html"
target="_blank">Technology</a>
<a href="Desktop\bob\Printership.html"
target="_blank">Printership</a>
</div>

<script type="text/javascript"
src="https://platform.linkedin.com/badges/js/profile.js" async defer>
</script>


<div class="LI-profile-badge"  data-version="v1" data-size="medium" data-
locale="en_US" data-type="vertical" data-theme="dark" data-
vanity="sullivanstrong"><a class="LI-simple-link"
href='https://www.linkedin.com/in/sullivanstrong?trk=profile-
badge'>James T kirk</a></div>





</body>
</html>

那是我的密码
How do I get the blue border off of the title picture but keep it on the tabs? Also, How do i center the Title Picture and Tabs?
单击How do i,查看图像,

最佳答案

您正在将样式应用于元素本身-这意味着样式将始终应用。
有几种方法可以解决这个问题,但最好的方法是使用“类”。
类可以添加到任何元素。语法为:

<a href="/example" class="example-class test">Example Link</a>

“类”作为“属性”添加到元素中。类使用空格分隔。上面的示例将有两个单独的类。”“示例类”和“测试”。
然后可以使用类将样式直接应用于元素。类的前面有一个“.”(ID是用#
.example-class {
  /* styling here */
}

上面添加的任何样式都将仅应用于该类。之所以在横幅上也有蓝色边框,是因为您将样式直接应用于元素,所以所有“a”元素都将附加样式。
只是补充一下-你发布的代码有一些基本问题。我建议阅读一些HTML和CSS的基础知识,看看结构和格式。代码学院是一个很好的开始:
https://www.codecademy.com/ar/tracks/htmlcss
例子:
<a href="\Desktop\bob\jamespak.html" class="tab-class"
 target="_blank">Home</a>

.tab-class {
   /*styling*/
}

关于html - 如何避免CSS样式影响网站的其他部分?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48603294/

10-12 12:55
查看更多