Professional Documents
Culture Documents
3. What is a Grid?
Ans)A grid is a system of dividing a web page into rows and columns to
create a structured and organized layout. It provides a framework for
arranging content elements in a consistent and visually appealing manner.
Grids are commonly used in CSS frameworks to facilitate responsive
design, ensuring that web pages adapt seamlessly to different screen sizes
and devices.
4. What is Bootstrap Grid System?
5. What are the Grid options available and how to use them?
Grid Classes: The core of the Bootstrap grid system lies in its predefined
grid classes. These classes, such as .col-sm-4 or .col-md-6, determine the
width of columns on different screen sizes. For instance, .col-sm-4 will
occupy 4 out of 12 columns on small devices (sm), while .col-md-6 will take
up 6 out of 12 columns on medium devices (md).
Nesting: Bootstrap allows you to nest rows within rows, creating more
complex layouts. Nested rows inherit the grid system from their parent row,
enabling you to create multi-level grids.
7. Write the structure of container with 2 rows and 4 columns each of 3 col
gird system size.
Ans)<div class="container">
<div class="row">
<div class="col-md-3">Column 1</div>
<div class="col-md-3">Column 2</div>
<div class="col-md-3">Column 3</div>
<div class="col-md-3">Column 4</div>
</div>
<div class="row">
<div class="col-md-3">Column 5</div>
<div class="col-md-3">Column 6</div>
<div class="col-md-3">Column 7</div>
<div class="col-md-3">Column 8</div>
</div>
</div>
<div class="bg-primary">
Primary background color
</div>
<div class="bg-secondary">
Secondary background color
</div>
<div class="bg-success">
Success background color
</div>
<div class="bg-danger">
Danger background color
</div>
<div class="bg-warning">
Warning background color
</div>
<div class="bg-info">
Info background color
</div>
<div class="bg-light">
Light background color
</div>
<div class="bg-dark">
Dark background color
</div>
Ans)<table class="table">
<thead>
<tr>
<th scope="col">Column 1</th>
<th scope="col">Column 2</th>
<th scope="col">Column 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data 1</td>
<td>Data 2</td>
<td>Data 3</td>
</tr>
<tr>
<td>Data 4</td>
<td>Data 5</td>
<td>Data 6</td>
</tr>
</tbody>
</table>
Ans)<form class="form">
<div class="form-group">
<label for="email">Email address:</label>
<input type="email" class="form-control" id="email" placeholder="Enter
email">
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" class="form-control" id="password"
placeholder="Enter password">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
Padding and Margin Utility Classes: Bootstrap provides utility classes for
adjusting padding and margin on various components. These classes use
different prefixes, such as p-, m-, and mx-, followed by a number indicating
the desired spacing in rem or percentage units.
CSS Properties: You can directly apply CSS properties like padding and
margin to individual elements or within custom CSS classes. This method
offers more granular control over spacing values.
Grid System Classes: For adjusting gutter spacing within the Bootstrap grid
system, use the g-* classes, where * represents the desired gutter width.
For example, g-0 removes all gutters, while g-3 sets a gutter width of 3
rem.
<div class="p-4">
<p>This paragraph has a padding of 4 rem.</p>
</div>
And here's an example of using CSS properties:
<div style="padding: 20px; margin: 10px;">
<p>This paragraph has a padding of 20px and a margin of 10px.</p>
</div>
Button Size Classes: You can adjust the button's size using the .btn-lg,
.btn-sm, and .btn-xs classes. These classes enlarge, shrink, and
extra-shrink the button, respectively.
14. Explain vertical and horizontal alignment of elements.
15. How to style images with ends rounded, image in a circle and create a
thumbnail.
Ans)To style an image with rounded ends, you can use the border-radius
CSS property. For example, to set the border radius of an image to 10px,
you would use the following CSS code:
CSS
.rounded-image {
border-radius: 10px;
}
To style an image in a circle, you can use the border-radius CSS property
and set it to 50%. This will make the image a perfect circle. Here is an
example of how to do this:
CSS
.circle-image {
border-radius: 50%;
}
To create a thumbnail, you can use the img-thumbnail class. This class will
add a border, rounded corners, and a little bit of padding to the image. Here
is an example of how to use this class: