href 相关问题

超链接(或链接)是对读者可以直接遵循或自动遵循的文档的引用。

如何超链接图像

我想要超链接图像,但如何向图像添加 href 标签? 当报告显示时,您... 我想超链接图像,但如何向图像添加 href 标签? <div class="laptop"> <img class='report' src="http://testtest/Report1.png"/> 当报告显示时,您可以单击它并转到该站点。 h1{ font-family: Arial Rounded MT Bold; font-size: 33px; color: #0F4194; float: left; margin: 50px 0px 15px 700px; } .laptop{ width:1024px; height:661px; float: center; margin-right: -150px; background: url('http://mlamannadev.com/Images/Laptop2.png'); background-repeat: no-repeat; background-position: top left; background-size: contain; width: 1024px; z-index:4; } .report{ position:absolute; animation:round 16s infinite; opacity:0; z-index:-1; margin-left: auto; margin-right: auto; display: block; } @keyframes round{ 25%{opacity:1;} 40%{opacity:0;} } img:nth-child(4){animation-delay:0s;} img:nth-child(3){animation-delay:4s;} img:nth-child(2){animation-delay:8s;} img:nth-child(1){animation-delay:12s;} <!DOCTYPE html> <html> <head> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <h1><center>Service Driven, Customer-Centric Solutions, <br> Empowered by Innovation.</center></h1> <div class="laptop"> <img class='report' src="http://mlamannadev.com/Images/Report1.png"/> <img class='report' src="http://mlamannadev.com/Images/Report2.png"/> <img class='report' src="http://mlamannadev.com/Images/Report3.png"/> <img class='report' src="http://mlamannadev.com/Images/Report2.png"/> </div> </body> </html> 将 <img> 标签放入 <a> 标签内并提供 href。 <a href="/link/to/site"> <img src="" /> </a> 正如其他人在评论中提到的,您希望将图像包围在锚点 <a> 标签中,并将 href 属性应用于锚点标签,就像普通的超链接一样。 这是直接来自 Carlton 提到的 W3 学校链接的代码。 <p> An image as a link: <a href="https://www.w3schools.com"> <img border="0" alt="W3Schools" src="logo_w3s.gif" width="100" height="100"> </a> </p> 要超链接图像,您可以使用带有 href 属性的 HTML a 标签,并将其包裹在图像的 img 标签周围。这是一个例子: <a href="https://www.example.com"><img src="image.jpg" alt="Description of the image"></a> 有两种方法可以实现这一目标! 方法1:使用锚标记 用锚标签 <img> 元素包裹 <a> 标签。 在开始的 <a> 标签中,添加 href 属性,后跟要链接到的 URL(用引号引起来)。 这是修改后的代码: <div class="laptop"> <a href="your_desired_link"> <img class='report' src="http://testtest/Report1.png"/> </a> </div> 方法2:使用CSS(用于背景图像) 如果您要链接的图像使用 CSS 设置为背景图像,您可以在锚标记中使用 background-image 属性。 以下是修改 CSS 的方法: .laptop { /* Existing styles */ background-image: url('http://mlamannadev.com/Images/Laptop2.png'); cursor: pointer; /* Add cursor pointer for hover effect */ } .laptop a { /* Wrap the styles within an anchor tag */ position: absolute; top: 0; left: 0; width: 100%; /* Set width and height to cover the entire element */ height: 100%; opacity: 0; /* Make the element invisible initially */ } .laptop:hover a { /* Change opacity on hover to show link functionality */ opacity: 0.7; /* Adjust opacity as desired */ } 补充说明: 请记住将“your_desired_link”替换为您要链接到的实际 URL。 您可以向 title 标签添加 <a> 属性,以提供将鼠标悬停在图像上时显示的描述性文本。 我希望这有帮助!

回答 4 投票 0

在用户首选搜索引擎中搜索的URL

我经常在描述中放置搜索链接。今天最新的是一篇关于图形编程的文章,我想说的是, 如果这有效,你应该看不到

回答 1 投票 0

将带 href 的超链接添加到命名格式 I18n vuejs

我查看了此页面上的 vue 文档,了解如何解决此问题:https://kazupon.github.io/vue-i18n/guide/formatting.html#named-formatting 我认为我的所有语法都是正确的并且......

回答 2 投票 0

使用WGET获取页面链接

抱歉,第一次使用这里。 我在用着 wget --spider --force-html -r -l5 http://example.com 2>&1 | grep '^--' | grep '^--' | awk '{print $3}' > urls.txt 它效果很好,但似乎没有复制...

回答 1 投票 0

从所有<a>标签获取href值,包括嵌套的<a>标签

我已经搜索了几个小时(不应该有任何重复)并尝试了许多不同的方法,使用RegEx(正则表达式)和DOMdocument,但没有成功。 非标准 HTML 代码:...

回答 3 投票 0

如何将 PHP 变量回显到样式表的 href 属性中测试网站

我有这三个文件: 索引.php 测试网站 我有这三个文件: index.php <?php include('variables.php') ?> <!DOCTYPE html> <html lang="en"> <head> <title>TestWebsite</title> <link rel="stylesheet" href="<?php echo($folder . 'css/styles.css')?>"> </head> 变量.php <?php $folder = "C:/xampp/htdocs/Website/"; css/styles.css /* Insert styling stuff here */ index.php和variables.php存储在根目录下。由于某种原因,样式表拒绝链接,我需要帮助找出原因。不过这工作得很好: <link rel="stylesheet" href="styles.css"> 尝试将 <?php echo($folder . 'css/styles.css')?> 放入单独的 php 文件中,看看我是否正确附加了目录。 尝试将 styles.css 从其父文件夹移动到主目录中 试过 <link rel="stylesheet" href="<?php echo $folder ?>css/styles.css"> 在index.php中有使用$folder的include()并且工作得很好。 我开始怀疑这是否是范围问题 您没有为本地文件路径指定协议。在这种情况下,它是协议路径file://。

回答 1 投票 0

如何通过reactjs/nextjs中的Link href传递查询?

我试图通过我的链接href传递查询参数,但查询似乎没有通过。单击此处的编辑按钮后,我所通过的查询无处可寻...

回答 1 投票 0

从无头浏览器页面中的第一个表获取href链接(playwright._impl._errors.Error:事件循环已关闭!Playwright是否已停止?)

我试图从无头浏览器页面的第一个表中获取 href 链接,但该错误对我没有帮助,因为它没有告诉我它是什么,只是下面有很多 ^ 符号。 我不得不换...

回答 1 投票 0

从无头浏览器页面中的第一个表获取href链接

我试图从无头浏览器页面的第一个表中获取 href 链接,但该错误对我没有帮助,因为它没有告诉我它是什么,只是下面有很多 ^ 符号。 我不得不切换到

回答 1 投票 0

为什么 Facebook Business 登录 Instagram 在连接到 Instagram 时卡住了?

我正在尝试为 Instagram 实现 facebook 业务登录。下面是我构建的 url 和调用该 URL 的 href 标记。但是,流程在连接到 Instagram 时卡住并出现错误 辉...

回答 2 投票 0

如何在 Discord 网站上创建共享按钮?

我的意思是,就像一个 URL,用户可以单击该 URL 打开 Discord 应用程序或网站并预先编写一条 Discord 消息,准备发送。 我需要类似于 mailto: 的链接,我可以在其中设置消息...

回答 2 投票 0

添加 href 和 id 属性会导致框架错误

获取图像列表后,我想将它们显示在网格上;它在修补框架后工作,但它不断吐出以下错误: TypeError: win[(("HTML" + (intermediate value...

回答 1 投票 0

是否有一个 URL 参数可以使 URL 在专门命名的浏览器窗口中打开

我有一份电子邮件摘要,每天发送给我网站的用户,其中包含指向网站上内容的链接,以便他们可以轻松地进入并开始通过电子邮件进行交互。问题是,如果...

回答 4 投票 0

如何从带有id的链接打开模态框?

我有一个链接,当用户单击它时,将显示一个包含以下内容的模式: 我有一个链接,当用户单击它时,将显示一个包含以下内容的模式: <?php include ('dbcontroller.php'); if(isset($_GET['view_id'])) { $id=$_GET['view_id']; $sql = mysqli_query($conn, "SELECT * from press where id='$id'"); $row = mysqli_fetch_array($sql); ?> <input type="hidden" value="<?php echo $row['id']; ?>" /> <?php echo $row['reason']; ?> <a href="index.php" class="btn btn-primary">GO BACK</a> <?php } $conn->close(); ?> 上面的代码是我所做的,这样当用户单击链接时,它会将他重定向到该页面。但我希望它位于模式对话框中,因为它的内容不多。 这是用户点击的链接。我如何在模式对话框中打开此链接? <a href="viewReason.php?view_id=<?php echo $row['id'];?>">Click to view </a> 我在这个网站和其他地方看到过一些,但它们只有一个没有 ID 的链接来查看模式对话框。我没有找到与我相同的问题,所以我决定寻求帮助。 嘿,您可以使用以下代码来获取行值 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <!-- Trigger the modal with a button --> <br><br><br><br> <table id="prab" border="1"> <tr> <td>Jill</td> <td>Smith</td> <td>50</td> <td><button type="submit" class="btn btn-default" data-toggle="modal" data-target="#myModal" value="Jackson"><span class="glyphicon glyphicon-envelope"></span>Invite</button></td> </tr> <tr> <td>Eve</td> <td>Jackson</td> <td>50</td> <td><button type="submit" class="btn btn-default" data-toggle="modal" data-target="#myModal" value="smith" ><span class="glyphicon glyphicon-envelope"></span>Invite</button></td> </tr> </table> <!-- Modal --> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Modal Header</h4> </div> <div class="modal-body"> <p>clicked value </p> <input type="text" id="valueof" > </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> </div> <script type="text/javascript"> $('#prab').click(function(e){ // alert($(e.target).val()); document.getElementById("valueof").value = $(e.target).val(); }) </script> </body> </html>

回答 1 投票 0

链接到另一个网站上的 Anchor 不起作用(在 Chrome 中测试)

我面临的问题是,如果我在我的锚点所在的网站上,我的锚点似乎可以工作: 我面临的问题是,如果我在我的锚点所在的网站上,我的锚点似乎可以工作: <li role="presentation"> <a aria-controls="k" data-toggle="tab" href="#k" role="tab">K</a> </li> 但是,如果我尝试通过 href 从另一个网站跳转到该网站上的特定部分,则不会。选项卡窗格是在 Bootstrap 中内置的。 domain.com/beamer-lexikon/#k 使超链接导航到该页面,但不导航到“k”部分。 “k”部分标有 id“k”: <div class="tab-pane fade" id="k" role="tabpanel"></div> 我是不是搞错了什么? 您知道我可以从哪里开始寻找问题吗? JavaScript、CSS? 非常感谢和最诚挚的问候, 删除 Beamer 词典后面的“/”,并确保目标 ID 在您要跳转到的部分中声明。 除此之外,如果没有看到你的代码,就很难判断。 domain.com/beamer-lexikon#k 我发现Bootstrap框架不支持这种锚链接。解决方案是在文档就绪函数中锚点所在的页面上实现这段代码: if(window.location.hash != "") { $('a[href="' + window.location.hash + '"]').click(); } 最诚挚的问候, 史蒂芬

回答 2 投票 0

我在 <a tag in python

我正在尝试通过足球网站页面获取页面的链接。我已经把拿出来了 我正在尝试通过足球网站页面获取页面链接。我已经拉出了 <a tags,但为了得到 'href',,它出来时是空的。 自从经历了叠加以来,我尝试了不同的方法。 with open("premier_league/page_2.html", encoding= 'utf-8') as f: page = f.read() parsed_page = BeautifulSoup(html, "html.parser") links = parsed_page.find_all("a") 上面的代码生成了所有 "href" 不起作用。 我最初尝试过: links = [ l.get('href') for l in links] links = [l for l in links if l and "/all_comps/shooting" in l] 我收到错误: ResultSet 对象没有属性 'get'。 .get 函数是 str 属性。 我将获取函数更改为: links = [ l['href] for l in links] .throws in an error that the [ ] can't be used for a str The next was to try: for links in parsed_page("a", href = True): try: print (links['href']) except KeyError: pass this worked. The results: /en/squads/b8fd03ef/2022-2023/c602/Manchester-City-Stats-FA-Community-Shield /en/squads/b8fd03ef/2022-2023/matchlogs/all_comps/schedule/Manchester-City-Scores-and-Fixtures-All-Competitions /en/squads/b8fd03ef/2022-2023/matchlogs/all_comps/shooting/Manchester-City-Match-Logs-All-Competitions /en/squads/b8fd03ef/2022-2023/matchlogs/all_comps/keeper/Manchester-City-Match-Logs-All-Competitions /en/squads/b8fd03ef/2022-2023/matchlogs/all_comps/passing/Manchester-City-Match-Logs-All-Competitions /en/squads/b8fd03ef/2022-2023/matchlogs/all_comps/passing_types/Manchester-City-Match-Logs-All-Competitions /en/squads/b8fd03ef/2022-2023/matchlogs/all_comps/gca/Manchester-City-Match-Logs-All-Competitions /en/squads/b8fd03ef/2022-2023/matchlogs/all_comps/defense/Manchester-City-Match-Logs-All-Competitions /en/squads/b8fd03ef/2022-2023/matchlogs/all_comps/possession/Manchester-City-Match-Logs-All- 我需要更改上面的代码以列表理解,但由于某些原因它没有响应: href_list = [link['href'] for link in parsed_page("a", href=True) if 'href' in link] href_list [ ] - empty list 我不明白。为什么不起作用?? 我还尝试了另一种格式。因为我想要的链接看起来像 /en/squads/b8fd03ef/2022-2023/matchlogs/all_comps/shooting/Manchester-City-Match-Logs-All-Competitions 所以: or link in links: if "matchlogs/all_comps/shooting/" in link: link else: pass 还是空的。 到目前为止我做错了什么。我已经使用 .get 和 links['href'] 方法尝试获取 href 属性,但没有成功。 您非常接近,但您只需要缩小搜索范围。现在,您正在抓取每个链接的全部内容,最终得到几层 XML(我相信,自从我接触 BeautifulSoup 以来已经有 10 年了。 您只需进一步指定,您正在专门查找所有 href 元素内部的 a 属性。我发现另一个与你的问题非常相似的问题已经得到了更彻底的回答,但本质上是它的要点: 您可以通过以下方式使用 find_all 来查找每个具有 href 属性的 a 元素,并打印每个元素: # Python2 from BeautifulSoup import BeautifulSoup html = '''<a href="some_url">next</a> <span class="class"><a href="another_url">later</a></span>''' soup = BeautifulSoup(html) for a in soup.find_all('a', href=True): print "Found the URL:", a['href'] # The output would be: # Found the URL: some_url # Found the URL: another_url # Python3 from bs4 import BeautifulSoup html = '''<a href="https://some_url.com">next</a> <span class="class"> <a href="https://some_other_url.com">another_url</a></span>''' soup = BeautifulSoup(html) for a in soup.find_all('a', href=True): print("Found the URL:", a['href']) # The output would be: # Found the URL: https://some_url.com # Found the URL: https://some_other_url.com 我不确定你使用的是哪个版本的Python或BeautifulSoup,但你应该注意这一点,因为他们在新版本中改变了一些小东西,如果你没有意识到的话,这些小东西可以帮助你。 BeautifulSoup 获取 href [重复]

回答 1 投票 0

尝试创建 ol 网址

尝试将 href 与锚标记一起使用。然而,即使使用讲师的代码创建预览并尝试在预览中打开她的网站,我也会访问http://127.0.0.1:3002/。当您点击...

回答 1 投票 0

我们如何让一个单词指代乳胶中的某个部分或图片之类的东西?

我们如何让一个单词指代乳胶中的某个部分或图片之类的东西? 我知道如何引用某事物 ef{} 但当我们使用它时,我们会看到部分或表格或图片的编号...

回答 2 投票 0

为什么我的 href 目录在我的 Reactjs 项目中不起作用?

我试图在单击“立即加入”按钮时转到此文件,但它似乎不起作用。正如您在下图中的第 9 行看到的,我有一个“/auth/login”的 href,并且我...

回答 1 投票 0

没有重载与 Nextjs/Typescript 中的此调用相匹配

我遇到了这种类型错误。没有重载与此调用匹配。 重载 1 of 3, '(props: PolymorphicComponentProps<"web", FastOmit &...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.