Research

Problem Solving

What are the best practices associated with using classes vs. ids?

Classes and ids are all selectors that is used in CSS (Cascading Style Sheets)

Seletors allows you to taget specific elements on a web page that you can apply styles to.

The ID selector is the "the King of all the selector", which mean it will overiders other selectors

so the best practices is to define style rules that apply to a single element on the web page

A class selector allows you to define style rules that apply to any element with a class attribute equal to a certain value.

How do you apply classes and ids in HTML and css

ID selectors are defined using a hash sign. They are immediately followed by the ID value that you want to apply a set of style rules to. Here is an example of the ID selector in action:

blog-pic blog-pic

This style applies to the p element in our HTML document with the ID "email . The style will set the color of the text in the element to black and potition to center, the font size to 10px

Class selectors are defined using a period, followed by the value of the class that you want to apply a set of styles to. Here’s an example of the class selector in action:

blog-pic blog-pic>

This style sets the background color of our div tag to lightgreen.

Technical Blog - sprint 3

  1. An analogy to describe JavaScript and its relationship to HTML and CSS.
  2. it like a house. HTMl is the structure of the house. CSS is the decoration of house. JavaScript will be the furniture and electricity of the house which make the house more livable

  3. Explain control flow and loops using an example process from everyday life, for example, 'waking up' or 'brushing your teeth' (but not those).
  4. Control flow is like driving a car. Frist, you need to have a car and start the engine, then driving. The loop is like the repetition of the "driving process"

  5. Describe what the DOM is and an example of how you might interact with it.
  6. The DOM is document as nodes and object. you can just use "document.getElement" to obtaine and motify the element thru JavaScript

  7. Evaluate your limitations in terms of your learning and career development. How might these affect your learning journey?
  8. I tend to focus too much on the details, which means I sometimes get curious and distracted by a little thing of a project – In my uni life, sometimes I can end up spending one or two hours reading something that’s only very slightly relevant to the project.

  9. Explain the difference between accessing data from arrays and objects.
  10. Arry is list of data and stored in Order. Object contains multiple values in a single variable.

  11. Explain what functions are and why they are helpful
  12. Functions is like different furniture in a house which performs a particular task.

Go Back