+ 3
HTML
How to create multiple html files for an multiple page website
10 RĂ©ponses
+ 3
yes, if you want to do it in Sololearn, make a single page app instead. Hiding and showing sections is not hard.
+ 2
you can't do this in Sololearn. your codes can't access each other here.
+ 2
Then how can I do it?
+ 2
On your home computer, you can put all the Web pages files into a folder and/or link to them.
https://www.sololearn.com/discuss/1724138/?ref=app
https://www.sololearn.com/discuss/1689338/?ref=app
+ 2
Just like it with <a href=""></a>
+ 2
You use <a> anchor tags to link between your HTML files.
Often inside a <nav> section at the top of each page.
For the "href" attribute of <a>, you typically use relative file paths for local files instead of absolute file paths.
đ Absolute file path example
"https://www.mysite.com/images/pets.jpg"
đ Relative file path rules
1) leading slash - start at local root directory
2) leading single dot - start at current directory
(where file you are working with is stored)
3) leading double period - start at parent folder of current directory
4) no leading slash or dots - same as rule #2
5) from starting folder, separate folders with slashes to go down directory tree
6) you can chain double dots to go further up directory tree
a) example
"../../sample.txt" - access a text file 2 directories up from current directory
đ Relative file path examples
"/css/common.css"
"../videos/game.ogg"
"next_page.html"
"./third_page.html"
đ Same relative path rules used for "href"/"src" in <link> and <script>
+ 2
To create multiple HTML files for a multi-page website, follow these steps:
1. **Plan Your Website Structure**: Decide on the layout and structure of your website. Identify the pages you need, such as Home, About, Contact, Services, etc.
2. **Create Individual HTML Files**: For each page, create a separate HTML file. You can name them according to their purpose, such as:
- `index.html` (for the Home page)
- `about.html` (for the About page)
- `contact.html` (for the Contact page)
- `services.html` (for the Services page)
3. **Write Basic HTML Template**: Each HTML file should have a basic template. Hereâs an example:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Title</title> <!-- Change title for each page -->
<link rel="stylesheet" href="styles.css"> <!-- Link to your CSS file -->
</head>
<body>
<header>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="services.html">Services</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
<main>
<h1>Welcome to My Website</h1> <!-- Change content for each page -->
</main>
<footer>
<p>© 2023 My Website</p>
</footer>
</body>
</html>
```
4. **Customize Each Page**: Modify the content within the `<main>` section and the `<title>` of each HTML file to reflect the specific content for that page.
5. **Link Your Pages**: Ensure that the navigation links in each HTML file point to the appropriate files, enabling users to navigate your website easily.
6. **Create a CSS File**: (Optional but recommended) Create a `styles.css` file to style your websiteâs layout and design.
7. **Test Your Website**: Open each HTML file in a web browser
+ 2
Jesse innocent ojie if you're using an A.I. answer, it's appropriate to say so.
See here:
https://www.sololearn.com/discuss/3021159/?ref=app
+ 1
[16/1, 07.27] .: import requests
import pandas as pd
from bs4 import BeautifulSoup
th = âhttps://www.jobs.id/lowongan-kerja?kata-kunci=part timeâ
halaman = requests.get(th)
hasil = BeautifulSoup(halaman.content, âhtml.parserâ)
lowkers = hasil.find_all(class_=âsingle-job-adsâ)
posisi = []
instansi = []
gaji = []
for p in lowkers:
t1 = p.select(âh3â)
t2 = t1[0].select(âaâ)
posisi.append(t2[0].get_text())
t1 = p.select(âpâ)
t2 = t1[0].select(âaâ)
[16/1, 07.28] .: try:
instansi.append(t2[0].get_text())
except:
instansi.append(â-â)
t2 = t1[1].select(âspanâ)
try:
gaji.append(t2[1].get_text())
except:
gaji.append(t2[0].get_text())
print(posisi)
print(instansi)
print(gaji)