如何在标题

时间:2017-06-01 11:02:23

标签: html

我已经在我的标题中添加了2个图像,所有看起来都很好,但我希望每个图像都有不同的链接,当我尝试将href添加到第二个图像时,两个图像都继承此链接。我错过了什么我是html的新手..谢谢

<div class="main-header-container container-fluid">
<div class="container">

<!--<nav class="navbar navbar-default" id="mainmenu" role="navigation">-->
<nav class="navbar navbar-default" id="mainmenu">

	<div class="nav-container">
    
    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
	
        <a class="navbar-brandf" href="<?php echo site_url().'/link1.html'; ?>">
        <img src="<?php echo get_template_directory_uri(); ?>/images/logo.svg" alt="Logo1" class="img-responsive" />
    	</a></div>

	<a class="navbar-brandf" href="<?php echo site_url().'/link2.html'; ?>">
        <div class="navbar-world">
            <img src="/images/tag.png" alt="Logo2" style="width:90px; height:80px" class="img-responsive" />
        </div>
    </a>

2 个答案:

答案 0 :(得分:0)

如果您尝试使用两个不同的href s /链接添加两个不同的图像:

<a href="**link1**"><img src"**path_to_image_1**" /></a>
<a href="**link2**"><img src"**path_to_image_2**" /></a>

答案 1 :(得分:0)

您的代码有PHP错误和一些缺少的标记。请尝试以下代码段以满足您的要求,根据您的目标链接(href =“ ”)对“href”值进行必要的更改

<div class="navbar-header">

    <a class="navbar-brandf" href="<?php echo site_url().'/link1.html'; ?>">
        <img src="<?php echo get_template_directory_uri().'/images/logo.svg'; ?>" alt="Logo" class="img-responsive" />
    </a>

    <a class="navbar-brandf" href="<?php echo site_url().'/link2.html'; ?>">
        <div class="navbar-world">
            <img src="QS-tag.png" alt="Logo" style="width:90px; height:80px" class="img-responsive" />
        </div>
    </a>

</div><!--navbar-header-->