0% found this document useful (0 votes)
6 views7 pages

SEO and Accessibility with HTML5 Elements

The document discusses the use of semantic HTML elements to enhance accessibility and SEO, such as using 'nav' for navigation links and various other tags like 'section', 'article', and 'footer'. It also covers CSS properties for styling, including font families, pseudo-classes, and creating responsive navigation bars and carousels. Additionally, it highlights best practices for structuring HTML elements and troubleshooting common issues in web design.

Uploaded by

Steven
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views7 pages

SEO and Accessibility with HTML5 Elements

The document discusses the use of semantic HTML elements to enhance accessibility and SEO, such as using 'nav' for navigation links and various other tags like 'section', 'article', and 'footer'. It also covers CSS properties for styling, including font families, pseudo-classes, and creating responsive navigation bars and carousels. Additionally, it highlights best practices for structuring HTML elements and troubleshooting common issues in web design.

Uploaded by

Steven
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Use semantic elements: Instead of using the div element to wrap the navigation links, you can use

the nav element. This helps to improve the accessibility and SEO of your website, Example of
Semantic tags with HTML5 are
 Section
 Nav
 Heading
Site logo, Site title, main navigation
 Main
 Footer
 Article
This is a self-contain piece of content. It can be read and still make meaning without
adjoining information to the rest of the web content

 Figure
Images, videos etc
 Aside
Side bar content, related article or advertisement
These tags portray meaning as the names imply. These tags helps search engines & assistive
technologies such screen reader understand the structure and content of the web page.

Images if not specified takes up the size of the whole DIV object by repeating itself

Background-size: contain:
This property will stretch the image to occupy the entire DIV. This will stretch in proportion to the
DIV size.
The more padding you have on a DIV, the allowance you have for the background-image
While margin pushes things away

1. Font Family and Font Stacks


This allows you to create a fall-back font, if the required font family is not present on the current
working PC

For example, styling the h1 tag will be as follows

The following CDN is used to make available fonts which are not available as system fonts
[Link] Always remember that attributes are inherited

Since the font family for the hi-tag is not specified, it inherit the font family attribute from the
body-tag, which is Calibri.
Considering figure above, the font family for hi-tag is specified. Hence this takes priority over
inheritance.
All h-tag and p-tag have by default, margins at top and bottom. By default, the size of each margin
is corresponding to the font-size of the text
Also, the spacings between lines or text are called lettings

Spacing
between text

These spacings can be adjusted with the attribute Line-height. Preferably, the value of the Line
height should be unitless and not pixels

Text decoration, Text transform are also CSS attributes that can aftect the appearance of text or
lines

The Anchor-Tag does not inherit attributes because it has its own default attribute (e.g text color =
blue)
2. Pseudo-Class

This is a keyword added to a selector that specifies a special state (action) of the selected element
e.g hover effect, active state of a button

It is pseudo i.e false state because by default it is not active. This is only active when the class is
active. This action or active state is dependent on the verb of the pseudo class
The pseudo-class have to be in the following order
 Default link
 Visited
 Hover
 Active

This is because of the top-down approach of executing CSS code. They might over ride an existing
action
We also have the focus pseudo-class. This can be visualized by pressing the tab button. This will
allow it navigate through the links and physically displaced by a rectangular boarder around the
current link which is active
This is particular for website accessibility. Fir readers that cannot navigate by moving the mouse

1.1 Pseudo Element


::before & ::after donot work for self closing tags like img-tag

Responsive Outline

The h1 – h6 tags should be structured like the headers in Microsoft word document.
So therefore h1 1
h2 1.1
h3 1.1.1

ID-tags are best used for linking forms in a web page and also

GLOBAL ATTRIBUTES
3. CREATING A RESPONSIVE NAVBAR
1.2 Pusing objects to left and right
This can be done by uain the float attribute as shown below

1.1.1 Issue Encountered:


After performing float:left & Float:right, The header shrunk to having a height = 0px (Seemed like
it disappeared)

1.1.2 Solution:
The following code resolved the issue

1.3 A MODERN APPROACH TO A RESPONSIVE NAV BAR WITH HTML & JS


This involved the use of the following design concepts
 CSS Variables: a variable, also known as a "CSS variable" or a "custom
property," is a way to store a value that can be reused throughout a
stylesheet. CSS variables are defined using the ‘- -’. It is used/called in any
CSS property value by using the var() function. These are illustrated below

4. BUILDING A CAROUSEL
Best practices include the follow
Use ul-tags for grouping your slides instead of a div-tag

1.1.3 Issue Encountered:


For left and right arrow objects (i.e., < & >) , we add the image within a button using the html script
below

However, the svg object did not allow the lifeserver to be active. The error is shown below

1.1.4 Solution:
The following code resolved the issue

5. ShortCut Keys and functions

6. Using UL for Navigation bar or Carousel Slides


The following are styling codes used for adjusting the List items
Removing the bullets
List-style: none;
We have the following strata

Grand-parent DIV-class for the entire


Carousel.
It will be with the carousel
section
Main-parent DIV-class for the buttons and
slides only
Parent Class for all unordered list-
items
Child Class for individual list items

To stack the slides or images on top of each other, the child must have a Postion: absolute; This
will make it go out of the work flow but must be relative to something
Hence we make it relative to major container (not the section) which is the Grand-parent by giving
the property of Position: relative

1.1.5 Issue Encoutered: Objects of the carousel side go out of the flow when given a
position of absolute: (this did not affect the images:

1.1.6 Solution:

7. JAVASCRIPT FOR CAROUSEL


The less event listeners you have the merrier

Common questions

Powered by AI

CSS variables, also known as custom properties, allow designers to store values that can be reused throughout a stylesheet, promoting consistency and easing maintenance. By defining a variable once, designers can apply it across multiple properties. This is useful for ensuring uniformity and making global changes without needing to update individual styles. For instance, a color variable ensures that all instances of this color can be changed easily from one place .

By default, background images may repeat to fill the entire div area if not specified otherwise. This occurs because the background-repeat property defaults to 'repeat'. To alter this behavior, one could use 'background-size: contain' to ensure the image scales proportionally within the div, or set 'background-repeat: no-repeat' to prevent it from repeating, depending on the desired effect .

CDN-hosted font stacks enhance web design flexibility by providing access to a wide range of fonts that aren't typically available on all devices, ensuring consistent typography across different platforms. They also reduce loading times due to faster access from content delivery networks, improving performance and user experience .

Pseudo-elements like ::before and ::after allow developers to insert content before or after an element's visible content, providing a way to style parts of the content without additional markup. However, they cannot be used with self-closing tags such as <img>, because these tags do not permit additional content to be attached as they do not have a closing tag to attach content before or after .

Pseudo-classes in CSS focus on the interaction with the user and the state of elements, such as :hover, :active, and :focus. Their order is crucial because CSS applies styles in a specific order (from top to bottom). For example, if :hover is placed after :active, it would override :active whenever an element is hovered, potentially causing unexpected user experiences. Correct ordering, such as 'Default link', 'Visited', 'Hover', and 'Active', ensures a consistent experience that aligns with user expectations and interactions .

Using the CSS float property can cause the parent element to collapse, resulting in a height of 0px, as floated elements are taken out of the normal document flow. This issue can be resolved by using a 'clearfix' strategy or setting 'display: flow-root' on the parent element to ensure it expands properly to contain its floated children .

Elements with 'position: absolute' are removed from the normal document flow and positioned relative to the nearest positioned ancestor. Without a clear relative parent, absolute positioning might cause layout issues, such as overlapping content or incorrect placement. To resolve this, it's essential to correctly set the parent element with 'position: relative', ensuring the child elements adjust based on that container .

Setting a line height as unitless ensures that it scales proportionally with the font size, maintaining consistent vertical spacing regardless of text size. This allows the line height to automatically adjust to different fonts and text sizes, ensuring readability and a clean layout across various devices and contexts, making it a best practice for responsive designs .

Using <ul> tags for carousels and navigation bars contributes to semantic clarity and accessibility. It defines a clear, hierarchical structure that is easy for browsers and assistive technologies to navigate. This structure aids in organizing slides or links in an orderly manner, which aligns with web standards and improves the user experience by enhancing the logical flow and readability of the content .

Semantic HTML tags enhance accessibility by providing meaningful names that assistive technologies, such as screen readers, can use to understand the structure of the webpage. They also improve SEO by helping search engines understand the content hierarchy. Examples of semantic tags include <nav> for wrapping navigation links, <article> for self-contained content pieces, and <aside> for sidebar content. These tags provide context and can improve the user experience and search visibility .

You might also like