html - 整个标题行充当链接,而不仅仅是文本所在的位置

标签 html css header

抱歉,如果我在这里做错了什么,我对编码和这个网站有点陌生。

总之,就这样吧

我想在我的网站顶部居中“ Logo ”的左侧和右侧植入广告。但是,标题 Logo 充当文本大小整行的链接,这使得无法实现/无法点击广告。

这是标题行

  <div class="container">
     <a href="/index.html" style="text-decoration: none"><div style="font-family: Conv_5STAR_League; font-size:20px"><h1
 align="center"><span style="color:gold">LoL</span><span
 style="color:white">Chromas</span></h1></div></a>
     <div style="text-align: center"><img src="./Aatrox Chromas_files/SYozsnx.png" alt="Aatrox"; style= "width= 150"></div>
     <h1 class="strokeme" style="text-align: center; font-family: Conv_5STAR_League;color: white">Aatrox</h1>

我真的很感激我能得到的任何帮助,即使这是一个“菜鸟”问题,如前所述,我对此仍然很陌生,无法在谷歌上找到解决方案

谢谢大家,致以最诚挚的问候

最佳答案

div - 一个占据 100% 宽度的 block 元素,可点击链接也是如此

为什么要使用额外的标记——你可以轻松做到

http://jsfiddle.net/v0b3um4p/

h1{
    text-align: center;
    font-family: Conv_5STAR_League; 
    font-size:20px
}   
<div class="container">
     <h1><a href="/index.html" class="" style="text-decoration: none"><span style="color:gold">LoL</span><span
 style="color:white">Chromas</span></a>
    </h1>
     <div style="text-align: center"><img src="./Aatrox Chromas_files/SYozsnx.png" alt="Aatrox"; style= "width= 150"></div>
     <h1 class="strokeme" style="text-align: center; font-family: Conv_5STAR_League;color: white">Aatrox</h1>

关于html - 整个标题行充当链接,而不仅仅是文本所在的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30152044/

相关文章:

html - 带有 Bootstrap 的 map 和固定侧边栏

php - while循环导致网站消失

css 修改选择箭头 - Font Awesome 不会加载

javascript - 可视化越界liferay portlet

android - 我们可以在 Parallax Header ViewPager 中使用 Permanent ToolBar 吗?

html - 将文本换行到 div 内的新行

html - 将垂直线添加到底部 css

PHP 如果存在多个变量

css - 为什么我的注销链接超出了屏幕边缘?

html - 将我的标题图片固定在特定的静态页面上