Zedex Info Pvt Ltd
Sovereign Consulting Services Interview Questions and Answers
Q1. How to centre 3 div vertically and horizontally using css
To center 3 divs vertically and horizontally, use flexbox and align-items/justify-content properties.
Wrap the 3 divs in a parent container
Set the parent container's display property to flex
Set the parent container's align-items and justify-content properties to center
Q2. Input type used during form submission but not visible to the user
Hidden input type is used during form submission
is used to include data in form submission without displaying it to the user
Commonly used for passing values like session tokens or tracking information
Q3. Difference between block and inline- block
Block elements take up the full width available, while inline-block elements only take up as much width as necessary.
Block elements start on a new line and stack vertically
Inline-block elements can sit next to each other and wrap to a new line when necessary
Block elements have a default width of 100%
Inline-block elements have a default width of the content inside them
Examples of block elements include
,-
,
,
- ,
- ,
Q4. How to get URL params using javascript
Use window.location.search or URLSearchParams to get URL params in JavaScript
Use window.location.search to get the query string portion of the URL
Use URLSearchParams to parse and extract individual parameters from the query string
Example: const params = new URLSearchParams(window.location.search); const paramValue = params.get('paramName');
Q5. How to add background image
To add a background image, use CSS background-image property.
Create a CSS class or ID for the element you want to add the background image to.
Use the background-image property to specify the URL of the image.
Set the background-size property to cover or contain the element.
Example: .container { background-image: url('image.jpg'); background-size: cover; }
Q6. Difference between flex and grid
Flex is one-dimensional layout while Grid is two-dimensional layout.
Flex is used for creating flexible and responsive layouts.
Grid is used for creating complex and structured layouts.
Flex is best suited for small-scale layouts while Grid is best suited for large-scale layouts.
Flex is easier to learn and implement while Grid requires more advanced knowledge.
Flex is supported by older browsers while Grid has limited support in older browsers.
Q7. Difference between position and relative
Position sets an element's position relative to its parent, while relative sets an element's position relative to its normal position.
Position: sets an element's position relative to its parent container
Relative: sets an element's position relative to its normal position
Positioned elements are taken out of the normal flow of the document
Relative elements are still in the normal flow of the document
Positioned elements can be moved outside of their parent container
Relative elem...read more
Top Front end Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month