Unable to include below the heading for the images

As I venture into the world of HTML, I am facing a challenge with placing titles below two images. Every time I attempt to add either h or p, the text ends up on the right side instead of below the images. What could I be doing wrong? This is all part of my learning process in HTML and it's crucial for an upcoming exam. Any guidance would be greatly appreciated.

<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="css/style.css">
        <title>Exploring Photography</title>
    </head>
    <body>
        <div class="content">
            <div id="page-title">
                <h1>Exploring Photography</h1>
            <div id="navigation">
                <ul id="nav-items">
                    <li><a href="index.html" id="home">Home</a></li>
                    <li><a href="landscapes.html" style="text-decoration: underline">Landscapes</a></li>
                    <li><a href="portraits.html" style="text-decoration: underline">Portraits</a></li>
                </ul>
                <div style="clear:both"></div>
            </div>
            </div>
            <div>
                <section id="center">
                    <img id="central-img" style="align-content: center" src="img/landscape-center.png" alt="image-central" title="landscape1" width="730" height="413">
                </section>
                <article id="side-by-side">
                    <img id="left-img" src="img/cover.jpg" alt="right-image" title="landscape2" width="640" height="400">
                    <img id="right-img" src="img/woman.jpg" alt="left-image" title="portrait1" width="736" height="1104">
                </article>
            </div>
            <footer class="footer">
                <div id="footer1">
                    <section id="contact">
                        <h3>Contact</h3>
                        <p>Email: <a href="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="671503020b061508140657535557565e27000a060e0b4904080a">[email protected]</a>"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5c2e3839303d2e332f3d6c686e6c6d651c3b313d3530723f3331">[email protected]</a></a></p>
                        <p>3rd Avenue, La Paz</p>
                        <p>Phone: 220-0000</p>
                    </section>
                    <section id="terms">
                        <h3>Terms</h3>
                        <p>All rights reserved, and content is private</p>
                    </section>
                    <section id="social-media">
                        <h3>Social Media</h3>
                        <a target="_blank" href="https://www.facebook.com"><img src="icon/facebook.png">Exploring Photography</a>
                        <a target="_blank" href="https://twitter.com/"><img src="icon/twitter.png">@exploringphotography</a>
                        <a target="_blank" href="https://www.instagram.com/?hl=en"><img src="icon/instagram.png">#exploringphotography</a>
                    </section>
                    <section id="rights">
                        <h3>Rights</h3>
                        <p>Ruben De La Rosa</p>
                        <p>Copyrights&#169;-2017</p>
                    </section>
                </div>
            </footer>
        </div>
    </body>
</html>

    body{
    background-color: #02010a;
    color: white;
}
.content{
    width: 900px;
    margin: 0 auto;
    text-align: center;
}
#page-title{
    background-color: #5b7989;
    width: 100%;
    height: 100px;
    margin-top: 0 auto;
    display: block;
    position: relative;
    border-top-left-radius: 10px;
    border-top-right-radius: 10xp;
}
h1{
    float: left;
    display: inline-block;
    text-shadow: 2px 2px #02010a;
    padding-left: 10px;
}
a{
    text-decoration: none;
}
ul li a{
    color: white;
}
#navigation{
    float: right;
}
#nav_items{
    list-style-type: none;
    font-size: 100%;
    padding: 10px 10px 10px 10px;
}
li{
    display: inline;
}
#center{
    background-color: #82c3a6;
    width: 900px;
    height: 450px;
    display: block;
    position: relative;
}
#central-img{
    align-content: center;
    margin-top: 15px;
}
#side-by-side{
    background-color: #d5c75f;
    border-width: 1px;
    display: flex;
    height: 500px;
    width: 900px;
    overflow: hidden;
    align-content: center;
}
#left-img{
    height: 300px;
    width: auto;
    position: relative;
    margin: 60px auto;;
}
#right-img{
    height: 300px;
    width: auto;
    position: relative;
    margin: 60px 70px auto;
    align-content: center;
}

Answer №1

To enhance your <img> element, enclose it within a <figure> element and insert a <figcaption> element after the <img>. Your code should look like this :

<figure>
<img id="leftpic" src="img/portadapng.jpg" alt="imagenderecha" title="paisaje2" width="640" height="400">
<figcaption>Insert your text here</figcaption>
</figure>

I hope this solution proves helpful to you.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Verify login availability using Javascript auto-check

For quite some time now, I've been grappling with a significant issue that has been consuming my attention. I am determined to implement an auto-check login availability feature in the registration form of my website. My goal is for it to verify the ...

I am a beginner in the world of Typescript/Angular, and I have encountered a compiling error TS2339. It seems that even when the condition *ngIf="x.length > 0;" should be false, the

I'm currently enrolled in a Typescript/Angular course where I am learning about the implementation of "*ngIf". During one of the lessons, the instructor provided an example using an empty array to demonstrate how it fails the condition and results in ...

How can we assign various class names depending on the value of an object?

I have a set of objects stored in my component. I need to dynamically apply different classes based on the value of the ErrorLevel property within each object. If an object has ErrorLevel equal to 1, I want to assign the following classes to various elemen ...

Tips for Adjusting the Position of a DIV Element Slightly Upwards

I am having trouble positioning the home-link image in my hovering navigation bar. The URL to my blog is: . Ideally, I want the image to be aligned with the text tabs next to it, but no matter what I try, I can't seem to move the "home" icon up by abo ...

Inquire regarding the header image. Can you confirm if the current HTML and CSS for this is the most efficient approach?

This is a preview of my website in progress (Disclaimer: I'm currently learning HTML to build this site, design comes next. I know it's not the conventional way to design a site, but oh well) Check out the site here Is the HTML code for the hea ...

Tips for seamlessly incorporating advertisements into a mixed application

I am having trouble adding banner ads to my hybrid application developed with Telerik. Despite my extensive research, I have been unable to find a suitable solution. Is there any html5 or javascript banner advertising service/API that is compatible with ...

A problem arose with Vitest when attempting to call the tRPC createCaller function due to the presence of incorrect JS syntax within the content. To resolve this issue, it is recommended to include

Currently, I am in the process of writing unit tests with Vitest and utilizing the tRPC createCaller to simulate the trpc context. However, I am encountering a failure during testing which presents the following error message: Error: Failed to parse sourc ...

Particles.js fails to persist as I scroll down the HTML page

After creating a website page, I incorporated Particles.js for the background. However, when I scroll down, the particles seem to be confined to the initial corner of the screen and do not continue downward. Here are my current particle settings: #particl ...

How can I arrange a table in Angular by the value of a specific cell?

Here's the current layout of my table: Status Draft Pending Complete I'm looking for a way to sort these rows based on their values. The code snippet I've been using only allows sorting by clicking on the status header: onCh ...

What are the best methods for placing content within a box and ensuring it is responsive?

Having trouble solving a simple problem that seems to have an easy solution. The code I'm working on is meant to display multiple bubbles with similar content, but the text gets distorted due to using strange margin values to fit a specific resolution ...

Compatible with pure vanilla JavaScript, but not jQuery

I am currently facing an issue with attaching VKI (Virtual Keyboard Interface) to an element that is dynamically added to the DOM using JavaScript. The scenario involves a table with initially only one row, along with "Add Row" and "Delete Row" functionali ...

Uploading Multiple Files with Base64 Encoding in PHP

I am looking for a way to store images in a database and retrieve them using base64 encoding/decoding. Can anyone guide me on how to achieve this? Here is the HTML code: <form method="POST" action="add_script.php" enctype="multipart/form-data"> ...

Tips for implementing and utilizing onclick functions in EJS

My goal is to develop a trivia game with interactive features. I aim to enable users to click on an answer, which will trigger a border effect and increase the points variable. Below is the layout of the entire page: <% include ../partials/boilerp ...

an li element is accompanied by a visible box

In my possession is a container: #box1 { height:100px; width:208px; } along with a series <li id="first"><strong>FIRST</strong> </li> <li id="second"><strong>SECOND</strong&g ...

Conceal Choices During Search using jQuery Select2

I'm having trouble figuring out how to make the Select2 plugin work for my specific color selection feature. My goal is to allow users to choose 5 colors from a list, including an "Other" option. When the user selects "Other", they should be able to ...

What is the reason for background images not loading when using `display: none`?

I'm really struggling to understand this puzzle: When the page loads, will mypic.jpg be downloaded by the browser? #test1 { display: none; } #test2 { background-image: url('http://www.dumpaday.com/wp-content/uploads/2017/01/random-pic ...

Using a PHP switch case statement with an HTML multiple select dropdown

I am facing an issue with my HTML multiple select box: <option value="1">First choice</option> <option value="2">Second choice</option> <option value="3">Third choice</option> Using jQuery, ...

Error encountered when attempting to generate a hyperlink

Whenever I try to assign hyperlinks to each image name, I keep encountering an undefined imgitem error in the hyperlink(s). Could it be that I am incorrectly placing the <a> tags? echo '<td width="11%" class="imagetd">'; if (empty($a ...

Display a label upon hovering over an image

Is there a way to create an effect where upon hovering over an image, a pop-up image is displayed like this: Any suggestions on how I can achieve this using HTML and CSS? Thanks in advance! ...

Tips on invoking a factory method from a different service method in AngularJS

I have a factory method that goes like this.. (function (angular) { "use strict"; angular .module('app') .factory('UserService', ['$rootScope', '$q', function ($rootScope, $q) { ...