LinkedIn’s CSS (Cascading Style Sheets) is a crucial component of its web interface, defining the visual presentation and layout of the LinkedIn website. While I can’t provide the exact code used by LinkedIn, I can discuss some general aspects of how CSS might be used on a platform like LinkedIn:
- Responsive Design: LinkedIn likely uses CSS to ensure that its website is responsive across various devices and screen sizes. This involves using media queries and flexible layout techniques to adapt the interface to different viewport sizes.
- Typography: CSS would be used to define the typography across the LinkedIn site, including font families, sizes, weights, line heights, and styles for headings, paragraphs, buttons, and other text elements.
- Layout: CSS is used extensively to define the layout of elements on the LinkedIn website. This includes positioning items such as headers, navigation bars, sidebars, content areas, and footers. Flexbox and grid layouts are commonly used for this purpose.
- Colors and Visuals: CSS would be used to specify the colors, gradients, borders, shadows, and other visual properties of elements on the LinkedIn site. This includes defining the color scheme and visual styling for buttons, links, backgrounds, and other UI components.
- Animations and Transitions: LinkedIn might utilize CSS animations and transitions to create interactive and engaging user experiences. This could involve animating elements such as dropdown menus, tooltips, modals, and transitions between pages or components.
- Accessibility: CSS plays a role in ensuring that the LinkedIn website is accessible to all users, including those with disabilities. This involves using CSS to define proper contrast ratios, text sizes, and other accessibility-related properties.
Overall, CSS is an integral part of LinkedIn’s web development toolkit, used to create a visually appealing, responsive, and accessible user interface.
LinkedIn CSS Exam Quiz Answers
Question 1: In the following example, which selector has the highest specificity ranking for selecting the anchor link element?
ul li a
a
.example a
div a
- .example a
- div a
- a
- ul li a
Question 2: Using an attribute selector, how would you select an element with a “tittle” attribute?
- a[title] {…}
- a > title {…}
- a. title {…}
- a=title {…}
Question 3: CSS grid and flexbox are now becoming a more popular way to create page layouts. However, floats are still commonly used, especially when working with an older code base, or it you need to support older browser version. What are two valid techniques used to clear floats?
- Use the “clearfix hack” on the floated element and add a float to the parent element.
- Use the overflow property on the floated element or the “clearfix hack” on either the floated or parent element.
- Use the “clearfix hack” on the floated element or the overflow property on the parent element.
- Use the “clearfix hack” on the parent element or use the overflow property with a value other than “visible.”
Question 4: What element(s) do the following selectors match to?
1) .nav {…} 2) nav {…} 3) #nav {…}
- 1. An element with an ID of “nav”
2. A nav element
3. An element with a class of “nav”
- They all target the same nav element.
- 1. An element with a class of “nav”
2. A nav element
3. An element with an id of “nav”
- 1. An element with a class of “nav”
2. A nav element
3. A div with an id of “nav”
Question 5: When adding transparency styles, what is the difference between using the opacity property versus the background property with a rgba () value?
- Opacity specifies the level of transparency of the child elements. Background with a rgba () value applies transparency to the background color only.
- Opacity applies transparency to the background color only. Background with a rgba () value specifies the level of transparency of an element, as a whole, including its content.
- Opacity specifies the level of transparency of an element, including its content. Background with a rgba () value applies transparency to the background color only.
- Opacity applies transparency to the parent and child elements. Background with a rgba () value specifies the level of transparency of the parent element only.
Question 6: What is true of block and inline elements? (Alternative: Which statement about block and inline elements is true?)
- By default, block elements are the same height and width as the content container between their tags; inline elements span the entire width of its container.
- By default, block elements span the entire width of its container; inline elements are the same height and width as the content contained between their tags.
- A <nav> element is an example of an inline element. <header> is an example of a block element.
- A <span> is an example of a block element. <div> is an example of an inline element.
Question 7: CSS grid introduced a new length unit, for, to create flexible grid tracks. Referring to the code sample below, what will the widths of the three columns be?
. grid {
display: grid;
width: 500px;
grid-template-columns: 50px 1fr 2fr;
}
- The first column will have a width of 50px. The second column will be 50px wide and the third column will be 100px wide.
- The first column will have a width of 50px. The second column will be 150px wide and the third column will be 300px wide.
- The first column will have a width of 50px. The second column will be 300px wide and the third column will be 150px wide.
- The first column will have a width of 50px. The second column will be 500px wide and the third column will be 1000px wide.
Question 8: What is the line-height property primarily used for?
- to control the height of the space between two lines of content
- to control the height of the space between heading elements
- to control the height of the character size
- to control the width of the space between characters
Question 9: Three of these choices are true about class selectors. Which is NOT true?
- Multiple classes can be used within the same element.
- The same class can be used multiple times per page.
- Class selectors with a leading period
- Classes can be used multiple times per page but not within the same element.
Question 10: There are many properties that can be used to align elements and create page layouts such as float, position, flexbox and grid. Of these four properties, which one should be used to align a global navigation bar which stays fixed at the top of the page?
- position
- flexbox
- grid
- float
Question 11: In the shorthand example below, which individual background properties are represented?
background: blue url(image.jpg) no-repeat scroll 0px 0px;
- background-color: blue;
background-image: url(image.jpg);
background-repeat: no-repeat;
background-attachment: scroll;
background-position: 0px 0px;
- background-color: blue;
background-img: url(image.jpg);
background-position: no-repeat;
background-scroll: scroll;
background-size: 0px 0px;
- background-color: blue;
background-src: url(image.jpg);
background-repeat: no-repeat;
background-wrap: scroll;
background-position: 0px 0px;
- background-color: blue;
background-src: url(image.jpg);
background-repeat: no-repeat;
background-scroll: scroll;
background-position: 0px 0px;
Question 12: In the following example, according to cascading and specificity rules, what color will the link be?
.example {
color: yellow;
}
ul li a {
color: blue;
}
ul a {
color: green;
}
a {
color: red;
}
<ul>
<li><a href=” #” class=”example”>link</a></li>
<li>list item</li>
<li>list item</li>
</ul>
- green
- yellow
- blue
- red
Question 13: When elements overlap, they are ordered on the z-axis (i.e., which element covers another). The z-index property can be used to specify the z-order of overlapping elements. Which set of statements about the z-index property are true?
- Larger z-index values appear on top of elements with a lower z-index value. Negative and positive numbers can be used. z-index can only be used on positioned elements.
- Smaller z-index values appear on top of elements with a larger z-index value. Negative and positive numbers can be used. z-index must also be used with positioned elements.
- Larger z-index values appear on top of elements with a lower z-index value. Only positive numbers can be used. z-index must also be used with positioned elements.
- Smaller z-index values appear on top of elements with a larger z-index value. Negative and positive numbers can be used. z-index can be used with or without positioned elements.
Question 14: What is the difference between the following line-height settings?
line-height: 20px
line-height: 2
- The value of 20px will set the line-height to 20px. The value of 2 will set the line-height to twice the size of the corresponding font-size value.
- The value of 20px will set the line-height to 20px. The value of 2 is not valid.
- The value of 20px will set the line-height to 20px. The value of 2 will default to a value of 2px.
- The value of 20px will set the line-height to 20px. The value of 2 will set the line-height to 20% of the corresponding font-size value.
Question 15: In the following example, what color will paragraph one and paragraph two be? (Alternative: In this example, what color will paragraph one and two be?)
<section>
<p>paragraph one</p>
</section>
<p>paragraph two</p>
section p {
color: red;
}
section + p {
color: blue;
}
- Paragraph one will be blue, paragraph two will be red.
- Both paragraphs will be blue.
- Paragraphs one will be red, paragraph two will be blue.
- Both paragraphs will be red.
Question 16: What are three valid ways of adding CSS to an HTML page?
- 1. External; CSS is written in a separate file.
2. Inline; CSS is added to the <head> of the HTML page.
3. Internal; CSS is included within the HTML tags.
- 1. External; CSS is written in a separate file and is linked within the <header> element of the HTML file.
2. Inline; CSS is added to the HTML tag.
3. Internal; CSS is included within the <header> element of the HTML file.
- 1. External; CSS is written in a separate file and is linked within the <head> element of the HTML file.
2. Internal; CSS is included within the <header> element of the HTML file.
3. Inline; CSS is added to the HTML tag.
- 1. External; CSS is written in a separate file and is linked within the <head> element of the HTML file.
2. Inline; CSS is added to the HTML tag.
3. Internal; CSS is included within the <head> element of the HTML file.
Question 17: Which of the following is true of the SVG image format? (Alternative: Which statement about the SVG image format is true?)
- CSS can be applied to SVGs but JavaScript cannot be.
- SVGs work best for creating 3D graphics.
- SVGs can be created as a vector graphic or coded using SVG specific elements such as <svg>, <line>, and <ellipse>.
- SVGs are a HAML-based markup language for creating vector graphics.
Question 18: In the example below, when will the color pink be applied to the anchor element?
a: active {
color: pink;
}
- The color of the link will display as pink after it’s been clicked or if the mouse is hovering over the link.
- The color of the link will display as pink on mouse hover.
- The color of the link will display as pink while the link is being clicked but before the mouse click is released.
- The color of the link will display as pink before it has been clicked.
Question 19: To change the color of an SVG using CSS, which property is used?
- Use background-fill to set the color inside the object and stroke or border to set the color of the border.
- The color cannot be changed with CSS.
- Use fill or background to set the color inside the object and stroke to set the color of the border.
- Use fill to set the color inside the object and stroke to set the color of the border.
Question 20: When using position: fixed, what will the element always be positioned relative to?
- the closest element with position: relative
- the viewport
- the parent element
- the wrapper element
Question 21: By default, a background image will repeat \_\_\_
- only if the background-repeat property is set to repeat
- indefinitely, vertically, and horizontally
- indefinitely on the horizontal axis only
- once, on the x and y axis
Question 22: When using media queries, media types are used to target a device category. Which choice lists current valid media types?
- print, screen, aural
- print, screen, television
- print, screen, speech
- print, speech, device
Question 23: How would you make the first letter of every paragraph on the page red?
- p: first-letter {color: red;}
- p: first-letter {color: red;}
- first-letter: p {color: red;}
- first-letter: p {color: red;}
Question 24: In this example, what is the selector, property, and value?
p {
color: #000000;
}
- “p” is the selector
“#000000” is the property
“color” is the value
- “p” is the selector
“color” is the property
“#000000” is the value
- “color” is the selector
“#000000” is the property
“#p” is the value
- “color” is the selector
“p” is the property
“#000000” is the value
Question 25: What is the rem unit based on?
- The rem unit is relative to the font-size of the p element.
- You have to set the value for the rem unit by writing a declaration such as rem {font-size: 1 Spx;}
- The rem unit is relative to the font-size of the containing (parent) element.
- The rem unit is relative to the font-size of the root element of the page.
Question 26: Which of these would give a block element rounded corners?
- corner-curve: 10px
- border-corner: 10px
- border-radius: 10px
- corner-radius: 10px
Question 27: In the following media query example, what conditions are being targeted?
@media (min-width: 1024px), screen and (orientation: landscape) {…}
- The rule will apply to a device that has either a width of 1024px or wider, or is a screen device in landscape mode.
- The rule will apply to a device that has a width of 1024px or narrower and is a screen device in landscape mode.
- The rule will apply to a device that has a width of 1024px or wider and is a screen device in landscape mode.
- The rule will apply to a device that has a width of 1024px or narrower, or is a screen device in landscape mode.
Question 28: CSS transform properties are used to change the shape and position of the selected objects. The transform-origin property specifies the location of the element’s transformation origin. By default, what is the location of the origin?
- the top left corner of the element
- the center of the element
- the top right corner of the element
- the bottom left of the element
Question 29: Which of the following is not a valid color value?
- color: #000
- color: rgb (0,0,0)
- color: #000000
- color: 000000
Question 30: What is the vertical gap between the two elements below?
<div style=” margin-bottom: 2rem;”>Div 1</div>
<div style=” margin-top: 2rem;”>Div 2</div>
- 2rem
- 32px
- 64px
- 4rem
Question 31: When using the Flexbox method, what property and value is used to display flex items in a column?
- flex-flow: column; or flex-direction: column
- flex-flow: column;
- flex-column: auto;
- flex-direction: column;
Question 32: Which type of declaration will take precedence?
- any declarations in user-agent stylesheets
- important declarations in user stylesheets
- normal declarations in author stylesheets
- important declarations in author stylesheets
Question 33: The flex-direction property is used to specify the direction that flex items are displayed. What are the values used to specify the direction of the items in the following examples?
- Example 1: flex-direction: row; Example 2: flex-direction: row-reverse; Example 3: flex-direction: column; Example 4: flex-direction: column-reverse;
- Example 1: flex-direction: row-reverse; Example 2: flex-direction: row; Example 3: flex-direction: column-reverse; Example 4: flex-direction: column;
- Example 1: flex-direction: row; Example 2: flex-direction: row-reverse; Example 3: flex-direction: column; Example 4: flex-direction: reverse-column;
- Example 1: flex-direction: column; Example 2: flex-direction: column-reverse; Example 3: flex-direction: row; Example 4: flex-direction: row-reverse;
Question 34: There are two sibling combinators that can be used to select elements contained within the same parent element; the general sibling combinator (~) and the adjacent sibling combinator (+). Referring to example below, which elements will the styles be applied to?
elements will the styles be applied to?
h2 ~ p {
color: blue;
}
h2 + p {
background: beige;
}
<section>
<p>paragraph 1</p>
<h2>Heading</h2>
<p>paragraph 2</p>
<p>paragraph 3</p>
</section>
- Paragraphs 2 and 3 will be blue. The h2 and paragraph 2 will have a beige background.
- Paragraphs 2, and 3 will be blue, and paragraph 2 will have a beige background.
- Paragraphs 2 and 3 will be blue. Paragraph 2 will have a beige background.
- Paragraph 2 will be blue. Paragraphs 2 and 3 will have a beige background
Question 35: When using flexbox, the “justify-content” property can be used to distribute the space between the flex items along the main axis. Which value should be used to evenly distribute the flex items within the container shown below?
- justify-content: space-around;
- justify-content: center;
- justify-content: auto;
- justify-content: space-between;
Question 36: There are many advantages to using icon fonts. What is one of those advantages?
- Icon fonts increase accessibility.
- Icon fonts can be used to replace custom fonts.
- Icon fonts can be styled with typography related properties such as font-size and color.
- Icon fonts are also web safe fonts.
Question 37: What is the difference between display: none and visibility: hidden?
- Both will hide the element on the page, but display: none has greater browser support. visibility: hidden is a new property and does not have the best browser support
- display: none hides the elements but maintains the space it previously occupied. visibility: hidden will hide the element from view and remove it from the normal flow of the document
- display: none hides the element from view and removes it from the normal flow of the document. visibility: hidden will hide the element but maintains the space it previously occupied.
- There is no difference; both will hide the element on the page
Question 38: What selector and property would you use to scale an element to be 50% smaller on hover?
- element: hover {scale: 0.5;}
- element: hover {transform: scale (0.5);}
- element: hover {scale: 50%;}
- element: hover {transform: scale (50%);}
Question 39: Which statement regarding icon fonts is true?
- Icon fonts can be inserted only using JavaScript.
- Icon fonts are inserted as inline images.
- Icon fonts require browser extensions.
- Icon fonts can be styled with typography-related properties such as font-size and color.
Question 40: The values for the font-weight property can be keywords or numbers. For each numbered value below, what is the associated keyword?
font-weight: 400; font-weight: 700;
- bold; normal
- normal; bold
- light; normal
- normal; bolder
Question 41: If the width of the container is 500 pixels, what would the width of the three columns be in this layout?
- . grid {display: grid; grid-template-columns: 50px 1fr 2fr;}
- 50px, 150px, 300px
- 50px, 200px, 300px
- 50px, 100px, 200px
- 50px, 50px, 100px
Question 42: Using the: nth-child pseudo class, what would be the most efficient way to style every third item in a list, no matter how many items are present, starting with item 2?
- li: nth-child (3 + 2n) {
margin: 0 5 px;
}
- li: nth-child (3n + 2) {
margin: 0 5 px;
}
- li: nth-child (2),
li: nth-child (5),
li: nth-child (8) {
margin: 0 5 px;
}
- li: nth-child (2n + 3) {
margin: 0 5 px;
}
Question 43: Which selector would select only internal links within the current page?
- a [href=” #”] {…}
- a [href~=” #”]
- a [href^=” #”]
- a [href=” #”]
Question 44: What is not true about class selectors?
- Only one class value can be assigned to an element.
- An element can have multiple class value.
- Class selectors are marked with a leading period.
- More than one element can have the same class value.
Question 45: What is the difference between the margin and padding properties?
- Margin adds space around and inside of an element; padding adds space only inside of an element.
- Margin adds space around an element; padding adds apace inside of an element.
- Margin adds a line around an element, padding adds space inside of an element.
- Margin adds space inside of an element, padding adds space around an element.
Question 46: What is not a valid way of declaring a padding value of 10 pixels on the top and bottom, and 0 pixels on the left and right?
- padding: 10px 10px 0px 0px;
- padding: 10px 0px;
- padding: 10px 0;
- padding: 10px 0px 10px 0px;
Question 47: Is there an error in this code? If so, find the best description of the problem
@font-face {
font-family: ‘Avenir’, sans-serif;
src: url (‘avenir. woff2’) format(‘woff2’), url (‘avenir. woff’) format(‘woff’);
}
- The font file formats are not supported in modern browsers.
- The src attribute requires a comma between the URL and format values.
- There are no errors in the example.
- The sans-serif inclusion is problematic.
Question 48: Which style places an element at a fixed location within its container?
- position: absolute;
- display: flex;
- display: block;
- float: left;
Question 49: The calc () CSS function is often used for calculating relative values. In the example below, what is the specified margin-left value?
.example {
margin-left: calc (5% + 5px);
}
- The left margin value is equal to 5% of its parent’s element’s width plus 5px
- The left margin value is equal to 5% of the viewport width plus 5px
- The left margin value is equal to 5% of the closest positioned element’s width plus 5px
- The left margin value is equal to 5% of the selected element’s width (.example) plus 5px
Question 50: What is the CSS selector for a tag containing the title attribute?
- a[title]
- a > title
- a=title
- title
Question 51: Which code would you use to absolutely position an element of the logo class?
- . logo {position: absolute; left: 100px; top: 150px;}
- . logo {position: absolute; margin-left: 100px; margin-top: 150px;}
- . logo {position: absolute; padding-left: 100px; padding-top: 150px;}
- . logo {position: absolute; left-padding: 100px; top-padding: 150px;}
Question 52: In this example, what color will Paragraph 1 be?
p: first-of-type {
color: red;
}
p {
color: blue;
}
.container {
color: yellow;
}
p: first-child {
color: green;
}
<div class=”container”>
<h1>Heading</h1>
<p>Paragraph1</p>
<p>Paragraph2</p>
</div>
- blue
- green
- red
- yellow
Question 53: What is the: placeholder pseudo-element used for?
- It is used to format the appearance of placeholder text within a form control.
- It specifies the default input text for a form control.
- It writes text content into a hyperlink tooltip.
- It writes text content into any page element.
Question 54: Which statement is true of the single colon (:) or double colon (: 🙂 notations for pseudo-elements-for example, before and: before?
- All browsers support single and double colons for new and older pseudo-elements. So you can use either but it is convention to use single colons for consistency.
- In CSS3, the double colon notation (: 🙂 was introduced to create a consistency between pseudo-elements from pseudo-classes. For newer browsers, use the double colon notation. For IE8 and below, using single colon notation (:).
- Only the new CSS3 pseudo-elements require the double colon notation while the CSS2 pseudo-elements do not.
- In CSS3, the double colon notation (: 🙂 was introduced to differentiate pseudo-elements from pseudo-classes. However, modern browsers support both formats. Older browsers such as IE8 and below do not.
Question 55: Which choice is not valid value for the font-style property?
- normal
- italic
- none
- oblique
Question 56: When would you use the @font-face method?
- to set the font size of the text
- to load custom fonts into stylesheet
- to change the name of the font declared in the font-family
- to set the color of the text
Question 57: When elements within a container overlap, the z-index property can be used to indicate how those items are stacked on top of each other. Which set of statements is true?
- 1. Larger z-index values appear on top elements with a lower z-index value.
2. Negative and positive number can be used.
3. z-index can be used only on positioned elements.
- 1. Smaller z-index values appear on top of elements with a larger z-index value.
2. Negative and positive numbers can be used.
3. z-index can be used with or without positioned elements.
- 1. Smaller z-index values appear on top of elements with a larger z-index value.
2. Negative and positive number can be used.
3. z-index must also be used with positioned elements.
- 1. Larger z-index values appear on top of elements with a lower z-index value.
2. Only positive number can be used.
3. z-index must also be used with positioned elements.
Question 58: You have a large image that needs to fit into a 400 x 200-pixel area. What should you resize the image to if your users are using Retina displays?
- 2000 x 1400 pixels
- 200 x 100 pixels
- 800 x 400 pixels
- 400 x 200 pixels
Question 59: In Chrome’s Developer Tools view, where are the default styles listed?
- under the User Agent Stylesheet section on the right
- in the third panel under the Layout tab
- under the HTML view on the left
- in the middle panel
Question 60: While HTML controls document structure, CSS controls _.
- semantic meaning
- content meaning
- document structure
- content appearance