انتقل للمحتوى
Robo EgyptRobo Egypt
☰ Course contents
Robo Web: home
0. Lab tour1
1. HTML: the page's content7
2. CSS: the page's look6
3. JavaScript: the actions7
4. The project: the to-do list3
5. Pro CSS: shadows and movement5
6. Arrays and building the page with code3
7. Events and forms3
8. Objects and time3
9. Canvas: drawing and games3
10. The final project: the memory game3

A picture and a link

Section 1: HTML: the page's contentLesson 1.4 · ⏱ 7 min

<img src="…" alt="…"> is a picture: src is its address, and alt describes it. And <a href="…"> is a link that takes you to another page.

HTML
<h1>My page</h1>
<img src="https://roboegypt.com/assets/logo-light.png" alt="Robo Egypt logo">
<p><a href="https://roboegypt.com">Visit Robo Egypt</a></p>
CSS
body { font-family: Tahoma; }
img { width: 120px; }
🖥️ The page in Robo Web:The page in Robo Web

📌 Another example: a picture that is a link

We put the picture inside the link, so clicking the picture opens the website.

🌐 A picture that is a link
HTML
<h2>Click the logo 👇</h2>
<a href="https://roboegypt.com" target="_blank">
  <img src="https://roboegypt.com/assets/logo-light.png" alt="Robo Egypt logo">
</a>
CSS
body { font-family: Tahoma, sans-serif; }
img { width: 160px; }
🖥️ The page in Robo Web:The page in Robo Web
✍️ Practise
A picture and a link.
✍️ Practise here in the lessonor open the lab in a new page ↗

🎯 Challenge yourself

Easy

A picture 100 pixels wide, with an alt.

👀 Show the solution
🌐 Solution
HTML
<img src="https://roboegypt.com/assets/mark-light.png" alt="Robo">
CSS
img { width: 100px; }
🖥️ The page in Robo Web:The page in Robo Web

Result: a small picture.

Medium

A link that opens in a new tab: target="_blank".

👀 Show the solution
🌐 Solution
HTML
<a href="https://roboegypt.com" target="_blank">Visit Robo Egypt ↗</a>
CSS
body { font-family: Tahoma, sans-serif; }
🖥️ The page in Robo Web:The page in Robo Web

Result: a blue underlined link.

Hard

Two pictures side by side, with two links under them.

👀 Show the solution
🌐 Solution
HTML
<img src="https://roboegypt.com/assets/mark-light.png" alt="1">
<img src="https://roboegypt.com/assets/logo-light.png" alt="2">
<p>
  <a href="https://roboegypt.com">Website</a> |
  <a href="https://roboegypt.com/lab">Lab</a>
</p>
CSS
body { font-family: Tahoma, sans-serif; }
img { width: 120px; }
🖥️ The page in Robo Web:The page in Robo Web

Result: two pictures and two links.

Finished the lesson? Mark it so your progress counts.