Home > front end >  Href and SRC cannot reference files in the directory at the same level, need to input the complete r
Href and SRC cannot reference files in the directory at the same level, need to input the complete r

Time:12-22

Do encounter a problem when I log in registration page, use the link reference folder in the directory of the login at the same level. The CSS must be written as
<link rel="stylesheet" type="text/CSS" href="https://bbs.csdn.net/topics/User/login/css/login.css"/& gt;
To load a CSS style

This is loading of CSS page





But written & lt; Link rel="stylesheet" type="text/CSS" href="https://bbs.csdn.net/topics/css/login.css"/& gt; The CSS style disappeared when

This is not loaded to the CSS style page




Strange is clearly above shows the login page. The JSP and CSS folder is in the same directory, but I can't write CSS/login. The CSS but must be written in User/login/CSS/login. The CSS to load the style





To solve this is
why?

CodePudding user response:

Your HTML page is set up & lt; Base href="http://www.xxxx.com/"/& gt;
So all the relative address links in the page are relative to the http://www.xxxx.com/

CodePudding user response:

Are generally set up & lt; Base href="https://bbs.csdn.net/"/& gt; Let all relative address in page links are relative to the root directory of the site,
Such links between different directory replication with HTML code or move files don't need to modify the code is one of the links of

CodePudding user response:

reference 1/f, the sky wave response:
your HTML page is set up & lt; Base href="http://www.xxxx.com/"/& gt;
So all the relative address links in the page are relative to the http://www.xxxx.com/
my page not & lt; Base href="http://www.xxxx.com/"/& gt;

This is my login. JSP & lt; head> Section, you see


<% @ page language="Java" contentType="text/HTML. Charset=utf-8 "
PageEncoding="utf-8" % & gt;
<meta HTTP - equiv="content-type" Content="text/HTML. Charset=utf-8 "& gt;
Books management system management system & lt;/title> <br/><link rel="stylesheet" type="text/CSS" href="https://bbs.csdn.net/topics/User/login/css/login.css"/& gt; <br/><script SRC="https://bbs.csdn.net/topics/User/login/js/wechatlogin.js" & gt; </script> <br/></head> <br/><br/>I was in the login. The JSPS to join & lt; Base href="https://bbs.csdn.net/"/& gt; Later, no matter under the href is inside the CSS/login. The CSS or User/login/CSS/login. CSS cannot normal load<p class="article - content rp"> CodePudding user response: </p>You relative references for the directory structure of the code should be no problem, you see under the F12 debugging, look at the CSS exactly have load to come in, if there is no load in, look at what's error message, </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/frontend/95527.html" target="_blank" style="color:#999">https//www.codepudding.com/frontend/95527.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/frontend/95526.html'>WeChat small program can not run after array joining together, o great god help solve</a></div> <div class="detail-arr-right">Next:<a href='/frontend/95528.html'>React and Vue how to choose</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=HTML+%28CSS%29' target='_blank'>HTML (CSS)</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>