Skip to content

Instantly share code, notes, and snippets.

@marko-jankovic
Last active March 5, 2025 16:48
Show Gist options
  • Save marko-jankovic/22ad55fae467e72d0312 to your computer and use it in GitHub Desktop.
Save marko-jankovic/22ad55fae467e72d0312 to your computer and use it in GitHub Desktop.
CSS and HTML interview questions

1. HTML Fundamentals

HTML Structure and Semantics

  • What is HTML?
    HTML (Hypertext Markup Language) is the standard language used to create and design documents on the web. It structures content using elements or tags.

  • What are the building blocks of HTML5?
    The building blocks of HTML5 include elements like <header>, <footer>, <section>, <article>, and <nav> which enhance semantic meaning and accessibility.

  • What is the purpose of the <main> element in HTML?
    The <main> element represents the dominant content of the <body>, excluding headers, footers, and sidebars, making it easier for browsers and assistive technologies to find the primary content.

  • What is a favicon and where are favicons displayed?
    A favicon is a small icon associated with a web page, shown in the browser tab, bookmarks, and history lists to help users identify the site visually.

  • Are HTML5 tags case-sensitive?
    No, HTML5 tags are not case-sensitive. <Div> and <div> are treated the same.

  • Why must the ID attribute be unique on each page?
    The ID attribute must be unique to avoid conflicts in styling and scripting. It allows specific elements to be targeted without ambiguity.

HTML Elements and Attributes

  • What is an iframe and how does it work?
    An iframe (inline frame) is an HTML document embedded within another HTML document. It allows the inclusion of external content, such as videos or other web pages.

  • Why would you use a srcset attribute in an image tag?
    The srcset attribute allows browsers to select the appropriate image source based on the display size and resolution, optimizing loading for various devices.

  • Why does invalid HTML still work?
    Browsers are built to be forgiving and will attempt to render web pages even when the HTML is not perfectly structured. They often correct errors to display content.

  • What is the difference between <span> and <div>?
    <span> is an inline element used to apply styling within text, while <div> is a block element used to group larger sections of the document for layout purposes.

  • What is a blockquote in HTML?
    A blockquote is used to indicate a section of quoted text from another source, typically displayed as an indented block.

  • What is a meta tag?
    Meta tags provide metadata about the HTML document, including character set, description, keywords, and author. They are not displayed on the page but are crucial for SEO.

Semantic HTML and Accessibility

  • Define semantic markup.
    Semantic markup uses HTML tags that convey meaning about the content, improving accessibility and SEO. For instance, <header> clearly indicates a header section.

  • What is the purpose of the <main> element in HTML?
    The <main> element identifies the main content area of a document, enhancing accessibility and helping search engines understand the layout.

  • When should you use <section>, <div>, or <article>?
    Use <section> for thematic grouping, <div> for generic sections without semantic meaning, and <article> for independent content that can be distributed or reused.

  • What is the difference between <i> and <em>?
    <i> represents text that is styled differently (like italics) without emphasis, while <em> conveys emphasis and typically renders as italic text. Screen readers recognize <em> as emphasized content.

  • Why is it important to use HTML5 semantic tags?
    Semantic tags improve accessibility, SEO, and readability for both users and search engines by providing meaningful context about the structure of the content.

  • What are semantic and non-semantic elements?
    Semantic elements clearly describe their meaning (e.g., <header>, <footer>), while non-semantic elements (like <div> and <span>) do not provide any specific meaning.

HTML Tags and Browser Compatibility

Compatibility Concepts and Tag Purpose

  • What is browser compatibility?
    Browser compatibility refers to the ability of web pages to function correctly across various web browsers, ensuring consistent user experience.

  • What is feature detection (vs browser detection)?
    Feature detection checks if a browser supports specific features (using methods like Modernizr), while browser detection identifies the browser type. The former is more reliable for maintaining functionality.

  • What is an iframe and how does it work?
    An iframe is an HTML document embedded within another HTML document, allowing the inclusion of external content seamlessly.

HTML Tags

  • Tell what each of these tags does, if there are alternatives, which are preferable, and why?
    • <em>: Indicates emphasized text, screen readers convey this as emphasis.
    • <b>: Renders text in bold but carries no semantic meaning.
    • <abbr>: Represents an abbreviation or acronym, typically with a title attribute for expansion.
    • <nav>: Defines a navigation section for links.
    • <i>: Represents text in a different voice or mood, shown in italics but without emphasis.
    • <j>: Not a standard HTML tag.
    • <link>: Specifies relationships between the document and external resources, often used for stylesheets.
    • <strong>: Indicates strong importance, typically rendered in bold.
    • <article>: Represents a self-contained composition that can be independently distributed.

2. CSS Concepts

Introduction to CSS

  • What is CSS?
    CSS (Cascading Style Sheets) is used to style and layout web pages, controlling the presentation and appearance of HTML elements.

  • What is the purpose of stylesheets?
    Stylesheets define how HTML elements should be displayed, providing a separation between content (HTML) and presentation (CSS).

  • Where can styles be defined? How can you integrate or import CSS on a web page?
    Styles can be defined inline, within a <style> tag in the <head>, or in external stylesheets linked through the <link> tag.

  • What is a property in CSS?
    A property is a specific aspect of a style that can be applied to an HTML element, such as color, font-size, or margin.

  • What is a selector in CSS?
    A selector is a pattern used to select the elements you want to style (e.g., class selectors, ID selectors, or element selectors).

CSS Syntax and Structure

  • What is a declaration?
    A declaration is a CSS rule that includes a property and a value, formatted as property: value;.

  • What is a declaration block?
    A declaration block is a set of declarations enclosed in curly braces {} and is part of a CSS rule-set.

  • What is an At-Rule?
    At-rules are special rules that provide instructions or conditions (e.g., @media, @import).

  • What is a rule set?
    A rule set is a complete CSS statement that describes how elements should be styled, comprising a selector and a declaration block.

  • What is a combinator selector?
    A combinator selector selects elements based on the relationship between other elements in the HTML document (e.g., descendant, child, adjacent).

  • What is a universal selector?
    The universal selector (*) selects every element on the page and is often used for resetting styles.

  • How can comments be added in CSS?
    Comments in CSS can be added using /* comment here */.

CSS Properties and Values

  • What is the CSS box model and what are its elements?
    The box model describes how elements are structured on a web page. It includes content, padding, border, and margin.

  • Explain CSS sprites and how you would implement them on a page or site. What are possible alternatives to sprites?
    CSS sprites combine multiple images into a single image file to reduce HTTP requests. Positioning is done using the background property. Alternatives include using individual image files or CSS background-size.

  • What are the benefits of CSS sprites?
    Benefits include improved load times due to fewer HTTP requests and reduced file sizes for images through optimization.

  • What is the float property and how does it function?
    The float property allows elements to be positioned left or right, enabling text and inline elements to wrap around them.

  • How can you clear the sides of a floating element?
    You can use the clear property on the next element to prevent it from wrapping around the floated element, specifying clear: both; for clearing both sides.

  • What is tweening in CSS?
    Tweening refers to creating smooth transitions between styles during animations, often defined in keyframe animations.

  • What values (units) can be used for width in CSS?
    Width can be defined using percentages, px (pixels), em, rem, vw (viewport width), and other CSS units.

  • How can the gap under the image be removed?
    The gap can be removed by setting vertical alignment to bottom, adjusting margins, or using display: block; on the image element.

Selectors and Specificity

CSS Selectors

  • What are counters in CSS3?
    Counters are CSS properties used to manage and create numbered lists, allowing for custom counting in content.

  • How do you hide an element in CSS?
    An element can be hidden using display: none;, visibility: hidden;, or positioning it off-screen.

  • Are CSS rule names case-sensitive?
    CSS rule names (classes and IDs) are case-sensitive.

  • How do multiple class or ID and class selectors work?
    Multiple selectors can be combined to target elements with both classes or IDs, e.g., .class1.class2, which applies styles to elements with both classes.

  • Why do CSS selectors mixed with different cases (uppercase and lowercase) not apply the styles?
    CSS does not apply styles when the cases do not match due to its case sensitivity for class and ID selectors.

  • List CSS selectors and their priorities.
    CSS types include: inline styles (highest priority), IDs, classes, attributes, and tag selectors (lowest priority).

Visibility and Layout Techniques

  • Does margin-top or margin-bottom have an effect on an inline element?
    Yes, margin-top and margin-bottom can create vertical spacing between inline elements.

  • Does padding-top or padding-bottom have an effect on an inline element?
    Padding does not affect the vertical spacing of inline elements, but it increases the clickable area.

  • Which unit would you prefer among px, em, % or pt, and why?
    Prefer em or % for responsive designs, as they adapt better to varying screen sizes compared to fixed units like pixels.

  • Does padding-left, padding-right, margin-left, or margin-right have an effect on an inline element?
    Yes, they can impact spacing between inline elements, depending on the context.

  • If you have an element with font-size: 10rem, will the text be responsive when the user resizes or drags the browser window?
    Yes, because rem units are relative to the root font size, which changes with viewport settings.

5. Rendering and Positioning

  • What is reflow in the context of CSS?
    Reflow is the process by which the browser recalculates the position and dimensions of elements when a change occurs in the DOM or CSS.

  • How does z-index relate to positioning? Describe z-index and how stacking context is formed.
    Z-index controls the vertical stacking of positioned elements. A new stacking context is created when an element is positioned and has a z-index value other than auto.

  • What is the purpose of the z-index and how is it used?
    The z-index determines the stacking order of overlapping elements, allowing content with higher z-index values to appear on top.

  • How do absolute, relative, fixed, and static positioning work?

    • Absolute: Positioned relative to the nearest positioned ancestor.
    • Relative: Positioned relative to its original location in the document flow.
    • Fixed: Positioned relative to the viewport and does not scroll with the page.
    • Static: Default positioning; elements appear in the order they are defined in the document.
  • How does an element with absolute positioning behave if it is inside a fixed or relative element?
    It will position itself relative to the nearest ancestor that is not statically positioned.

  • What are the pros and cons of using absolute positioning?
    Pros: Precise control over placement; Cons: Can cause overlap and is removed from the document flow, affecting layout.

  • What is the difference between block, inline, and inline-block elements?
    Block: Takes full width; Inline: Takes only necessary width and does not start on a new line; Inline-block: Similar to inline but allows width and height.

  • Discuss the position property and its various values.
    Values include static, relative, absolute, fixed, and sticky. Each value defines how an element is placed in relation to its normal flow and its context.

6. Advanced Techniques

  • Describe pseudo-elements and pseudo-classes and discuss their use.
    Pseudo-elements target specific parts of an element (e.g., ::before, ::after), while pseudo-classes select elements based on their state (e.g., :hover, :focus).

  • How do you center-align a paragraph in CSS?
    Use text-align: center; on the containing element.

  • How do you center-align a div inside another div?
    Use margin auto with a defined width: margin: auto; on the inner div.

  • How do you create a two-column or three-column web page?
    Use CSS Flexbox or CSS Grid properties to distribute columns evenly.

  • How do you draw a triangle, circle, or a colored square using CSS?
    Use borders to create triangles; use border-radius for circles; and define width and height for squares.

  • How do you create a tab view using CSS?
    Use a combination of Flexbox for layout and JavaScript for functionality to switch between tabs.

  • How do you define multiple background images through CSS?
    Use comma-separated values in the background-image property.

  • Explain the meaning of each of these CSS units for expressing length: cm, em, in, mm, pc, pt, px.

    • cm: Centimeters, em: Relative to font-size, in: Inches, mm: Millimeters, pc: Picas, pt: Points, px: Pixels.

7. CSS Frameworks and Preprocessors

  • What existing CSS frameworks have you used either locally or in production? How would you change or improve them?
    Answer based on personal experience with frameworks like Bootstrap or Tailwind CSS and any insights on enhancements.

  • What are CSS frameworks, and which ones have you used?
    CSS frameworks are pre-prepared libraries that help in designing web pages quickly (e.g., Bootstrap, Foundation).

  • What preprocessors do you use?
    Mention any CSS preprocessors like Sass, LESS, or Stylus.

  • What is a CSS preprocessor, and why would you use one?
    It’s a scripting language that extends CSS with variables, nesting, and functions making stylesheets more maintainable.

  • What are the reasons for using a CSS preprocessor?
    Improved organization, code reusability, and the ability to use logical functions in styles.

  • What are the advantages and disadvantages of using CSS preprocessors?
    Advantages: Code organization and DRY principles; Disadvantages: Learning curve and additional compilation step.

  • What preprocessor do you prefer (Sass, LESS, Stylus) and why do people use them?
    Share a preference and discuss the reasons for it, such as community support and features.

  • What did you like and dislike about the CSS preprocessors you have used?
    Provide a balanced view based on personal experiences.

8. Responsive Design and Media Queries

  • Have you ever used a grid system? If so, what do you prefer, and explain how it works?
    Discuss experiences with CSS Grid or frameworks.

  • Have you implemented media queries or mobile-specific layouts/CSS?
    Share specific instances of using media queries to adapt layouts.

  • How would you apply CSS rules specific to a media query?
    Use @media rules to write styles that only apply under certain conditions (e.g., screen width).

  • What is the purpose of @media only screen?
    It applies styles only to screen devices, filtering styles by type.

  • Can you name the four types of @media properties?
    Width, height, orientation, and resolution.

  • Does the screen keyword apply to the device's physical screen or the browser's viewport?
    It refers to the browser's viewport on devices.

  • Are you familiar with styling SVG?
    Yes, SVG can be styled with CSS similar to HTML elements.

  • Can you give an example of an @media property other than screen?
    An example is @media print for styles specific to printed documents.

9. Browser Behavior and Best Practices

  • How does CSS actually work under the hood of a browser?
    CSS is parsed and applied to HTML elements, creating the rendered styles as part of the rendering pipeline.

  • What is the purpose of the box-sizing property, and what are its possible values?
    box-sizing controls how width and height of elements are calculated, with values like content-box and border-box.

  • What libraries and tools do you use in your CSS work?
    Mention tools and libraries like Bootstrap, Tailwind, or preprocessors such as SASS or LESS.

  • What are the different ways to visually hide content, making it available only for screen readers?
    Techniques include using visibility: hidden alongside position: absolute, and off-screen positioning.

  • How do you create a zebra-striped table with CSS?
    Use nth-child selectors to alternate row colors.

  • What is the difference between RGBa and HSLa, and when would you use one versus the other?
    RGBa provides color transparency through an alpha channel; HSLa allows color selection via hue, saturation, lightness, and transparency.

10. CSS Techniques and Clearing

  • What is the difference between resetting and normalizing CSS? Which would you choose and why?
    Resetting removes default browser styles, while normalizing maintains a consistent appearance across browsers. Normalizing is generally preferred for its balanced approach.

  • Describe floats and how they work in CSS.
    Floats allow elements to be taken out of the normal flow and floated to the left or right, allowing inline content to wrap around them.

  • What are various clearing techniques, and which is appropriate for what context?
    Techniques include using the clearfix method, setting overflow on the container, or using the clear property on elements below floated items.

  • What image replacement techniques do you favor, and when do you use them?
    Use techniques like CSS background images for icons or images set via content for accessibility.

  • Does overflow: hidden create a new block formatting context?
    Yes, it does, allowing for better control over floated children.

  • How do you approach fixing browser-specific styling issues?
    By using conditional comments or specific CSS hacks and testing across devices.

  • What techniques do you use for building websites?
    Component-based design, responsive frameworks, and version control for collaboration.

  • How do you serve your pages for feature-constrained browsers?
    Implement graceful degradation or progressive enhancement strategies.

  • What are your favorite image replacement techniques, and when do you use them?
    Favoring methods like CSS sprites or using SVG for scalability.

Box Model and Display Properties

  • Explain your understanding of the box model and how you would instruct the browser in CSS to render your layout with different box models.
    The box model includes content, padding, border, and margin. Use the box-sizing property to define how these are calculated.

  • List as many values for the display property that you can remember.
    Values include block, inline, inline-block, flex, grid, none.

  • How is priority determined in assigning styles with CSS?
    Priority is determined by specificity, importance (with !important), and source order.

  • Can you explain the differences between em, rem, and px units?
    px is a fixed unit, em is relative to the font size of the element, and rem is relative to the root font size, offering better consistency across pages.

  • What are the most common browsers and devices you have tested?
    Chrome, Firefox, Safari, Edge, and popular mobile devices.

  • Have you explored the new CSS Flexbox or Grid specifications?
    Yes, both provide advanced layout capabilities and ease in creating responsive designs.

  • How is responsive design different from adaptive design? What is responsive design?
    Responsive design adjusts fluidly to different screen sizes, while adaptive design uses fixed layouts for specific screen sizes.

  • What is an aspect ratio?
    The aspect ratio defines the relationship between the width and height of an element, commonly expressed as width:height.

  • Have you worked with retina graphics? If so, when and what techniques did you use?
    Yes, using higher-resolution images (2x) and srcset to serve appropriate images based on device resolution.

  • Is there any reason you'd want to use translate() instead of absolute positioning? Why or why not?
    Yes, translate() can achieve smoother animations and maintain document flow, whereas absolute positioning takes elements out of normal flow.

  • Do you subscribe to any specific CSS structure such as SMACSS or OOCSS?
    Yes, adhering to OOCSS can enhance modularity and reusability in CSS.

Optimization and Performance

  • How would you improve the performance of your CSS files?
    Minification, removing unused styles, optimizing images, and using CSS preprocessors to manage complexity.

  • What are the best practices to enhance website accessibility?
    Use semantic HTML, provide alt text for images, ensure keyboard navigability, and maintain sufficient color contrast.


2. Web Development Concepts

1. Website Optimization and Performance

  • Describe your experience with website optimization.
    I have worked on optimizing website performance by reducing load times through techniques such as image compression, minifying CSS and JavaScript files, and utilizing browser caching. I also implement lazy loading for images and resources to improve initial load speed.

  • How do you handle form validation in web applications?
    I use a combination of client-side validation (using HTML attributes like required and JavaScript for dynamic checking) and server-side validation to ensure data integrity. This dual approach helps provide immediate feedback to users while also protecting against malicious inputs.

  • What is a viewport in web design?
    The viewport is the user's visible area of a web page. It is crucial in responsive design; using the viewport meta tag allows developers to control the layout on mobile browsers, ensuring proper scaling and rendering of content.

  • What do you think of hacks in CSS? When should they be used in your code and when should they be avoided?
    CSS hacks can provide quick fixes for browser-specific issues, but they should be used sparingly. Relying on hacks can lead to maintenance challenges and inconsistencies. I prefer using feature detection and progressive enhancement to handle cross-browser compatibility instead.

  • What are the advantages of client-side rendering versus server-side rendering? If you were building a site, which would you choose and why?
    Client-side rendering (CSR) provides a more dynamic user experience and faster navigation after the initial load, as it offloads rendering work to the client. However, server-side rendering (SSR) can improve initial load time and is better for SEO. I would choose SSR for content-heavy sites requiring SEO optimization, while CSR can be ideal for highly interactive applications.

  • How do you test the performance of your code and/or web pages?
    I use tools like Google PageSpeed Insights, GTmetrix, and DevTools in browsers to analyze performance metrics such as load times, resource sizes, and blocking scripts. I also implement real-user monitoring for continuous performance evaluation.

  • What are some rules for writing efficient CSS?
    Some rules include avoiding redundant styles, using shorthand properties, grouping common styles, and minimizing the use of complex selectors. It's also beneficial to load CSS files conditionally and keep them in external stylesheets.

  • What are some considerations in selecting font sizes?
    Factors include readability, hierarchy, accessibility (ensuring appropriate contrast), and responsiveness. I typically use relative units (like em or rem) for better scalability across devices.

  • What experience do you have with developing accessible websites?
    I focus on ensuring text alternatives for images, using proper heading structures, ensuring keyboard navigability, and testing with screen readers. I also follow WCAG guidelines to create inclusive web experiences.

  • How do you approach developing an accessible website?
    My approach includes conducting accessibility audits, implementing semantic HTML, utilizing ARIA roles where necessary, and engaging users with disabilities for feedback during the development process.

  • What are some of the common accessibility pitfalls when developing a website? How would you go about fixing them?
    Common pitfalls include poor contrast ratios, missing alt text for images, and lack of keyboard navigation. I fix these by using accessibility checklists, tools to evaluate contrast, and thorough testing with screen readers.

  • How would you optimize a website's assets/resources?
    Asset optimization includes compressing images, using SVGs where applicable, minifying CSS and JavaScript files, and employing lazy loading for off-screen content to reduce initial load times.

  • How is the browser rendering engine structured and how does it work?
    The rendering engine typically consists of a parser that processes HTML and CSS, a DOM (Document Object Model) tree that represents the structure of the page and a render tree that combines styles and creates a pixel display on the screen.

  • Can you explain the difference between GET and POST requests in web development?
    GET requests are used to retrieve data and append it to the URL (visible and cached), whereas POST requests send data to the server and are used for submitting forms; they are not visible in the URL and are generally considered more secure for sensitive data.

  • What is the DOM? How does the DOM work?
    The DOM (Document Object Model) is a programming interface for HTML and XML documents. It represents the document as a tree structure, allowing scripts to update the content, structure, and style dynamically.

  • What is the Same Origin Policy?
    The Same Origin Policy is a security measure that prevents scripts on one origin from accessing data on another origin. This protects user data and mitigates cross-site scripting attacks.

  • Compare browsers like Chrome, Firefox, Internet Explorer, and Safari in terms of rendering engines.
    Chrome uses Blink, Firefox uses Gecko, Safari uses WebKit, while Internet Explorer has its own proprietary engine. Each engine has unique features and performance characteristics affecting how websites are rendered and executed.


2. Testing and Compatibility

  • What tools do you use to test your code's performance?
    I utilize various tools to test code performance, including Google PageSpeed Insights for website loading speed and optimization suggestions, GTmetrix for detailed performance reports, and Chrome DevTools to analyze network activity, rendering times, and JavaScript execution. Additionally, I use Lighthouse for auditing performance, accessibility, and SEO.

  • How many resources can a browser download from a single domain at one time?
    Browsers typically allow a limited number of simultaneous connections to a single domain. Most modern browsers adhere to the HTTP/1.1 specification, which permits about six concurrent connections per domain. However, in HTTP/2, multiple resources can be sent over a single connection, improving performance.

  • How do you ensure cross-browser compatibility in your projects?
    To ensure cross-browser compatibility, I adopt a combination of strategies:

    • Use of feature detection tools such as Modernizr to handle missing features in various browsers.
    • Styling with CSS prefixes to account for browser-specific implementation differences.
    • Regular testing across multiple browsers (Chrome, Firefox, Safari, Edge) and devices to identify issues early in the development process.
    • Utilizing CSS stylesheets and JavaScript libraries that are known to be compatible with all major browsers.
    • Maintaining a focus on semantic HTML, which improves the robustness and compatibility of the markup.

3. Accessibility and Usability

  • What is Flash of Unstyled Content (FOUC)? How do you avoid it?
    FOUC occurs when a web page briefly displays unstyled content before CSS is loaded. To avoid this, you can inline critical CSS within the <head> of the document or use the preload link for stylesheets to ensure they load before rendering.

  • What is Flash of Unstyled Text (FOUT)? How do you avoid it?
    FOUT happens when text appears in a fallback font before the intended web font is loaded. You can prevent FOUT by using the font-display property in CSS with values like swap, which uses a fallback font until the web font has loaded.

  • Explain ARIA and screen readers, and how to make a website accessible.
    ARIA (Accessible Rich Internet Applications) provides additional semantic meaning to web content for users utilizing assistive technologies like screen readers. To make a website accessible, ensure proper use of ARIA attributes, provide alt text for images, maintain keyboard navigability, and structure HTML logically.

  • What is the purpose of the alt attribute on images in HTML?
    The alt attribute provides a text alternative for images, which is critical for screen readers and enhances SEO. It helps users who cannot see the image understand its content or function.

  • Discuss some pros and cons of CSS animations versus JavaScript animations.
    Pros of CSS animations: Generally smoother and more performant, easier to implement, and automatically handled by the browser's rendering engine. Cons: Limited in interactivity and complex animation sequences.
    Pros of JavaScript animations: More control and flexibility for complex animations and interactions. Cons: Can be less performant and more difficult to implement compared to CSS animations.

  • What does CORS stand for and what issue does it address?
    CORS stands for Cross-Origin Resource Sharing. It is a security feature implemented in browsers that allows or restricts web applications from making requests to a different domain than the one that served the web page, thus protecting users from malicious activities.

  • How would you create a simple slideshow page in HTML/CSS?
    A simple slideshow can be created using <div> containers for each slide and applying CSS for positioning, alongside JavaScript for transitions between the slides, allowing users to navigate through them via buttons or automatic intervals.

  • What is your favorite feature of Internet Explorer?
    My favorite feature of Internet Explorer is its built-in Developer Tools, which allow debugging and inspection of web pages, though I generally prefer more modern browsers like Edge or Chrome.

  • What UI, security, performance, SEO, maintainability, or technology considerations do you make when building a web application or site?
    I prioritize a clean and intuitive UI for user experience, implement security best practices (like sanitizing user input), ensure optimized performance through effective asset management, adhere to SEO best practices (like proper metadata), and focus on maintainability by writing clean, modular code for easier updates.

  • What defines good HTML versus bad HTML in your perspective?
    Good HTML is semantic, appropriately structured, accessible, and follows web standards, making it easier for browsers and assistive technologies to understand the content. Bad HTML includes non-semantic elements, improper nesting, and lack of accessibility, leading to user confusion and reduced SEO performance.

  • Describe a recent responsive project you worked on.
    In a recent project, I developed a responsive e-commerce website using Bootstrap. I utilized Grid and Flexbox layouts to ensure proper alignment and visibility across devices, optimizing images and implementing media queries for seamless user experiences on mobile and desktop.

  • Do you have any personal projects? Please describe them.
    I built a personal portfolio website that showcases my projects and skills. It features a responsive design, uses CSS animations for transitions, and implements JavaScript for interactivity. The website is built using HTML5, CSS3, and JavaScript, focusing on clean design and accessibility.

  • What are some methods you use to decrease page load time?
    I use image optimization, minification of CSS and JavaScript files, leveraging browser caching, and using Content Delivery Networks (CDNs) to serve resources closer to users, ensuring faster load times.

  • What techniques do you apply to improve website performance?
    Techniques include lazy loading for images, reducing HTTP requests through CSS sprites, optimizing asset sizes, using asynchronous loading for JavaScript files, and employing server-side rendering where appropriate.

  • What are the best practices to enhance website accessibility?
    Best practices include using semantic HTML, providing descriptive alt text for images, ensuring keyboard navigability, maintaining a logical structure, providing adequate color contrast, and following WCAG guidelines.

  • In what scenarios would you recommend using semantic HTML elements?
    I recommend using semantic HTML elements in all scenarios, but especially when building web pages that require proper accessibility, SEO optimization, and improved readability for both users and search engines.


3. Git

Version Control

  • What tools do you use for version control in web development?
    I primarily use Git for version control, alongside platforms like GitHub for hosting repositories, managing contributions, and facilitating collaboration. Other tools include GitLab for CI/CD (Continuous Integration/Continuous Deployment) and Bitbucket when working in teams using Atlassian tools.

  • Describe your experience working on projects versioned with Git.
    I have worked on numerous projects using Git, managing branches for features and bug fixes, merging changes, and resolving conflicts. I've also utilized Git for collaborative work, performing code reviews through pull requests, and maintaining project history through commit messages.

  • What do you think about pull requests and code reviews in a team environment?
    Pull requests and code reviews are essential for maintaining code quality and facilitating knowledge sharing within a team. They allow for constructive feedback, help catch bugs early, and ensure that code adheres to established standards before merging into the main branch.

  • What is the difference between Git and GitHub?
    Git is a version control system that tracks changes in files and facilitates collaboration on projects. GitHub is a cloud-based platform that uses Git for version control but adds features for collaboration, including pull requests, issues, and a visual interface for managing repositories.

  • Can you outline an effective Git workflow you would follow in a project?
    An effective Git workflow includes:

    1. Start with the main branch and create a new branch for each feature or bug fix.
    2. Commit changes regularly with clear messages.
    3. Push branches to the remote repository for collaboration.
    4. Once completed, create a pull request for code review.
    5. Merge the pull request after approval and resolve any conflicts that arise.
    6. Delete the feature branch after merging to keep the repository clean.
  • What build tools are you familiar with, and what are they good for?
    I am familiar with tools like Webpack for module bundling, Gulp for task automation, and Babel for transpiling modern JavaScript into a format understandable by older browsers. These tools help streamline workflows, optimize performance, and ensure compatibility across different environments.


4. Agile Methodologies

Team Dynamics and Process

  • Do you have experience working within an agile team environment?
    Yes, I have experience working in agile teams following Scrum or Kanban methodologies. In these settings, I participate in regular stand-up meetings, sprint planning, and retrospectives to foster collaboration and improve our processes.

  • Do you typically work in sprints or prefer the Kanban approach? Why?
    I appreciate both approaches, but I typically lean towards sprints if my team thrives with clear timelines and deliverables. Sprints help create a structured environment that encourages focus and collaboration on specific objectives. However, I also find Kanban effective for teams needing flexibility and continuous delivery.

  • How have you approached working with Quality Assurance (QA) teams?
    I collaborate closely with QA from the beginning of a project to define acceptance criteria, participate in testing cycles, and discuss feedback. This proactive communication helps identify and resolve issues early in development and ensures a better quality product.

  • What methods did you use to communicate your progress in your previous role?
    I used daily stand-up meetings, project management tools (like Jira or Trello) to update tasks, and regular sync-ups with stakeholders to provide progress updates and manage expectations.

  • Can you describe a time when miscommunication occurred at work? How did you handle it?
    In a previous project, there was a misunderstanding regarding feature requirements. I initiated a meeting with stakeholders to clarify expectations, documented the requirements, and aligned everyone on the same page to mitigate further issues.

  • Have you ever disagreed with a manager? How did you manage that disagreement?
    Yes, I have. I approach disagreements by remaining respectful and focusing on the project's best interest. I presented my perspective with supporting data and facilitated a discussion to understand their viewpoint, leading to a constructive resolution.

  • Recount an instance where you collaborated successfully with someone who may not have liked you personally.
    In a past project, I worked with a colleague who had different opinions on design. We focused on clear communication and common goals, which ultimately led to a successful collaboration and delivery of the project.

  • How do you assess your ability to work effectively in a team?
    I reflect on feedback received from peers, collaboration success, meeting deadlines, and my adaptability to assist others when needed. I value open communication and a willingness to help teammates to foster a productive team environment.

  • What aspects did you appreciate about your last job, and what would you have liked to change?
    I appreciated the camaraderie and collaborative spirit of the team, as well as the emphasis on professional development. However, I would have liked more structured feedback processes to enhance personal growth opportunities.

  • How would your peers describe your work style and character?
    My peers would describe me as collaborative, detail-oriented, and proactive. They appreciate my commitment to quality and the support I provide to teammates.

  • Do you still actively write code in your current role? If yes, how do you feel about it?
    Yes, I still actively write code and enjoy it immensely. Coding allows me to solve problems creatively and stay engaged with current technologies and best practices.


@gohilumesh
Copy link

Hi Mark, Would you mind adding this to your list : https://github.com/gohilumesh/front-end-interview-question

@marko-jankovic
Copy link
Author

Hey @gohilumesh I'm trying to collect only HTML/CSS questions :) Thank you!

@sarathkumar6
Copy link

@marko-jankovic Nice work. Very useful... Thanks.

@s2c130050131527
Copy link

This list of questions is very helpful. I am amazed at the wide variety of concepts you have covered. Thank You.

@d88naimi
Copy link

d88naimi commented May 2, 2020

Excellent Job

@malvat
Copy link

malvat commented Aug 3, 2020

This is amazing. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment