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

Mixing Module Federation with different React versions and individual CSS isolation

In my setup, the module federation remote repository is: developed using react 17 utilizing material-ui 4 with jss incorporating global CSS from third-party libraries that cannot be modified Meanwhile, I have several hosts that consist of: different ver ...

Is there a way to use JQuery to make one button trigger distinct actions in two different divs?

For instance: Press a button - one div flies off the screen while another div flies in. Press the button again - Same div flies out, other div returns. I'm completely new to Javascript/JQuery so any assistance would be highly appreciated! Thank you ...

selenium.common.exceptions.InvalidSelectorException: Alert: A selector that is invalid or illegal has been provided

Currently, I am facing an issue with writing a script to manage web pages containing multiple elements. Upon clicking on one of these elements, it should open a new window. However, my current script is struggling to identify the element correctly. I requi ...

The variable in Angular stopped working after the addition of a dependent component

Currently, I am working with Angular and have implemented two components. The first component is a navigation bar that includes a search bar. To enable the search functionality in my second component (home), I have added the following code: HTML for the n ...

Tips for creating semi-circular shapes using CSS gradients

I am trying to design a div element with a background made up of two colors divided by a half circle: My preference is to use gradients for easier animation purposes. I am looking to avoid using pseudo-elements or border-radius, and my HTML structure limi ...

Angular HTML is throwing an error related to object arrays

Is there a way to display only specific fields of an array? <div class="form-check" *ngFor="let periodo of filterPeriodos()"> <div>{{periodo.periodos | json}}</div> <input class="form-check-input mr- ...

Displaying several modals with a backdrop on top of one another using Bootstrap

My issue involves two modals: one that displays appointment information with a delete button, and another that serves as a warning before deleting. I want the delete-warning modal to overlay a backdrop on the modal beneath it, graying it out. However, both ...

When using IE8 with pie.htc, implementing html5shiv.js causes rounded corners to disappear once more

While everything is running smoothly in most browsers, there seems to be an issue with IE8. After connecting pie.htc to address the rounded corners problem, everything seemed fine until html5 issues cropped up in IE8. To combat this, I implemented html5shi ...

What is the process for embedding a 3D model using three.js into a specific div on a webpage?

Lately, I've been struggling with a persistent issue. I can't seem to figure out how to integrate my three.js scene into a div on my website. Despite watching numerous YouTube videos and reading countless articles on the topic, I still haven&apos ...

The extent of a nameless function when used as a parameter

I am currently developing a straightforward application. Whenever a user hovers over an item in the list (li), the text color changes to green, and reverts back to black when the mouse moves away. Is it possible to replace lis[i] with this keyword in the ...

Responsive Design and the Importance of Setting Min-Width in Bootstrap 3

After doing some research on Stack Overflow about defining a minimum width for a responsive layout in Bootstrap3, I encountered conflicting answers related to "media queries." My goal is to make my layout responsive up to a certain point. Once it reaches, ...

The z-index of two elements seems to be behaving differently than anticipated

I am encountering an issue with the code provided below, which is a simplified version of a larger problem. Can you explain why, if: .div_A {z-index: 10;} < .div_C {z-index: 20;} the button inside div_C appears behind div_A? I need to understand the ...

CSS3 Animation displaying text color change on various elements in a continuous loop

I was attempting to create a dynamic animation where multiple texts change color, similar to what you can see on https://vercel.com. I have successfully figured out how to make one text change color using keyframes, but I am struggling to make each text ch ...

Using JQuery to iterate through every unique div id in the HTML document

i am attempting to utilize jquery to iterate through each div tag that has an id of "rate". The goal is for jquery to execute a function on the individual divs. Here is my code snippet: information.html <html> <input class="rate" type="hidden ...

Adjusting font sizes for both multiline text within a <p> element and labels based on the number of lines

Whenever I have multiline paragraphs or labels, the font size seems to adjust depending on the number of lines. All I want is to keep the font size consistent regardless of the lines. The labels all have the same CSS styling and inheritance. Here is a vis ...

Showcasing the information stored within my li element, I am able to access and view the data through my console

I want to showcase the data in the browser Upon hitting the api call, I retrieve the data in my console. The challenge lies in displaying the data within my li tag. Below are snippets of my relevant code and the entire code can be found in the gist links p ...

What is the method for altering the color of just the text in an anchor link?

Here is the code snippet I’m working with: <a href="#" title="some title"> <span>Do not change color of this text</span> Want to only change this text color </a> I am trying to change the color of the anchor tag text only, w ...

Once the image is requested in HTML, three.js makes a subsequent request for the same image

This is a block of code. let image = new THREE.TextureLoader().load("http://odf9m3avc.bkt.clouddn.com/1493817789932.jpg") <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/88/three.min.js"></script> <img class='preLoad&apo ...

What techniques can be used to resize an image to perfectly fit a square on a webpage?

A challenge on the web page is to display images in a square format of 90 * 90 pixels. However, the sizes of these images are not consistent and may vary from 80*100 to 100*80 or even 90 * 110. The requested solution is to stretch the image as follows: ...

HTML email - image appears in email only on selected devices

I am experiencing an issue with my EDM. While the images look fine on my desktop and mobile devices, some of them are not showing up when I try to send the email to other phone devices (they display as "not found"). All the images are already hosted on my ...