Lesson 07 – Iterating on Web Page Code with ChatGPT¶
Iterative refinement is a powerful way to enhance web pages. By pairing ChatGPT with a structured workflow, you can quickly identify issues, generate updated HTML, and merge improvements with confidence.
1. Investigate the Web Page¶
Begin by reviewing the page you want to improve:
- Open the page in your browser. Check navigation, forms, and overall layout.
- Look for defects. Are links hard to click? Are images missing alt text? Does anything break on mobile?
- Note improvement opportunities. Accessibility, responsiveness, and user experience should all be considered.
Record specific observations so you know what to change.
2. Reveal and Copy the Page Source¶
Access the raw HTML so ChatGPT can work with it:
- Right‑click the page and choose "View Page Source."
- Select all the code and copy it to your clipboard.
This gives you a starting point for edits.
3. Iterate with ChatGPT¶
Use ChatGPT (or Codex) to modify the code based on your findings:
- Paste the HTML into ChatGPT and describe the changes you want.
- Review the returned code. Ask for adjustments until it meets your needs.
Example prompt:
The navigation bar is cluttered. Simplify it, bold the text, and ensure it is mobile friendly. Here is the code: [paste snippet].
Repeat the conversation until the output looks correct.
4. Test Locally¶
- Save the updated HTML as a
.htmlfile. - Open the file in your browser and inspect the changes.
- If something is off, return to ChatGPT for another round of edits.
Testing locally ensures the page behaves as expected before deploying.
5. Integrate and Create a Pull Request¶
Once satisfied, ask Codex to integrate the final HTML into your project and open a pull request:
Here is the finalized HTML. Integrate it into [page URL] and create a pull request for review.
Codex will handle the commit and PR creation so your team can review the updates.
Conclusion¶
Following this workflow, you can:
- Spot issues on a webpage.
- Use ChatGPT to generate improved HTML.
- Validate changes locally.
- Deploy updates via Codex with a pull request.
This iterative approach streamlines web development while keeping code review and version control in the loop.
Additional Resources¶
Iterating on web pages with ChatGPT enables rapid, user-focused improvements. Building on Lesson 06 – Best Practices for Using Codex Actions in Parallel, which stressed conflict-free collaboration, Lesson 08 – Codex Code Quality Scans and Test Generation will elevate these iterations with automated reviews and tests.