Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
5 views
CSS Interview Questions
Csss
Uploaded by
rohitmadje32
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save CSS Interview Questions For Later
Download
Save
Save CSS Interview Questions For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
5 views
CSS Interview Questions
Csss
Uploaded by
rohitmadje32
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save CSS Interview Questions For Later
Carousel Previous
Carousel Next
Save
Save CSS Interview Questions For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 9
Search
Fullscreen
91 CSS Interview Question Sr.No Topic Number of Questions 1 | Basic CSS 10 2 | Selectors 4 3 | CSS Box Model 7 4| Layout 8 5 | Typography 7 6 | Colors and Backgrounds 9 7| CSS Transition 5 8 | CSS Animation 5 9 | CSS Transtorm {10 10 | CSS Flex 48. 11 | Grid Layout 10 12 | Responsive Design 8 Totat | 91Here are 99 CSS questions that cover a wide range of Q.5] What are the different ways to apply CSS. topics, including theory, concepts, and practical questions. These questions will help you prepare to a web page? effectively for an interview. SS can be applied in three ways: : 4 Intine styles: Direct within an HTML element. Basic CSS 2, Internal stylesheets: Within a element in the chesd> section ofan HTML document 3. External stylesheets: inked toan HTML document Q.1] What does CSS stand for? using the
element. ‘+ 08S stands for Cascading Style Sheets. Q.6] What is an inline style? Q.2] What is the purpose of CSS? * Inline styles are ©SS styles applied directly to an individual HTML element using the style attribute ‘© C8Sis used to style and format the appearance of \web pages written in HTML and XML. 5 + allows web developers to control aspects like layout, colors, fonts, and spacing of HTML Q.7] What is an internal stylesheet? elements. + Aninternal stylesheet is CSS code written within a Q.3] How do you link a CSS file to an HTML element inthe section of an document? HTML document. rs * Itapplies styles to that particular HTML document ‘© Youcanlink a CSS file to an HTML document using Shi. the <1ink> element within the section of the HTML document. Q.8] What is an external stylesh + Anexternal stylesheet is a separate CSS file linked to an HTML document using the <1ink> + rel Itis used to indicate different relationships element. beter the eurrene documents and the Inked + ttallows styles to be applied across multiple resource. Some common values are HTML documents. co Q.9] How do you apply multiple styles to a = preload single element? = alternate + Multiple styles can be applied toa single element by separating each style declaration with a semicolon within the style attribute (forintine + type - The cyve attribute specifies the MIME type of the linked resource, Q.4] What is the syntax of a CSS rule? styles] or within the CSS rule: + A CSS tule consists of a selector and a eco declaration block, selector { property valuel;Q.11] What Q.10] What is the difference between a class selector and an ID selector? Class selector Defined using a dot () followed by a class name. Classes can be apptied to multiple elements, and ‘one element can have multiple classes. .classname { property: value; + ID selector ‘© Defined using a hash (#) followed by an ID name. ‘© 1Ds are unique within a document and should only bbe applied to one element. #idname { property: value; Selectors aCSS selector? ‘* ACS selectors a pattern that is used to select and style HTML elements based on various criteria such as element types, IDs, classes, tributes, and relationships with other elements Q.12] What are the types of CSS Selectors 1. Universal Selector (*) ¥ Selects all elements on the page Selects all elements of a specific type pt property: value; + 3. Class Selector (.) Selects elements with a specific class attribute «classname { property: value; } 4, IDSelector (#) Y Selects a single element with a specific ID attribute property: value; 5. Attribute Selector Selects elements based on the presence or value of an attribute, input[type="text"] 1 property: value; } 6. Pseudo-classes Selects elements based on their special state a:hover { property: value; }Descendant Selector (space) ¥ Selects elements that are descendants of another element div pt property: valu } Child Selector (>) ¥- Selects elements that are direct children of another element. div>p property: values + 10, Adjacent Sibling Selector (+) ¥ Selects the fist element that immediately follows a specitied element, ‘and both elements must have the same parent, ha+pd property: value; 411. General Sibling Selector (~) ¥ Solects elements that are siblings of a specified element, ha~ pt property: value; ¥ Q.13] What is a pseudo-class? + Apsoudo-class is away to style an elementin CSS based on its state or position without ending extra HTML code. wa) t + Itis@ keyword added to the selectors which will allow to style the specific parts of an element's content. * Psoudo classes - targets the entire element + Pseudo elements ~ targets the specific part of an element + Pseudo-elements are written with a double colon (ey Here are some common pseudo-elements font-style: first-line { color blue} font-weightCSS BOX MODEL Q.15] What is the CSS box model? ‘+The CSS box model is a fundamental concept that describes te rectangular bores generated or sloments a web pogo SAGEM tne element's content, padding, border, and margin Q.16] What are the components of the box model? © Content: The actual content of the box, where text and images appear. ‘+ Padding: The space between the content and the border. ‘+ Border: The border surrounding the padding (it any) and content. ‘+ Margin: The space outside the border, separating the element from other elements. Q.17] Whats the difference between margin and padding? ‘+ Margin: Space outside the element's border, creating space between elements. ‘+ Padding: Space inside the element's border, creating space between the content andthe erie Q.19] How do you center an element vertically? + Tocenter an element vertically, you can use Flexbox container { display: flex; align-items: center; + The box-sizing property defines how the total width and height of an element are calculated. + With box-sizing: border-box; the padding and border are included in the element's total width and height. element { box-sizing: border-box; + Q.20] How do you create a rounded border? + Use theborder-radius property to create rounded borders element { border-radius: 10px; + 0.221 How do vou create a border around an+ Use the border-radius property to create rounded borders element { border: 2px solid black; } LAYOUT Q.23] What is the position property in CSS? + The position property in CSS determines how an element is positioned in a document. + Itean take several values: static, relative, absolute, fixed, and sticky. Q.24] Different Values of the position Property static Ref Default positioning Elements are positioned according to the normal flow of the document. + We can’tuse offsets like top, right, bottom and 1 relative Refer a codepe: ‘+ Positioned relative to its normal position + We can use offsets lke like top, rignt, bottom, and Left Hereis the diagram which illustrates the static and relative position + If there is no positioned ancestor, the elemant is positioned relative tothe initial containing block (usually the element). + Theancestor can have relative, absolute, fixed, or sticky positioning # Itdoes not work with position statie fixed Refer a codepen + Positioned relative to the viewport. meaning it stays in the same place even when the page is scrolled Sticky © Acts like relative until the element reaches a specified scroll point, then it"sticks" in place. Q.25] What is the float property? + Used to position an element to the left or right within its container , allowing text and inline elements to wrap around it. Refer a codepe: Q.26] How do you clear floats in CSS? * Toclearflosts and ensure elements below a+ Block - Elements take up the full width available and start on a new line + Inline - Flements only take up as much width as necessary and do not start on a new line. + anline-block - Behaves like inline elements but can have a width and height. + Flex - Turns the element into a flex container + grid -Turs the element into a grid container Q.28] How do you create a flexbox layout? * Tocteate a flexbox layout, you set display: lex; onthe parent container and use various properties ike flex-direction, justify- content, align-items, etc.,on the child elements to control their layout. Q.29] What is the £1ex property? + The ¢1ex property is a shorthand for tex- grow, flex-shrink, and flex-basis combined, defining how a flex item will {grow or shrink to fit the available space. Q.30] How do you create a gi layout in CSS? © Tocreate a grid layout, you set display grid; on the container and define its columns and rows using grid-template~ columns, grid-tenplate-rows, and place items within the grid using grid-colunn and oz is-row properties. © Refer _codepen * Usingthe font-family property in CSS. selector { font-family: Artal, sans-serif ? Q.32] Whats the £ont-£ami ly property? + The font-family property specifies the font family fortext. + Itallows you to define a prioritized list of fonts to Use, separated by commas. # Ifthe first font is not available on the user's system, itfalls backto the next one in thelist. Q.33] Whats the font-family property? + You specify a fallback font by listing multiple fonts in the font-family property, separated by commas. selector { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } Q.34] What is the font-size property? * The font-size property in CSS specifies the size of the font. * Iteanbe set to various units like pixels (px), ems: (em), or percentages (%) Q.35] How do you change the color of the text? + Text color is changed using the color property. selector {+ Text alignment can be controlled using the text-align property cover-background { background- image: url('imagel. jpg! ); background-size: cover; ¥ ~eontain-background { background tnage: ur" tmage?. ja" )s background-size: 4 Colors & Backgrounds Q.37] How do you change the color of the text? + You can set the background color of an element using the background-color property. selector { background-color: #ffcc00; + You can set a background image using the background-image property. selector { background-image: url(inage. jpg" )3 r Q.39] How do you set the size of a background image? Q.38] How do you set a background image? 5. Q.40] How do you re! specific-stze-background { background-image: url("tmage3. jpq"); background-size: ; 9 100px 100px; Contain: Scales the background image to be fully visible within the element, maintaining its aspect ratio. Specific Size: You can set specific dimensions for the background image using unite like pixels, percentages, or any other CSS length units. ‘Auto: Maintains the original size of tho background image. -auto-size-background { background-image: url('image5. jpg' ); background-size: au’ + Multiple Background Sizes: If you have multiple background images, you can specily sizes for each one, -miltiple-backgrounds { background-image: UC" images. jpg! }, url “image? jpg"); background-size: 50% 58%, cover; } t a background image? ‘You can control the repetition of a background‘+ Other values include repeat, repeat-x, and repeat-y. selector { background-repeat: no-repeat; Q.41] What is the background-position property? ‘+ Is used to specity the initial position of a background image within its container ‘+ You can set the position using keywords, length values, or percentages ‘© This property helps in aligning the background image as desired within the element. Syntax background-position: x y; + x represents the horizontal position. ‘© yrepresents the vertical position. Common Values @ REMEMBER Q.42] How do you create a gradient background? * You can create a gradient background using the background property with gradient function. elector { background: Linear-pradtent(te ight, red, yettow)s } Q.43] How do you create a semi background’ {ransparent + You can craate a semi-transparent background Using the rgba() function in the background-color property. selector { background-color: rgba(®, 0, 0, 0.5)5 } Q.44] How do you create a shadow effect? + You can create a shadow effect using the don property for element shadows or vext-shadow for text shadows box: heottse v-offset: The vertical offset of the shadow . The horizontal offset of the shadow + blur (optional): The blur radius spread (optional): The spread radius Color (optional): The color of the shadow ector { ox shadows 29x 2px Spx robal®, 0, & 0.3) > Q.45] How do you change the opacity of an element?
You might also like
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Mark Manson
4/5 (6127)
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
4/5 (627)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brene Brown
4/5 (1148)
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
Chris Voss
4.5/5 (932)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4/5 (8215)
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Angela Duckworth
4/5 (631)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1253)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4/5 (8365)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
4.5/5 (860)
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Carmen Maria Machado
4/5 (877)
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Ben Horowitz
4.5/5 (361)
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Margot Lee Shetterly
4/5 (954)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4/5 (2923)
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
Ashlee Vance
4.5/5 (484)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
4.5/5 (277)
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Fredrik Backman
4.5/5 (4972)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
4.5/5 (444)
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
Colm Tóibín
3.5/5 (2061)
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
Garth Stein
4/5 (4281)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
4/5 (100)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
Meik Wiking
3.5/5 (447)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
3.5/5 (2283)
Yes Please
From Everand
Yes Please
Amy Poehler
4/5 (1987)
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Gilbert King
4.5/5 (278)
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Roxane Gay
4/5 (1068)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
4/5 (1993)
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
Ruth Ware
3.5/5 (2641)
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
Betty Smith
4.5/5 (1936)
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
Viet Thanh Nguyen
4.5/5 (125)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
3.5/5 (692)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
4.5/5 (1912)
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Hilary Mantel
4/5 (4074)
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Naomi Klein
4/5 (75)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
3.5/5 (143)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (830)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
3.5/5 (901)
John Adams
From Everand
John Adams
David McCullough
4.5/5 (2542)
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
M L Stedman
4.5/5 (790)
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
4/5 (45)
Little Women
From Everand
Little Women
Louisa May Alcott
4/5 (105)
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel
John le Carré
3.5/5 (109)
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Principles: Life and Work
From Everand
Principles: Life and Work
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Steve Jobs
From Everand
Steve Jobs
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Yes Please
From Everand
Yes Please
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
The Outsider: A Novel
From Everand
The Outsider: A Novel
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
John Adams
From Everand
John Adams
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
Little Women
From Everand
Little Women
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel