2026-08-13 16:47
Status:
Tags: IBM IBM Full Stack Software Developer Professional Certificate Front End Web Development CSS HTML Programming Lanuages
IBM - IHCJ - Module 2 - CSS Overview & HTML5 Elements
==CSS Overview and HTML 5 Elements
-
HTML 5 tags and Structural Elements:
-
-
-
Generally the tags for HTML are pretty self descriptive, things like
<audio>generally are used to embed sound content and what not, and<canvas>is used for graphical content and other such general items -
There are a lot, and a lot are presented in in the above 2 tables, however there are more that are also not covered in there as well
-
There are also comments which are used to annotate the code
-
HTML 5 Structural elements generally, HTML uses division-based page layouts, so basically it is a natural division or
divthat is generally nested within of itself, and consists of the different elements on the page, like a div for the title, adivfor a selected tabs option, and adivfor an image area -
Generally, you use a
<div>tag to lay out the page and then use css and other such items in order to lay out what you would like nested into it, like other html elements -
The element generally is semantic meaning that it describes the function or the type of data that is contained within
-
There are other types rather than a plan
<div> or <span>:<article>- Represents a block of code that can logically stand alone
- Examples would include things like a newspaper article, user comments, blog entries, etc
- Often used in tandem with
<time pubdate>attribute as a means to provide publication date for the article
<section>- Represents a logical separation in a document, for example, chapters of a book
- Generally accompanied with a heading
<header>- Defines the header information for a page
- Used for a section table of contents or to wrap navigational links or logos
<footer>- Defines the text at the bottom of the page
- Used for copyright information or other forward links and contact information
-
-
The above-hand is a example with structural elements in HTML, featuring a header, div, and footer
-
-
Elements for grouping contents
<aside>- Provides additional information that is related to the main discussion
- Extracts and displays further content or navigates to additional resources without detracting from the main discussion
- Used for caution, notes, or to wrap navigational links
<figure>- A self-contained element referred to from the main content
- Might do things like embed graphics, photographs or code segments
- Can be moved to an appendix without affect the flow of the document
<figurecaption>- Defines the caption for the contents of the
<figure>element
- Defines the caption for the contents of the
-
-
HTML 5 Input Element: Attributes for the Input Tag:
<input type = "color">is basically a kind of attribute that would showcase a different type of input from the user, and there are many other input types as well, likepassword, text, dateand more.- Generally, an input bar is only a type-able box, but it might have a different look with something like color or date.
- The above-hand is a showcase of what the color type might look like
- Also, depending on the input type, the user might be bared from inputting specific information, for example, no ascii characters in a date input format
- An interesting one to also mention is the input attribute list, which generally showcases a list inside of the input attribute with pre-defined options, though the user is not limited to said pre-defined options
- This provides good functionality for auto-completion
- The
<input type="email" placehold="example#gmail.com">or placeholder attribute is used to specify the text that would appear as sort of grey like and not filled inside of the input box or field, and generally is used to showcase or guide the end user on what to input in said field. - It can also have it’s own styling as well
- the
<input type="email" requiredshowcases that the actual field needs to be filled out and cannot just be plainly submitted, useful for getting information basically
-
Addition HTML Elements: HTML Field-set and Legend Tag:
- See Common HTML Elements for the general contents and gist of this section
-
CSS: Styling HTML:
-
See Common CSS Elements for generally hopefully a bit more information
-
By using HTML, CSS, and Javascript, developers can create flexible web pages that display correctly on both mobile and desktop
-
These technologies have powerful features that can be used to show flexible in page adjustment to elements without the need for plug-in technologies, like flash
-
CSS (Cascading Style Sheets) is the design that is layered over the top of an HTML Web page
-
It is an overlay onto the HTML web-page that generally describes the way in which HTML elements are displayed
-
It creates a uniform look throughout each element of each page of the website
-
Generally child and descendant elements often inherit styles that are defined for parent elements
-
So basically if you have a style for a given item, the child items of that element would share in the same styling, so like a
flexboxstyling might generally also be passed down to the nested elements -
CSS Design and Coding
- Important Concept to seperate data from design
- The Data is sent to the browser using HTML, and the design of how the HTML looks is applied to that given data using CSS
- This allows for people to render a web-page without design using special accessibility needs (basically for disabled people)
- Allows for machines to index a website without design interference (so web-scraping bots really)
- CSS can also be coded as a
styleattribute inside of an HTML tag, a head of a section of a document, or as an external document, usuallystyle.cssbut can obviously be categorized more broadly as well
- Important Concept to seperate data from design
-
CSS controls a document’s appearance and specifies style rules for the following web page elements (see Common CSS Elements for more reference)
- Fonts
- Text
- Colors
- Backgrounds
- Sizes
- Boarders
- Spacing
- Positioning
- Visual Effects
- Tables
- Lists
-
-
CSS Format is displayed in the image above, as well as things like class names or just single ID elements too, with each given either a
#id, .classname, htmlTagNameformat -
Generally you want to start with establishing a base style, which would be defining the body of the document, and hence things like the background color, the margin, standard padding, etc, common example below:
-
-
Which is basically just a black text color and white background color that generally takes up the entirety of the web browsing page and has a large font size and
sans-seriffont -
Guideline for base styles
-
Colors are generally capable of being specified in RGB, RGBA, or hexadecimal format, with also some base colors built in, so a simple
whitesometimes works as well (vscode lets you use a color picker too) -
For size, use pixels or
px, an emphasisem, or a percentage%of the avaliable window screen. There are also things likehv & wvwhich basically are viewport units and specify the total amount (generally in percent) of the entire body document size in the browser -
Text can be aligned left, right, or center, which floats too can be left or right
-
Vertical Alignments must be top, middle, or bottom
-
Fonts can be any specific font or font-family, such as serif, sans-serif, or mono-space, or even a given downloadable font for whatever customization you want
-
-
You must choose a given layout whenever you are creating your website, and must choose between a dynamic / fluid or a static view of your website, although I do suppose in some cases you can just have both
-
In a fluid layout the height and width of elements are flexible and generally are able to adjust in size to the screen space, which is good for things like mobile devices. You generally use percentages, viewports, and emphasis for these
-
In a fixed layout you generally sspecify the height of width and elements using pixels so they are constant no matter the screen space, this can be good for maintaining overall structure to the website and keeping things in the same ratio to each other, but makes it less dynamic.
-
Applying CSS to HTML
- Incline CSS
- Used for a single HTML element and is written inside of the HTML tag generally
- Can get VERY messy very quickly
- Internal CSS
- Used for a single page, but it “dirties” the page with none-html code, which makes it harder to use in practice because you basically have 2 programming languages in one doc.
- It is usually defined in the header, which can also get messy, and might increase load time
- External CSS
- Used to style an entire website or different pages because you can link it to every single page
- It provides a single document in which you write all of your CSS code and then you link it over inside of the HTML code
- Incline CSS
-
-
CSS Frameworks:
-
Overview of CSS Frameworks
- Provide a foundation to build code
- Provide tools needed to create a basic user interface (UI)
- Which makes it easier to implement visual elements on a web-page, elements such as navigation bars, forms, and grids
- Can help you also create a responsive and dynamic website which works generally on any screen size
-
A framework must be used from the creation of your project, and define your project architecture, so generally, you cannot switch one after deciding to use one without refactoring your entire code base, so it is important to choose one correctly
-
Types of CSS Frameworks Displayed:
-
-
Plain CSS is like what would be in Common CSS Elements and basically means you need to hand style everything but also gives you the most freedom when styling
-
Then you have something like CSS - Frameworks & Spin-Offs which generally come in either Utility-First Frameworks like tailwind or Component Frameworks like Bootstrap
-
Generally, a utility-first framework simplifies out references to CSS properties, allowing them to be written in HTML docs without the verbose overload of regular CSS, think like shorthand for css, lets you do more with less
-
A Component-Based framework provides you generally with pre-styled components and templates which are easy to add and basically gives you some pre-built styling, but does limit you if you want creative freedom in custom styles because you might need to fight pre-built styles
-
-
In the image is displayed the advantages and disadvantages of a utility first framework like tailwind
-
Tailwind CSS- basically packed with classes that are used directly in the markup to build designs
- For example, say you want to tell a link is dangerous by making it red, and dark red and hovered over, in vanilla css that is two separate “functions” of code
- But with tailwind, it can very easily be done within of the class attribute by specifying the inline style using the shorthand
-
-
Basically, you can set something like a flag, and that
mdtag standards for a medium size, and so, the given modification would only be applied when the screen is that given size, allowing for more dynamic application of modification- Advantages of Component Frameworks
- Basically give you templates and pre-styled items which reduces the time you need to develop something and lets you basically use commonly used items already, but restricts your freedom and might have to fight you on custom styling options
-
Bootstrap helps to build fast, responsive sites with it’s feature-packed front-end toolkit
- For the same example red link from above, you need to have the two separate functions and everything basically
- However it is much easier in boot strap as you can generally just add it in using an inline
danger-linkclass (why does that exist?!?!?)
-
Bootstrap also provides individual HTML components and even templates ranging from ENTIRE website to a simple sign-in-page
-
It generally saves time designing webpages and helps with styles consistency
-
Limited knowledge is needed to use the basic features, but in that case it also has a limited number of components as well, so it might not have everything you need it to have
-
-
Advanced CSS Properties:
- CSS - Frameworks & Spin-Offs for generally more concepts on how to use and apply these frameworks
==Summary
- CSS creates a uniform look throughout each element of each page of the website.
- CSS is usually coded in external style sheets and creates base styles for a website.
- CSS frameworks assists in implementing UI elements and creating dynamic web pages.
- CSS has two types of frameworks:
- Utility-first frameworks, which provide utility classes to help in building one’s own styles and layouts.
- Component frameworks, which provide a wide selection of pre-styled components and templates that can be implemented onto a website.
- Plain (Vanilla) CSS lets developers write the styles and layouts of a website.
- HTML5 elements provide structure and function to websites.
- HTML 5 uses the tag to allow users to input information.
==Glossary
| Term | Definition |
|---|---|
| Component Framework | Component frameworks provide pre-styled components and templates which are easy to add to any website. |
| CSS | ”Cascading Style Sheet”s is a style sheet language that describes how HTML elements are displayed. It is the design that is layered over the top of an HTML web page. |
| Fixed Layout | A fixed layout is a layout where you specify the height and width of elements, and those values remain the same regardless of which operating system or browser you use to access the website. |
| Fluid Layout | A fluid layout is a layout in which the height and width of elements is flexible and can expand or contract based on the browser window, the operating system, and other user preferences. |
| Utility Framework | The utility framework provides utility classes that are scoped to individual CSS properties, which helps in building custom designs in HTML files. |













