php - Wordpress - 主菜单导航的图像 href 不起作用

标签 php html css wordpress

我有一个 图像链接到 li 元素 来自 wordpress 中的导航栏

一切正常,但是当我将鼠标悬停在图像上时,它还会在列表中显示悬停的菜单元素。

How can i hide that when it is linked to the image?

这是 php 代码(来自 nav-menu-template.php):

if( $args->theme_location == 'primary' )
    return "<li id='menu-item-1000' class='menu-item menu-item-type-post_type menu-item-object-page menu-item-1000'><a class='logo' href='http://razvanwork.esy.es/exelo'><img style='position:absolute;top:-20px;left:-125px;z-index:200;max-width: 402%; ' src='http://razvanwork.esy.es/exelo/wp-content/uploads/2014/02/LogoPrelucrat.png' alt='Exelo' ></a></li>".$items;

我附上一张图片来展示它在做什么: enter image description here

提前致谢

最佳答案

我自己搞定了,很简单。我在 href 上放了一些文本,所以它会根据导航栏菜单自行排列。之后,我将 position relative 设置为 a href,并将其向左浮动,这样我就可以将图像放在绝对位置的顶部。

这是代码:

$args->theme_location == 'primary' )
    return "<li id='custom-menu-item' class='logo-menu-item'><a style='position:relative;left:-68px' class='logo' href='http://razvanwork.esy.es/exelo'>a<img style='position:absolute;top:-22px;left:-81px;z-index:200;max-width: 402%;' src='http://razvanwork.esy.es/exelo/wp-content/uploads/2014/02/LogoPrelucrat.png' alt='Exelo' ></a></li>".$items;

关于php - Wordpress - 主菜单导航的图像 href 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21797623/

相关文章:

css 星号选择器支持

php - Angularjs $http get 方法不发送任何参数

php - PCF - 不允许应用程序在 MySQL 中创建表

html - JQuery 登录错误消息仅有效一次

javascript - HTML5、CSS3 和/或 JS 中旋转 CD 上的音频播放器

javascript - 制表符时 CSS 周围有一些空间

php - 自定义验证 REDCap Hook

Php angularJS 项目未在简单的 html 表格中显示数据

javascript - 在使用 Node.js 和 Express 提供的网页中找不到图像

jquery - 按用户输入的日期排序 div - jquery