Question

In: Computer Science

Assume that there is an image “fewa.jpg” in the root of the HTML folder. Write HTML...

Assume that there is an image “fewa.jpg” in the root of the HTML folder. Write HTML code to insert that image with appropriate alternative text. Also, apply an appropriate title to the image.?

Solutions

Expert Solution

Let's Assume a directory Structure,

Now Let's See How we used the same Image "Fewa.jpg" in all the three HTML Files- ABC.html, XYZ.html, LMN.html placed at different locations.

XYZ.html- In this Since XYZ.html and The Image are in same folder hence we didn't do anything special simply use <img src="Fewa.jpg", It works fine

<html>
<body>
<center><h1> Inserting Image </h1>
<img title="Your Title" src="Fewa.jpg"></center>
</body>
</html>

ABC.html- In this case we are in HTML folder and image is in Images folder so we have to first go in that foler by images and then take the image, images/Fewa.jpg

<html>
<body>
<center><h1> Inserting Image </h1>
<img title="Your Title" src="images/Fewa.jpg"></center>
</body>
</html>

LMN.html- In this Case we are in Sub Folder and now we have to move one folder above back that's why we used "../" It will help us to get back to HTML folder, Then we can Go to images folder and then access the image.

<html>
<body>
<center><h1> Inserting Image </h1>
<img title="Your Title" src="../images/Fewa.jpg"></center>
</body>
</html>

All the three codes are running fine doing the same work just showing the image on the web page as you can see in output below:

This title thing just shows the text you have written in title field when someone hovers over the image.

OUTPUT:

Now Whatever things we used in above code like in LMN.html we used "../" to get into one above folder, If we did not use this like:

LMN.html

<html>
<body>
<center><h1> Inserting Image </h1>
<img title="Your Title" src="Fewa.jpg" ></center>
</body>
</html>

OUTPUT

Since we have directly used the image but the image is not in the same folder as of LMN.html hence it is unable to show the image.

It shows the text which we we placed in alt, It is only used for this purpose only that if image is unable to be loaded you can display the alternaive text regarding tat image.


Related Solutions

In the root of the project create a folder called res. In that folder create a...
In the root of the project create a folder called res. In that folder create a file called DemoFile.txt Create a class with a static main that tests the ability to resolve and print a Path: Create an instance of a FileSystem class. Create an instance of the Path interface for the DemoFile.txt file. Print the constructed Path with System.out.println() method. Create a class that does the following: Using a pre-Java 7 solution, create a class that tests streams in...
Draw the DOM tree for the HTML of the ImageSwap application. <!DOCTYPE html> <html> <head> <title>Image...
Draw the DOM tree for the HTML of the ImageSwap application. <!DOCTYPE html> <html> <head> <title>Image Swap Application</title> <link rel="stylesheet" type="text/css" href="image_swap.css"> <script type="text/javascript" src="image_swap.js"></script> </head> <body>     <main>         <h1>Fishing Images</h1>         <p>Click on an image to enlarge.</p>         <ul id="imageLinks">             <li><a href="images/release.jpg" title="Catch and Release">                 <img src="thumbnails/release.jpg" alt=""></a></li>             <li><a href="images/deer.jpg" title="Deer at Play">                 <img src="thumbnails/deer.jpg" alt=""></a></li>             <li><a href="images/hero.jpg" title="The Big One!">                 <img src="thumbnails/hero.jpg" alt=""></a></li>             <li><a href="images/bison.jpg" title="Grazing Bison">                 <img src="thumbnails/bison.jpg"...
write a function to determine the square root of a number. The square root of a...
write a function to determine the square root of a number. The square root of a number can be approximated by repeated calculation using the formula NG = 0.5(LG + N/LG) where NG stands for the next guess and LG stands for the last guess. The loop should repeat until the difference between NG and LG is less than 0.00001. Use an initial guess of 1.0. Write a driver program to test your square root function. I WANT THIS PROGRAM...
Create a Home Page using HTML and CSS Part 1 • Contain an image or logo...
Create a Home Page using HTML and CSS Part 1 • Contain an image or logo about your website. • Must contain three navigation links. Home link. Registration link. Animations link. • Footer will contain links to web pages to any other site you wish (just be outside your webpage, like YouTube,etc.) Open links in new tab, not current tab. Create a Registration page: • Registration Fields: 1) User Name - Input Text 2) Password - Input Password 3) Repeat...
For this assignment, you will write a tic-tac-toe application in HTML and JavaScript, using an HTML...
For this assignment, you will write a tic-tac-toe application in HTML and JavaScript, using an HTML <canvas> tag. The game will be played "hot seat" where players take turns using the same device. Requirements: The canvas should be 600px tall and wide, with the gameplay area occupying most of the canvas. The X's and O's may be drawn using polygons or large-font text The grid should be drawn using polygons, specifically long, thin rectangles Before & between games, the canvas...
Need to write a program and part 1 of the program is to write an HTML...
Need to write a program and part 1 of the program is to write an HTML code, here are the parameters, but I am new to HTML and I am confused as to how to write this. 1) HTML file shall:         - have your name(s) somewhere near the top, as a comment.         - be a complete html document with appropriate html tags.         - have 1 form with 2 parts, described as follows:         part 1:             -...
Write a program in Python that walks through a folder tree and searches for files with...
Write a program in Python that walks through a folder tree and searches for files with a certain file extension (such as .pdf or .jpg). Copy these files from whatever location they are in to a new folder. The user can enter an absolute path for the start folder, or if the user does not enter a folder, the current directory is used. Likewise, the user can enter extensions to copy but if the user does not enter an extension,...
Write the below code to use HTML and JavaScript. 1. a) Write a JavaScript program to...
Write the below code to use HTML and JavaScript. 1. a) Write a JavaScript program to display the current day and time. b) Write a JavaScript program to print the contents of the current window.   c) Write a JavaScript program where the program takes a random integer between 1 to 10 d) Write a JavaScript program to calculate multiplication and division of two numbers (input from the user). e)Write a JavaScript program to create a new string from a given...
JAVA There is a folder named Recursive folder at the same location as these below files,...
JAVA There is a folder named Recursive folder at the same location as these below files, which contains files and folders. I have read the data of the Recursive folder and stored in a variable. Now they are required to be encrypted and decrypted. You may copy past the files to three different files and see the output. I am confused on how to write code for encrypt() and decrypt() The names of files and folders are stored in one...
I. At the beginning, create a folder named "test" and add the folder into the version...
I. At the beginning, create a folder named "test" and add the folder into the version control tool tracking system. Then create one file named "001" under this folder. Commit any change if necessary. II. Next, add another file named "002" in the same folder and commit the change ("adding") in the version control tool. III. Followed by adding that file, create a branch (namely, "branch-A") in the version control tool and make some changes to the contents in file...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT