Web-based Portfolio Builder JavaScript, HTML, CSS

👤 Sharing: AI
```javascript
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Web Portfolio Builder</title>
    <style>
        body {
            font-family: sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f4f4f4;
        }

        header {
            background-color: #333;
            color: white;
            text-align: center;
            padding: 1em 0;
        }

        .container {
            width: 80%;
            margin: 20px auto;
            background-color: white;
            padding: 20px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        h2 {
            margin-top: 0;
        }

        #portfolio-items {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 20px;
        }

        .portfolio-item {
            border: 1px solid #ddd;
            padding: 10px;
            border-radius: 5px;
        }

        .portfolio-item img {
            width: 100%;
            height: auto;
            margin-bottom: 10px;
        }

        /* Form Styles */
        form {
            margin-bottom: 20px;
            border: 1px solid #ccc;
            padding: 15px;
            border-radius: 5px;
            background-color: #f9f9f9;
        }

        form label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
        }

        form input[type="text"],
        form textarea {
            width: 100%;
            padding: 8px;
            margin-bottom: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-sizing: border-box; /* Important for width calculation */
        }

        form button {
            background-color: #4CAF50;
            color: white;
            padding: 10px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        form button:hover {
            background-color: #3e8e41;
        }

        /* Styles for the about me section */
        #about-me {
          margin-bottom: 20px;
        }

        #about-me h2 {
          margin-bottom: 10px;
        }

        #about-me p {
          line-height: 1.6;
        }


    </style>
</head>
<body>

    <header>
        <h1>My Portfolio</h1>
    </header>

    <div class="container">

        <section id="about-me">
            <h2>About Me</h2>
            <p id="about-me-text">
              Enter your information using the form below and click "Update About Me" to personalize this section.
            </p>
            <form id="about-me-form">
              <label for="about-me-input">About Me Text:</label>
              <textarea id="about-me-input" rows="4" placeholder="Enter your about me text here"></textarea>
              <button type="button" onclick="updateAboutMe()">Update About Me</button>
            </form>
        </section>



        <h2>Add Portfolio Item</h2>
        <form id="add-portfolio-form">
            <label for="title">Title:</label>
            <input type="text" id="title" name="title" required>

            <label for="imageUrl">Image URL:</label>
            <input type="text" id="imageUrl" name="imageUrl" required>

            <label for="description">Description:</label>
            <textarea id="description" name="description" rows="4" required></textarea>

            <button type="button" onclick="addPortfolioItem()">Add Item</button>
        </form>

        <h2>Portfolio Items</h2>
        <div id="portfolio-items">
            <!-- Portfolio items will be added here dynamically -->
        </div>

    </div>

    <script>
        function addPortfolioItem() {
            const title = document.getElementById('title').value;
            const imageUrl = document.getElementById('imageUrl').value;
            const description = document.getElementById('description').value;

            if (!title || !imageUrl || !description) {
                alert("Please fill in all fields.");
                return;
            }

            const portfolioItemsDiv = document.getElementById('portfolio-items');

            const portfolioItemDiv = document.createElement('div');
            portfolioItemDiv.classList.add('portfolio-item');

            const imageElement = document.createElement('img');
            imageElement.src = imageUrl;
            imageElement.alt = title;

            const titleElement = document.createElement('h3');
            titleElement.textContent = title;

            const descriptionElement = document.createElement('p');
            descriptionElement.textContent = description;

            portfolioItemDiv.appendChild(imageElement);
            portfolioItemDiv.appendChild(titleElement);
            portfolioItemDiv.appendChild(descriptionElement);

            portfolioItemsDiv.appendChild(portfolioItemDiv);

            // Clear the form
            document.getElementById('add-portfolio-form').reset();
        }

        function updateAboutMe() {
            const aboutMeText = document.getElementById('about-me-input').value;
            if (aboutMeText) {
                document.getElementById('about-me-text').textContent = aboutMeText;
            } else {
                alert("Please enter some text for the 'About Me' section.");
            }
        }
    </script>

</body>
</html>
```
👁️ Viewed: 9

Comments