Creating Links
Links are the foundation of the web, connecting pages and resources. The anchor element <a> creates hyperlinks.
Basic Links
Loading HTML Playground...
The href attribute specifies the link destination:
- Absolute URL:
https://www.example.com - Relative URL:
/aboutorpage.html
Link Attributes
Loading HTML Playground...
Common attributes:
href- The destination URLtarget="_blank"- Opens in new tabtitle- Tooltip text on hoverdownload- Downloads instead of navigating
Security with External Links
Loading HTML Playground...
Always add rel="noopener noreferrer" when using target="_blank":
noopener- Prevents the new page from accessing the original pagenoreferrer- Doesn't send referrer information
Link Text Best Practices
Loading HTML Playground...
Good link text:
- Describes the destination
- Makes sense out of context
- Avoids "click here" or "read more"
- Helps screen reader users
Styling Links
Links have different states that can be styled:
Loading HTML Playground...
Link states:
:link- Unvisited links:visited- Already visited:hover- Mouse over:active- Being clicked
Exercise: Create a Navigation
Build a simple navigation with links:
Loading HTML Exercise...
Links connect the web together. Writing good, accessible links improves user experience and SEO!
التالي · الدرس 9 من 32
Types of Links
قراءة 2 دقيقة
أنهيت 8 من 32 درسًا

اسأل Byte عن هذا الدرس
محادثة خاصة حول هذا الدرس. قرأ Byte الدرس كاملًا، ويجيب خلال ثوانٍ، ويُظهر القسم الذي تأتي منه كل إجابة. يمكنك السؤال بأي لغة.
الأسئلة والأجوبة
أسئلة عامة حول هذا الدرس. يجيب AI Tutor فورًا بلغتك، ويراجع فريق FreeAcademy الإجابات، ويمكن لكل المتعلمين قراءتها.

