Responsive header with button bootstrap and css

 To center the logo and place a button on the right side in a responsive design, you can use HTML and CSS. Here's a simple example:


HTML:

```html

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="styles.css">

    <title>Responsive Design</title>

</head>

<body>

    <header>

        <div class="logo-container">

            <img src="your-logo.png" alt="Logo">

        </div>

        <div class="button-container">

            <button>Button</button>

        </div>

    </header>

</body>

</html>

```


CSS (styles.css):

```css

body {

    margin: 0;

    font-family: 'Arial', sans-serif;

}


header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 10px;

    background-color: #f0f0f0;

}


.logo-container img {

    max-width: 100%;

    height: auto;

}


.button-container {

    margin-left: auto;

}

```


This code creates a responsive header with a centered logo and a button on the right side. Adjust the file paths, styles, and button text as needed for your design.


In Bootstrap 

Certainly! In Bootstrap, you can achieve this layout using the grid system and utility classes. Here's an example:


```html

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">

    <title>Bootstrap Responsive Design</title>

</head>

<body>


<div class="container-fluid">

    <div class="row">

        <div class="col-md-6 text-center">

            <img src="your-logo.png" alt="Logo" class="img-fluid">

        </div>

        <div class="col-md-6 text-md-right">

            <button class="btn btn-primary">Button</button>

        </div>

    </div>

</div>


<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>


</body>

</html>

```


This example uses Bootstrap's grid system with two columns. The logo is centered in the first column, and the button is aligned to the right in the second column. Make sure to replace "your-logo.png" with the actual path to your logo image.


Remember to include the Bootstrap CSS and JavaScript files for this example to work. You can link directly to the Bootstrap CDN or download the files and host them locally.

Previous
Next Post »