Linking a CSS file to a .ASPX file - html

Its my first introduction into using aspx pages from originally creating html pages.
I am trying to link an external CSS page to the index.aspx page and it is not pulling through anything.
Maybe im not referencing it correctly or it needs to be in a specific directory, Im not too sure.
See below
<%# Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<meta name="viewport" content="width=device-width" />
<title>TestTitle</title>
<link href="Styles/Main.css" type="text/css" rel="stylesheet" />
</head>
<body>
<p class="testp">HI MY NAME IS HARRY</p>
</body>
</html>
And this is the CSS code
body {
font-size: 36px;
}
.testp {
font-family:'Bradley Hand ITC';
}
Nothing hectic, im just testing the waters.
See directory below
If i could please get som help , or maybe a better way of doing it correctly.
Thanks

Related

Trying to create a theme for blogspot using WYSIWYG web builder, it runs on https://www.w3schools.com/ but not on blogger HTML theme editor

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Page</title>
</head>
<body>
<div id="wb_Text1" style="position:absolute;left:458px;top:19px;width:156px;height:16px;z-index:1;">
<span style="color:#000000;font-family:Arial;font-size:13px;">This is My First Post</span></div>
<div id="wb_Text2" style="position:absolute;left:338px;top:60px;width:509px;height:32px;z-index:2;">
<span style="color:#000000;font-family:Arial;font-size:13px;">If i am looking at it<br>that means i
am able to create the theme correctly using webbuilder</span></div>
</body>
</html>
it runs perfectly
but fails to run on Blogger
What should i do?
Yes your code is perfect but, in blogger theme design with html you need to add "b:skin and b:section" inside that code.
And this is the sample code for blogger from your code :
Sorry if i wrong but thats all i know :)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Page</title>
<b:skin>
<!-- Your CSS Code Here -->
</b:skin>
</head>
<body>
<b:section id='Unique-Id'>
<!-- Your section content -->
</b:section>

why there is nothing appears on chrome after coding with html?

I started learning HTML and CSS, I write an HTML code but the expected result is not appearing on chrome or internet explorer, I made sure that the code syntax is correct and the file saved with its name .html, everything appears normal and good with the code but why there is nothing appearing on chrome??
thank you.
This is a simple code that I'm trying to see on chrome.
<!DOCTYPE html>
<html>
<!-- HTML Project-->
<head>
<meta keywords="htmls, teach, learn" />
<link rel="stylesheet" type="text/css" href="style.css">
<title> HTML WEBSITE </title>
</head>
<body>
<div style="color : blue;">
THIS IS MY NEW WEBSITE
</div>
</body>
</html>

Why does CSS doesn't work on JSP?

I'm working on an activity and came across with this problem. The css won't work in my jsp.
Here is the structure of my project:
I tried applying css on my index.jsp
Here:
<%#page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../css/wpstyles.css" rel="stylesheet" type="text/css"/>
<title>Welcome!</title>
</head>
<body>
Login Here
</body>
</html>
and in my wpstyles.css is just this:
body{
background: #6699ff;
color: #ff3366;
}
But for some reason it won't work.
I also tried using the solution provided here:
JSP doesn't see css
I also tried using the :
<link href="${pageContext.request.contextPath}/../css/wpstyles.css" rel="stylesheet" type="text/css"/>
or
<link href="${pageContext.request.contextPath}/css/wpstyles.css" rel="stylesheet" type="text/css"/>
but still doesn't work.
Please help. Thank you.
Here is the rendered index.jsp using the <link href="${pageContext.request.contextPath}/css/wpstyles.css" rel="stylesheet" type="text/css"/>:
and here is the rendered index.jsp using the <link href="../css/wpstyles.css" rel="stylesheet" type="text/css"/>:
Quick note: your code isn't valid HTML 4.01. See https://validator.w3.org/. The <link> tag does not get closed in HTML 4.01 (though it would in XHTML). Note, also, that this appears to be different between your first and second screenshots.
Check out the error at the bottom of your first screenshot: your CSS is being served up with an HTML MIME type. See Resource interpreted as Stylesheet but transferred with MIME type text/html error in console for someone else hitting this error. But this sounds like it might be your problem. (It's also possible that your 404 page is HTML - I'd make sure your getting an HTTP 200.)
Basically, to debug, I'd grab the URL in the <link> tag, and try navigating to it. If it starts with "/", then go to http://localhost:8080/[link]. If it doesn't, try http://localhost:8080/Spring_App/[link].

Problems linking stylesheet to html doc

I'm trying to teach myself html/css. I can't get Aptana to recognize my css stylesheet.
Here's what I have for my html file (index.html):
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Josh's Worthwhile Practice</title>
<meta name="author" content="Joshua Soileau" />
<link rel="stylesheet" href="style.css" type="text/css"/>
<!-- Date: 2012-07-11 -->
</head>
<body>
<div id="nav">
<ul>
<li><h4>Solutions</h4><p>what we do</p></li>
<li><h4>Work</h4><p>what we've done</p></li>
<li><h4>Team</h4><p>who we are</p></li>
<li id="nav_logo">LOGO</li>
<li><h4>Blog</h4><p>stuff we say</p></li>
<li><h4>Contact</h4><p>talk to us</p></li>
<li><h4>Client</h4><p>login</p></li>
</ul>
</div>
</body>
</html>
And here's my .css file (style.css, in the same directory as index.html)
* {
clear: both;
padding: 0;
margin: 0;
}
body {
background-color: #eee;
font-family: Arial, Helvetica, sans-serif;
}
#nav {
color: #121415;
width: 100%;
height: 30px;
}
I have the link tag in my html code:
<link rel="stylesheet" href="style.css" type="text/css"/>
But when I open index.html in a browser or the Aptana preview pane, it just shows the plain html with none of my css pulled in.
Am I missing something obvious?
I found my answer. I had left an empty css tag in the file and Aptana didn't like it. This is my fault, I left it out of this post because I didn't think it was relevant.
I had:
#nav li {}
Sorry for not given you guys all the info, you were all very helpful and I helped me learn some new things. Thanks!
Try removing the type="text/css" attribute. Most modern browsers will complain if a type is specified and doesn't exactly match the Content-Type header the file returns, and when loading files locally there is no Content-Type header.
Your style.css file must be in the same location as index.html for it to work.
What do you see in the address bar of the browser when previewing?
What happens if you replace index.html with style.css? Are you able to see the CSS file?
Does it work without Aptana's preview, if you open the index.html file directly?
Also open up firebug or developer tools and hit the network tab to check if the browser is making a request for the CSS file and what if any errors are being reported. Also check the response headers.
You may also want to verify what Aptana is doing to your source after it generates the preview. Does doing a view source in the preview browser show the exact same link / path to the stylesheet?
Do you have a similar issue as this user with absolute path's in Aptana's preview: Aptana Studio 3 preview problems with absolute path
I'm pretty sure aptana has autocomplete on files and other html/css tags so try
<link rel="stylesheet" href="
I believe that when you have typed this if should start to give you all the files within your folder hysterical set up. If it doesn't try a / or the likes?
try putting it in a folder for example CSS
<link href="CSS/aki.css" rel="stylesheet"
type="text/css" />

Using Komodo Edit, and trying to link HTML/CSS Files

I'm completely new at HTML/CSS.
I'm currently using a Mac and I don't know how to link HTML/CSS files in Komodo. Oddly enough, I cannot find anything online that explains how. Is there any one who can explain in DETAIL how to go about doing so?
You link a CSS file with a <link> tag in the <head> of your HTML file:
<!DOCTYPE html>
<html>
<head>
<title>My Webpage</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
You can find more information from the HTML Dog: Applying CSS article.