so i want to make all my img links into a simple word/code in html and css
Example:
//Not like this
<img src="https://img1.com">
<img src="https://img2.com">
<img src="https://img3.com">
//I want to do something a little bit more like this instead
value01 = https://img1.com
value02 = https://img2.com
value03 = https://img3.com
<img src="value01">
<img src="value02">
<img src="value03">
I don't know what to do I am new to HTML and CSS
CodePudding user response:
I think you cant do this in html because The tag is used to embed an image in an HTML page maybe u can do this in python, instead that you can do this
<b>
<img src="value1.jpg" alt="Value1" >
</b>
Source : img tag html
CodePudding user response:
there are two ways I can think of.
::THIS FIRST OPTION ONLY WORKS IF YOU SAVE THE PAGE IN (.PHP) EXTENSION
1° Method => You can create a php file apart, store the links of images in variables like this.
< ? php
$img = 'https : // upload . wikimedia . org /wikipedia/commons/thumb/c/c3/Python-logo-notext . svg/1200px-Python-logo-notext . svg . png';
? >
next, you can call this file in the main page/index.
< ? php include ". /page/images . php"
? >
< html >
< img src="< ? php echo $imagem; ? >" alt="" srcset="">
< / html >
2° Method => you can just save the image to a folder easy to target.
- create a folder inside the same folder you are accessing your main page. for example: I created a folder called (img) in the same folder my index.html is found, save the image with a short name.
so to access that image i would call the image like this
< img src="image/img.png" alt="" srcset="">