I'm creating a series of web pages and I want them all to be linked together from a navigation bar, I currently have:
<li>XHTML & HTML</li>
However, if I need to export these files to another computer wouldn't the link be wrong and then not work?
How would I change these links so the file containing the HTML, CSS can be zipped up emailed to someone and it still work for them?
Use relative URLs.
<li>Home</li>
<li>About</li>
<li>Contact</li>
<li>Something</li>
The path is relative to the current file, home.html, about.html, and contact.html are all in the same folder, while page.html is in a subfolder named 'folder'.
Just use relative links - no need to include the file:///...... This will also mean if you upload it to the web or zip all the files together and send to someone else, it will still work - assuming of course you maintain the same folder structure and relative file locations.
For example I have a root folder with my index.html file which has the navigation links and a folder structure as below with firstpost.html and secondpost.html in the blog folder.
Web Project folder structure
index.html
Creation.html
blog/ (folder)
firstpost.html
secondpost.html
example links in index.html
<ul>
<li>
XHTML & HTML
</li>
<li>
First Post
</li>
<li>
Second Post
</li>
</ul>
check out this post that will give you a basic overview of the idea of absolute vs relative paths.
Related
So i have a simple nav bar that links to other pages on the website.
<ul class="navbar__list">
<li class="navbar__item">About</li>
<li class="navbar__item">Offerings</li>
<li class="navbar__item">Testimonials</li>
<li class="navbar__item">Contact</li>
<div class="navbar__contact">
Book a session
</div>
</ul>
Which all link to html files that also exist in the root directory (the same directory). Every time i try to use the link i am getting a response that says "Cannot GET /???" with ??? being the name of the html file i am trying to access.
I have played around with the paths, tried typing the name of the file explicitly, and have found that links to external sites work just fine, it's just internal pages that are causing problems.
The pages that i'm linking to do have content in them.
I'm hosting this locally using npm live-server, i'm not too experienced in it though and do wonder if there needs to be more configuration if i'm to use it to locally host several pages?
Thanks in advance
you need to write the full path to the file, not just its name
you missed .html after file name
If it is in the same directory, then write
href="about.html"
I wanted to make a website that would help people study better. It's still pretty basic since I don't actually know enough JavaScript to make it cool. I wanted to link one page to another through buttons, but I have no luck in doing so. I use a Chromebook and I had seen that the same link you'd use on a computer using windows isn't the same.
Here is what I did, but nothing seems to work. It is saved in the folder, Websites and it's named About.html
HTML code
<ul>
<li>Home|</li>
<li>About|</li>
<li>Schools|</li>
<li>Submit Notes|</li>
</ul>
Make sure your index.html page (start page) is located in the same folder as your About.html file. If it is, your code would be a follows:
<ul>
<li>Home|</li>
<li>About|</li>
<li>Schools|</li>
<li>Submit Notes|</li>
</ul>
I'm working on creating my first website and I've run into a problem. This is my file structure from my folder
Info.html
Blog.html
Testimonials.html
Contact.html
blog (folder)
---> blog-post.html (is inside blog folder)
The website has the same navigation on all of the main pages but the sub pages in the blog folder can only access other files within the blog folder. This makes it so that I cannot have Mywebsite.com/blog/blog-post.html link back to the info page as it's not in "blog" because it expects the link to come from the blog folder.
My question is, how can I keep the blog posts in a sub folder and still allow blog posts to contain links to the pages not within the blog folder?
Right now I'm structuring my navigation as such:
<nav><ul style="list-style-type:none">
<li>Info</li>
</nav>
I want to avoid duplicate content but i'd also like to have the blog/blog-post in the URL.
Is there a syntax or attribute that I should be using to fix my issue or have I made a mistake within structuring the files of my website?
use this "/" to refer to the root folder
Like this
<nav><ul style="list-style-type:none">
<li>Info</li>
</nav>
I my JSF view I display a list of links. When the user clicks on the list of links, two HTML files are loaded into a ui:include element from the folder on the server that the clicked link points to.
E.g. clicking the link:
http://localhost:7474/project/folder1
Loads the menu.html file from that folder into a ui:insert element as well as a file called cov.html into another ui:insert.
The menu.html looks like this:
<ul id="menu" xmlns="http://www.w3.org/1999/xhtml" >
<li class="menulink">
ONE
<ul>
<li class="menulink">
TWO
<ul>
<li class="menulink">
THREE
</li>
</ul>
</li>
</ul>
</li>
</ul>
Clicking on the link ONE should load the file
http://localhost:7474/project/folder1/files/one.html
into the ui:insert where previously the file cov.html had been loaded into (thus, replace the cov.html file).
So any file pointed to by one of those links in the menu.html should be loaded into the ui:insert.
When I click on one of the links now, it looks for the file:
http://localhost:7474/project/files/one.html
How can I get the value of the link that was clicked in my backing bean and load the correct file into the ui:insert?
Not an option for me would be to put the name of the folder into the link of the menu.html file, e.g. I cannot do this:
ONE
because the files get uploaded by users in a zip folder and I want them to be able to name that folder anything they like. So I cannot hardcord that folder name in the menu.html.
Do the a elements need to have an attribute that the backing bean can access or could I somehow incerpect the requestes URL and correct it?
What would be the best way to handle this?
Okay so i'm learning html right now and soon css. In my html coding I have a section like this for navigation:
<div id="header">
<h1>Guild Wars 2 Fanbase</h1>
<ol id="navigation">
<li>Home</li>
<li>Facts</li>
<li>Gallery</li>
<li>Coding
<ul><li>Lines</li>
<li>Comment Lines</li>
</ul>
</li>
</ol></div>
Now when I open up this .html file this is all layed out the way I want it too look (the mark up that is). My question is this, when I click on a link on this site (this site being this code) I get an a error saying this webpage is not found, but of course. But how do I create it so I can have the web pages working together? I'm not sure how to word it correctly. Like, do I create another .html file in the same directory so somehow when I click the link it reads from the second .html file?
If you not sure what I'm asking, just let me know and I'll try to be more specific. Thank you for your help (:
excuse my mistakes in grammar, not the worlds best in English, trying my best (:
As mentioned by #Craig T your href's should point to another page.
<li>Home</li>
<li>Facts</li>
These are relative to your existing website where '/' is the topmost page.
'/facts' is actually refering to a directory called facts relative to '/'
However, they need not point to just another html page.
They can also point to another website.
e.g.
<li>Links</li>
Or a specific page at other site:
<li>Something</li>
In the html code you provided the URL's point to directories. When a specific file or resource is not provided i.e. it doesn't end in something like /page/yourpage.html then it's up to the webserver to decide how to handle it. They will usually have rules to determine this.
e.g. the apache webserver is often configured to return the file index.html in the requested directory.
So these:
<li>Home</li>
<li>Facts</li>
<li>Gallery</li>
<li>Coding
<ul><li>Lines</li>
<li>Comment Lines</li>
Are equivalent to these:
<li>Home</li>
<li>Facts</li>
<li>Gallery</li>
<li>Coding
<ul><li>Lines</li>
<li>Comment Lines</li>
On some setups instead of the default being index.html it's index.php or index.asp.
Actually most go by an order of priority.
e.g. try index.php first and if not available try index.html
I hope that's clear.
In the context of this question your href's should point to another html page.
For example:
<li>Facts</li>
You would need to create a facts.html page in the root directory of your site.
Here's an awesome link someone gave me once, about URLs: http://www.skorks.com/2010/05/what-every-developer-should-know-about-urls/
-- oops was meant to be a comment, sorry :P