I trying position image in my html at the right side of the page but am not able to achieve. I want position text at the left
side of the page and image the right side of the page using bootstrap in the image attached.
If bootstrap has layout function to achieve such result, you can post the link for me learn.
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Hello, world</title>
</head>
<body>
<main class="hero-section">
<div class="container">
<div class="section-content">
<h4>LEARNING BOOTSTRAP</h4>
<h6>Discover places near you</h6>
<button class="btn btn-primary btn-sm" type="submit">SIGN UP</button>
<a class="btn btn-primary btn-sm" href="#" role="button">LEARN MORE</a>
</div>
<div class="section-device">
<img src="pc_image.png">
</div>
</div>
</main>
<!-- Footer -->
<footer class="page-footer font-small blue">
<!-- Copyright -->
<div class="footer-copyright text-center py-3">© 2023 Copyright:
MDBootstrap.com
</div>
<!-- Copyright -->
</footer>
<!-- Footer -->
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</body>
</html>
Related
I am trying to center the content of a column using Bootstrap. This is my current code:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
</head>
<body>
<!-- CODE -->
<header>
<div class="container-fluid">
<div class="row">
<!-- LEFT -->
<div class="col-md-6 p-md-5 p-4" style="background-color: lime;">
<div> <!-- THIS SHOULD BE IN THE CENTER -->
<h1>Welcome</h1>
<h2>to my web!</h2>
</div>
<div> <!-- THIS SHOULD BE IN THE BOTTOM -->
<p>Icons</p>
</div>
</div>
<!-- RIGHT -->
<div class="col-6 d-md-block d-none" style="background-color: red"></div>
</div>
</div>
</header>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
</body>
</html>
I have tried using d-flex justify-content-center, as follows:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
</head>
<body>
<!-- CODE -->
<header>
<div class="container-fluid">
<div class="row">
<!-- LEFT -->
<div class="col-md-6 p-md-5 p-4 d-flex justify-content-center" style="background-color: lime;">
<div> <!-- THIS SHOULD BE IN THE CENTER -->
<h1>Welcome</h1>
<h2>to my web!</h2>
</div>
<div> <!-- THIS SHOULD BE IN THE BOTTOM -->
<p>Icons</p>
</div>
</div>
<!-- RIGHT -->
<div class="col-6 d-md-block d-none" style="background-color: red"></div>
</div>
</div>
</header>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
</body>
</html>
But this is not working...
How can I do to put the elements correctly inside the column?
You can add “ align-items-center” to the class, if that still doesn’t work, make sure you’re not adding different margins to left and right of the section, but justify-content-center and align-items-center will work fine
Adding d-flex flex-column h-100 to the child, with an align-items-center solves the scenario.
I have an alert that has two problems, the first one is that it does not close when I click on the "X" button. I am using Bootstrap 5
This is the code
{{#if success}}
<div class="container p-4">
<div class="row">
<div class="col-md-auto mx-auto">
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{success}}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span area-hidden="true">×</span>
</button>
</div>
</div>
</div>
</div>
{{/if}}
I was investigating and it seemed to be because I wasn't using the bootstrap script BUT I did have it at the time, so I looked for the most recent version and put it in the layout/main.hbs of my project, just below where the partials or other views are called (In <body>)
This is the script I found in the Bootstrap documentation, and it didn't work even with it
<!DOCTYPE html>
<html lang="en">
<head>...</head>
<body style="background-color:#2e2c25"> {{!-- #212529 navbar --}}
{{> navigation }}
{{{ body }}}
{{!-- Scripts --}}
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</body>
</html>
I tried to find some mistake of mine but I didn't find any that could affect that
The other problem I have with that alert is that the "X" for some reason doesn't look pretty, it looks in a white square, and there's a lot of spacing to the right, BUT this is minor, for now I'm only interested in the alert being able to close
REMOVE <span area-hidden="true">×</span>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title></title>
</head>
<body>
{{#if success}}
<div class="container p-4">
<div class="row">
<div class="col-md-auto mx-auto">
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{success}}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
</div>
</div>
{{/if}}
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</body>
</html>
Try This Because you can use Bootstrap 5
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
i have create a html code for my web radio player in my site...in pc browser is ok except sometimes but when i open the page from my smartphone i need to refresh page 1-2 times and after plays as the browser?Can i have a solution.Thanks.
<script language="javascript" type="text/javascript"
src="https://radio.streamings.gr/system/player.js"></script>
<div class="cc_player" data-username="panicradio">Loading ...</div>
try to insert the script at the end like this
<!-- jQuery js -->
<script src="http://panicradio.gr/js/jquery.min.js"></script>
<!-- Popper js -->
<script src="http://panicradio.gr/js/popper.min.js"></script>
<!-- Bootstrap js -->
<script src="http://panicradio.gr/js/bootstrap.min.js"></script>
<!-- All js -->
<script src="http://panicradio.gr/js/poca.bundle.js"></script>
<!-- Active js -->
<script src="http://panicradio.gr/js/default-assets/active.js"></script>
<script src="https://radio.streamings.gr/system/player.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="Poca- Podcast & Audio Template">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Title -->
<title>Panic Radio</title>
<!-- Favicon -->
<link rel="icon" href="./img/core-img/favicon.ico">
<!-- Core Stylesheet -->
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Preloader -->
<div id="preloader">
<div class="preloader-thumbnail">
<img src="./img/core-img/preloader.png" alt="">
</div>
</div>
<!-- ***** Header Area Start ***** -->
<header class="header-area">
<!-- Main Header Start -->
<div class="main-header-area">
<div class="classy-nav-container breakpoint-off">
<!-- Classy Menu -->
<nav class="classy-navbar justify-content-between" id="pocaNav">
<!-- Logo -->
<a class="nav-brand" href="index.html"><img src="./img/core-img/mini logo.png" alt=""></a>
<!-- Top Social Area -->
<div class="top-social-area">
</div>
</div>
<!-- Nav End -->
</div>
</nav>
</div>
</div>
</header>
<!-- ***** Header Area End ***** -->
<!-- ***** Welcome Area Start ***** -->
<section class="welcome-area">
<!-- Welcome Slides -->
<!-- Single Welcome Slide -->
<div class="welcome-welcome-slide bg-img bg-overlay" style="background-image: url(img/bg-img/2.jpg);">
<div class="container h-100">
<div class="row h-100 align-items-center">
<div class="col-8">
<!-- Welcome Text -->
<div class="welcome-text">
<h2 data-animation="fadeInUp" data-delay="100ms">Listen Now</h2>
<!-- Music Player -->
<div class="cc_player" data-username="panicradio">Loading ...</div>
<script language="javascript" type="text/javascript" src="https://radio.streamings.gr/system/player.js"></script>
<h5 >Αν δεν παίζει,κάντε refresh </h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright ©<script>document.write(new Date().getFullYear());</script> All rights reserved | This template is made with <i class="fa fa-heart-o" aria-hidden="true"></i> by Colorlib
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. --></p>
</div>
</div>
</div>
<!-- ******* All JS ******* -->
<!-- jQuery js -->
<script src="http://panicradio.gr/js/jquery.min.js"></script>
<!-- Popper js -->
<script src="http://panicradio.gr/js/popper.min.js"></script>
<!-- Bootstrap js -->
<script src="http://panicradio.gr/js/bootstrap.min.js"></script>
<!-- All js -->
<script src="http://panicradio.gr/js/poca.bundle.js"></script>
<!-- Active js -->
<script src="http://panicradio.gr/js/default-assets/active.js"></script>
<script src="https://radio.streamings.gr/system/player.js"></script>
</body>
</html>
I've searched through the internet and haven't found any solution for the newest version of bootstrap.
I've thought of two things: Using opacity (didn't work since every other element from the Jumbotron inherits it), and setting a background image whose opacity I thought I could change later (which actually just faded from original to white, still not getting any transparency).
Is there a simple way to do this?
EDIT:
A part of my HTML:
<div class="jumbotron">
<h1 class="display-3 text-right">name</h1>
<hr class="my-4 text-right">
<p class="lead text-right">description</p>
<p class="lead text-right">
<a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a>
</p>
</div>
This could help
.jumbotron {
background: rgba(204, 204, 204, 0.5);
}
You can set the background for Jumbotron as none to achieve the transparent Jumbotron.
.jumbotron {
background: none
}
You can see the complete code at https://gist.github.com/AkashShivanand/7c1ee3fdc578844f3b3dab111d63f0be
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="How to create Transparent Jumbotron with Bootstrap V.4.0.0">
<meta name="author" content="akashshivanand.com">
<link rel="icon" href="../../../../favicon.ico">
<title>Transparent Jumbotron with Bootstrap V.4.0.0</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- Custom styles for this template -->
<style type="text/css">
body {
padding-top: 5rem; /* Provide Space from Top */
background: #942626; /* Set background color for body to justify transparency of Jumbotron */
}
.jumbotron {
background: none; /* Transparent background */
}
</style>
</head>
<body>
<main role="main" class="container">
<div class="jumbotron">
<h1 class="display-3 text-right">name</h1>
<hr class="my-4 text-right">
<p class="lead text-right">description</p>
<p class="lead text-right">
<a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a>
</p>
</div>
</main>
<!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>
You could just add bg-transparent in your html
<div class="jumbotron bg-transparent">
...
</div>
I have the following code and I am not sure why bg-info doesn't work for the whole body as I am new to bootstrap.
<!--http://v4-alpha.getbootstrap.com/getting-started/introduction/-->
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags always come first -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxAZXuh4HwSYylfB+J125MxIs6mR5FOHamPBG064zB+AFeWH94NdvaCBm8qnd" crossorigin="anonymous">
</head>
<body class="bg-info">
<div class="container text-xs-center">
<h1 class="display-1">Fullstack Conference</h1>
<p class="lead">Coming soon!! A one day conference about all things Javascript!!</p>
</div>
<div class="col-lg-6 col-lg-offset-3">
<div class="input-group">
<input type="text" class="form-control" placeholder="Enter your Email for info...">
<span class="input-group-btn">
<button class="btn btn-secondary" type="button">Sign Up!</button>
</span>
</div>
</div>
</div>
<!-- jQuery first, then Bootstrap JS. -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/js/bootstrap.min.js" integrity="sha384-vZ2WRJMwsjRMW/8U7i6PWi6AlO1L79snBrmgiDpgIWJ82z8eA5lenwvxbMV1PAh7" crossorigin="anonymous"></script>
</body>
</html>
Here's what I see:
Note: According to this video it should work though https://teamtreehouse.com/library/bootstrap-4-basics/getting-to-know-bootstrap-4/enhancing-the-page
You are using the alpha 4 of bootstrap(js), use bootstrap 3.x.
Also you have an extra </div> in the code.
This works:
<!--http://v4-alpha.getbootstrap.com/getting-started/introduction/-->
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags always come first -->
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxAZXuh4HwSYylfB+J125MxIs6mR5FOHamPBG064zB+AFeWH94NdvaCBm8qnd" crossorigin="anonymous" />
</head>
<body class="bg-info">
<div class="container text-xs-center">
<h1 class="display-1">Fullstack Conference</h1>
<p class="lead">Coming soon!! A one day conference about all things Javascript!!</p>
</div>
<div class="col-lg-6 col-lg-offset-3">
<div class="input-group">
<input type="text" class="form-control" placeholder="Enter your Email for info...">
<span class="input-group-btn">
<button class="btn btn-secondary" type="button">Sign Up!</button>
</span>
</div>
</div>
</body>
<!-- jQuery first, then Bootstrap JS. -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
</html>
What do you mean by doesn't work for the whole body? Try to add this CSS property to your custom CSS:
.bg-info {background: #5bc0de!important;
}