简体   繁体   English

检查元素后出现奇怪的HTML问题

[英]Weird HTML issue after inspecting the element

I am having a weird issue with my HTML. 我的HTML出现了一个奇怪的问题。 It is almost like it is being escaped for some reason. 几乎就像是出于某种原因而逃脱了。 The problem is on my tag, it is being rendered as: 问题出在我的标签上,它被呈现为:

<h3&nbsp;class="custom-image-text">Student Stories
                </h3&nbsp;class="custom-image-text">

I was trying out bracket editor (usually use sublime) but I don't think the editor was the problem. 我正在尝试使用括号编辑器(通常使用sublime),但我认为编辑器不是问题所在。 Also tried it on JSFiddle and get the same result (when you inspect the element). 还可以在JSFiddle上进行尝试,并获得相同的结果(当您检查元素时)。 I will add my code in the snippet but if it doesn't do it there I will link to a JSFiddle, any idea what is happening? 我将代码添加到代码段中,但是如果不这样做,我将链接到JSFiddle,知道发生了什么吗? Also I will add I did 'cat' the file and the HTML was clean on the tag as I would expect 另外,我还要添加“猫”文件,HTML标记上的HTML干净,正如我期望的那样

  <div class="custom-image-container"> <img class="front-page-flex-image" src="<?php echo get_template_directory_uri() . '/images/startup.jpg'; ?>" /> <div class="custom-image-overlay"> <h3 class="custom-image-text">Student Stories</h3> </div> </div> 

Problem is that your HTML code contains also PHP. 问题是您的HTML代码还包含PHP。 You need to process that code by PHP, which will return HTML. 您需要通过PHP处理该代码,这将返回HTML。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM