Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

[RESOLVED] v Studio 2019 CSS

gem1204

New member
Joined
Sep 30, 2006
Messages
246
I’m using Visual Studio 2019 community edition. When I create an html page in designer it shows as expected but when I open the page from visual studio it’s opened using local host and none of the css formatting is used. If I open the page from the file manager using Edge, Firefox, or Chrome the page opens just fine. Why is this happening and how can I fix it?
 

NeedSomeAnswers

Superbly Moderated
Joined
Jun 4, 2002
Messages
2,610
Re: v Studio 2019 CSS

Well how are you including the stylesheet css file in your webpage? can you post your html code so we can see ?
 

gem1204

New member
Joined
Sep 30, 2006
Messages
246
Re: v Studio 2019 CSS

Well how are you including the stylesheet css file in your webpage? can you post your html code so we can see ?

Here is the beginning of my html code thru the top menu. It shows fine when I open from file system, but when I open with visual studio it uses local host and no css is used.

HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title> Working Dogs</title>
    <link rel="stylesheet" type="text/css" href="../../styles/BossStyle.css"/>
    <link rel="stylesheet" type="text/css" href="../../styles/MenuStyle.css"/>
</head>
<body>

<ul id="menu-bar">
 <li class="active"><a href="fav01.htm">Home</a></li>
 <li><a href="#">BJ</a>
  <ul>
   <li><a href="Boxer.HTM"></a></li>
   <li><a href="#">Products Sub Menu 2</a></li>
   <li><a href="#">Products Sub Menu 3</a></li>
   <li><a href="#">Products Sub Menu 4</a></li>
 </li>
 <li><a href="#">Test</a>
  <ul>
   <li><a href="Dog01.htm">Basic Breeds</a></li>
   <li><a href="#">Services Sub Menu 2</a></li>
   <li><a href="#">Services Sub Menu 3</a></li>
   <li><a href="#">Services Sub Menu 4</a></li>
  </ul>
 </li>
 <li><a href="#">About</a></li>
 <li><a href="#">Contact Us</a></li>
</ul>
 

NeedSomeAnswers

Superbly Moderated
Joined
Jun 4, 2002
Messages
2,610
Re: v Studio 2019 CSS

it probably doesn't like your relative path

Whats your folder structure like? do you have your style-sheet 1 or 2 levels down from your web pages?

in most apps you will have your pages on one level and then you might have your style-sheet in a sub folder called styles or something and in that case you would just need ../ once.
 

gem1204

New member
Joined
Sep 30, 2006
Messages
246
Re: v Studio 2019 CSS

Thanks NeedSomeAnswers

You were right. when I changed my folder structure as you suggested - it works. I still don't understand why there was a problem using local host to view the file but when I opened the same file from file explorer using firefox or another browser it rendered just fine.

Thanks for you help
 

gem1204

New member
Joined
Sep 30, 2006
Messages
246
Re: v Studio 2019 CSS

Thanks NeedSomeAnswers

You were right. when I changed my folder structure as you suggested - it works. I still don't understand why there was a problem using local host to view the file but when I opened the same file from file explorer using firefox or another browser it rendered just fine.

Thanks for you help

Sorry for the duplicate post. If I could figure out how to mark this as resolved I would have
 
Last edited:

NeedSomeAnswers

Superbly Moderated
Joined
Jun 4, 2002
Messages
2,610
No problem,

relative paths work a little differently in the web than in a file system.
 
Top