How to change align when resizing with Boostrap? - html

I have the following footer below using bootstrap:
.align-center {
text-align: center;
}
#footer {
background-color: #3c3d41;
color: white;
padding-top: 25px;
padding-bottom: 10px;
}
.footer-social-media-text {
text-decoration: none;
height: 25px;
color: white;
white-space: nowrap;
}
.footer-social-media-icon {
padding-right: 8px;
margin-left: 30px;
margin-right: 2px;
font-weight: bold;
height: 25px;
color: white;
}
#footer a {
-o-transition: .25s;
-ms-transition: .25s;
-moz-transition: .25s;
-webkit-transition: .25s;
transition: .25s;
}
#footer a:hover {
text-decoration: none;
color: greenyellow;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<footer id="footer">
<div class="container">
<div class="row">
<div class="col-md-3">
<a href="https://www.mycompany.com/" class="footer-social-media-text">
<i class="fa fa-home fa-2x social footer-social-media-icon"></i> My Company
</a>
</div>
<div class="col-md-9">
<a href="https://www.facebook.com" class="footer-social-media-text pull-right">
<i class="fa fa-facebook fa-2x social footer-social-media-icon"></i> Facebook
</a>
<a href="https://www.instagram.com" class="footer-social-media-text pull-right">
<i class="fa fa-instagram fa-2x social footer-social-media-icon"></i> Instagram
</a>
<a href="https://twitter.com" class="footer-social-media-text pull-right">
<i class="fa fa-twitter fa-2x social footer-social-media-icon"></i> Twitter
</a>
</div>
</div>
<hr />
<p class="align-center">© 2017 My Company</p>
</div>
</footer>
</div>
</div>
https://jsfiddle.net/coyagf2b/
My issue is the code above is that the width threshold using the bootstrap grid does not really match my expectation: <div class="col-md-3"> and <div class="col-md-9">.
Basically I would like to:
Having the right part stacking below the left part when it's the page width is heavily reduced I tried different col-md-x / col-lg-x / col-sm-x without much result...
Change the content align of the two parts to center when the right part is stacking below
How can I do that?

Bootstrap's col-xs- classes do work perfectly find with your code. If you want the right column to fall underneath the left then I would just add col-xs-12 on each of the col-md- divs you have. And you center only on mobile you can use some media queries to achieve that. Something like looks like:
#media (max-width: 991px){
.centerSection{
text-align:center;
}
}
#media (min-width: 992px){
.rightSection {
float:right;
}
}
And here is a link to a working codepen:
https://codepen.io/egerrard/pen/rGrPmM

Check this example, using .text-center, .float-md-left and .float-md-right.

Related

How to make a space between icon and text in CSS

I am learning HTML and CSS. I am practicing by designing some pages but I got a problem. I tried many ways but couldn't fix it. I want to add a space between the icon and the text so that they lock more beautiful.
Image:
CSS:
.facebook {
background: blue;
padding: 0.8rem;
padding-left: 4.1vw;
padding-right: 4.1vw;
margin-left: 0vw;
border-radius: 10px;
}
.facebook:hover {
opacity: 0.5;
}
.google {
background: red;
padding: 0.8rem;
padding-left: 4.6vw;
padding-right: 4.6vw;
margin-left: 3vw;
border-radius: 10px;
}
.google:hover {
opacity: 0.5;
}
HTML:
<div class="login-with">
<i class="fab fa-facebook">Facebook</i>
<i class="fab fa-google">Google</i>
</div>
Can you please help me to fix it. When I add a space manually the link text go to below the icon.
Full Codes link:
CSS: Full Code
HTML: Full Code
Try one of the below methods as mentioned in Fontawesome examples page
Text outside i tag, and add a space in between
<i class="fab fa-facebook"></i> Facebook
Use , below code is from Fontawesome site
<a class="list-group-item" href="#"><i class="fa fa-home fa-fw" aria-hidden="true"></i> Home</a>
If you dont want to change your markup(html) use the below CSS
.login-with > a i::before {
padding-right: 15px;
}
People usually keep the icon element as an empty node and put the text content after it. Then you add a margin to the icon to get appropriate spacing:
.facebook .fab { margin-right: 1em }
<a href="..." class="facebook">
<i class="fab fa-facebook"></i>
<span>Facebook</span>
</a>
The <span> tags are technically not necessary, but it is common to avoid text-only nodes.
Use space or &nbsp between text and icon. Also plz put ; after &nbsp
Place service name outside i tag.
You can add margin-right: 10px; styling to i element,
or display: flex; justify-content: space-between; to the a tag.
It would be best to set a base class for the social icons
/* set base class */
.social-btn {
padding: 0.8rem 4.1vw;
border-radius: 10px;
color: white;
background: gray;
text-decoration: none;
font-family: sans-serif;
}
/* space the buttons */
.social-btn + .social-btn {
margin-left: 1rem;
}
/* set icon padding */
.social-btn i {
padding-right: 0.5rem;
}
/* Modifiers */
.facebook-btn {
background: blue;
}
.google-btn {
background: red;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css" rel="stylesheet"/>
<i class="fab fa-facebook"></i>Facebook
<i class="fab fa-google"></i>Google
In Bootstrap you can use me which represents margin from end in icon
<button type="button" class="btn btn-primary"
style="width:150px;"><i class="bi bi-info-circle me-2"></i>Information</button>
Sample Code:
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons#1.10.3/font/bootstrap-icons.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
</head>
<body>
<center>
<button type="button" class="btn btn-primary" style="width:150px;"><i class="bi bi-info-circle me-2"></i>Information</button>
<br><br>
<button type="button" class="btn btn-secondary" style="width:150px;"><i class="bi bi-gear-fill me-3"></i>Settings</button>
<br><br>
<button type="button" class="btn btn-info" style="width:150px;"><i class="bi bi-person-circle me-3"></i>Profile</button>
</center>
</body>
</html>

In mobile format divs are not showing and footer is placed above than usual

enter image description here
enter image description here
#media(max-width=768px){
#contact-info .icons-detail{
float: none;
width:100%;
display: block;
height:250px;
border-bottom: #444 solid 1px;
}
}
<section id="contact-info" class="bg-dark1">
<div class="icons-detail">
<i class="fas fa-hotel fa-3x"></i>
<h2>Location</h2>
<p>50 Main Street , 10th street , boston</p>
</div>
<div class="icons-detail">
<i class="fas fa-phone fa-3x"></i>
<h2>Phone Number</h2>
<p>(555) 555-5555</p>
</div>
<div class="icons-detail">
<i class="fas fa-envelope fa-3x"></i>
<h2>Email</h2>
<p>frontdesk#hotelbt.co</p>
</div>
</section>
<div class="clr"></div>
<footer id="main-footer">
<p>Hotel BT © 2019,All rights reserved</p>
</footer>
</body>
</html>
In mobile format divs are not showing and footer is placed above than usual.i am doing it without using flexbox or grid layout.
The problem is in your media query. Put colon (:) instead of equal (=) in the media query.
#media(max-width: 768px){
#contact-info .icons-detail{
float: none;
width:100%;
display: block;
height:250px;
border-bottom: #444 solid 1px;
}
}
I think this will solve your problem.
The max-width=768px in the #media should be max-width: 768px
#media(max-width:768px){
#contact-info .icons-detail{
float: none;
width:100%;
display: block;
height:250px;
border-bottom: #444 solid 1px;
}
}

How can I do a Transparent and Fixed Footer with Social Media Icons?

I'm trying to develop a website for my band, but I cannot solve this problem. So, to put you in context, I have a footer that I want to be fixed all the time in the website. So If you want to scroll down the page, even in the top of the page you will be able to see the footer (the footer will be social media icons).
So my main problem now is that I want to have 3 different parts in my page:
1. The nav bar that will be displayed at the top of the page (if it is fixed as well as the footer, would be excellent)
2. My main/head part that will be displayed, for example, images from a gallery.
3. The footer part that I want to be fixed and will be displayed social media icons (in total 4: IG, YT, Spotify, Apple Music).
So as you can see in the image
https://imgur.com/AKFgfga
The main problem is that the footer in the bottom is collapsing the images I want to display in this page of the website. So I want to have this footer always fixed in order to not collapse the images. Does anyone know how to code that? I'd totally appreciate :D
This is the coding I'm using for the footer section:
footer {
position: fixed;
bottom: 0;
width: 99%;
text-align: center;
margin-bottom: 30px
}
.media {
display: inline-block;
width: 60px;
height: 90px;
margin: 10px;
}
.media i {
color: white;
font-size: 50px;
}
.media:hover i {
opacity: 0.7;
}
.grow {
transition: all .2s ease-in-out;
}
.grow:hover {
transform: scale(1.3);
}
<footer>
<div class="fa">
<a class="media" href="https://www.instagram.com/massaviu/" target="_blank">
<i class="fab fa-instagram grow" style="color: #E1306C"></i>
</a>
<a class="media" href="https://www.youtube.com/channel/UCh1_-QpgzIdG-3QfCMfZi6w" target="_blank">
<i class="fab fa-youtube grow" style="color: #FF0000"></i>
</a>
<a class="media" href="https://open.spotify.com/artist/0du3FPmKtQ8vfsmGYVzdFY" target="_blank">
<i class="fab fa-spotify grow" style="color: #1DB954"></i>
</a>
<a class="media" href="https://music.apple.com/us/artist/massaviu/1378812000" target="_blank">
<i class="fab fa-apple grow" style="color: #A3AAAE"></i>
</a>
</div>
</footer>

Adding a semicircle in center on top of Jumbotron

I am trying to achieve this design having a semicircle with logo inside in the center. Kindly refer to the link given below.
Image
I have tried making a semicircle using CSS but it won't be suitable for the design that I want. I have used 2 jumbotrons, one after the other. The semicircle should cover the area on both jumbotron as in the image(link mentioned above).
Any help is appreciated on how can I achieve this design.
HTML:
<div class="jumbotron">
<div class="container navheader">
<div class="social">
<i class="fa fa-facebook " aria-hidden="true"></i>
<i class="fa fa-google-plus " aria-hidden="true"></i>
<i class="fa fa-instagram " aria-hidden="true"></i>
</div>
<div class="contact-us">
<a href="">
<i class="fa fa-phone " aria-hidden="true">
<label class="icon-label">CALL 0417 949 773</label></i></a>
</div>
</div>
</div>
<div class="jumbotron other-color">
<div class="container navheader">
<div class="user-actions">
<button class="btn btn-link" data-toggle="modal" data-
target="#sign-in">
<i class="fa fa-lock" aria-hidden="true">
<label class="icon-label">SIGN IN</label>
</i>
</button>
<button class="btn btn-link" data-toggle="modal" data-
target="#sign-up">
<i class="fa fa-user " aria-hidden="true">
<label class="icon-label">CREATE AN ACCOUNT</label>
</i>
</button>
</div>
<div class="div-semicircle top"></div>
<div class="cart">
<a href=""><i class="fa fa-shopping-cart " aria-
hidden="true">
<label class="icon-label">2 ITEM(S)</label>
</i></a>
</div>
</div>
</div>
CSS:
<style>
/* Remove the navbar's default rounded borders and increase the bottom margin */
.navbar {
margin-bottom: 50px;
border-radius: 0;
}
/* Remove the jumbotron's default bottom margin */
.jumbotron {
margin-bottom: 0;
background-color: #5a9f33;
padding: 2em 1em;
}
.other-color {
margin-bottom; 0;
background-color: #67b63d;
padding: 2em 1em;
}
.navheader{
display: inline-block;
width: 100%;
}
.social, .user-actions{
float:left;
}
.contact-us, .cart{
float:right;
}
.sign-up{
background-color:#67b63d;
margin: 0 50px 50px;
padding:20px;
}
input{
padding:15px;
margin:20px;
width:85%;
}
.btn-sign{
background-color: #67b63d;
font-family: serif;
color: white;
border-radius: 30px;
font-size: 2em;
padding: 10px 50px;
margin: 20px auto;
display: block;
}
.title{
font-family: serif;
font-weight: 600;
color: #67b63d;
font-size: 3em;
margin-top:20px;
}
.div-semicircle {
background: #9e978e;
display: inline-block;
margin: 0 1em 1em 0;
}
.top,
.bottom {
height: 45px;
width: 90px;
}
.top {
border-top-left-radius: 90px ;
border-top-right-radius: 90px;
}
</style>
UPDATE:
Solution: In case anyone wants to know, refer to the sample by #bhv in the first comment for reference and tweak it as per your requirement.
first of all your posted code isn't of any help....still I'll try to give a procedure how you can achieve the linked image
create a div not with class .container
create 2 navs inside above created div
create a jumbotron below the navs inside the same div and contain it
in a div with class container
set margins as you need it between these 3 to bring them together
It is clearly visible that you dont need a semicircle..you need an ellipse use clip-path: ellipse(65px 30px at 125px 40px); someting like this to create it within same div then position it in a way you want to using css and give it highest z-index so that it renders as top-most layer.
prey that it works!! ;-)
you must use position:absolute to cover both jumbotron
add these lines of code to this class: .div-semicircle.
position: absolute;
top: 23%;
left: 40%;

How to hide div when mobile

I made an announcement div and I want it to disappear when I use the mobile version of the webpage because it occupy to much space when resized for the mobile version.
How can I hide a div when the size of the webpage becomes bigger?
for example: mobile web surfing
my code is
body {margin:0;}
.icon-bar {
width: 100%;
background-color: #0088B8;
overflow: auto;
}
.icon-bar a {
float: left;
width: 20%;
text-align: center;
padding: 12px 0;
transition: all 0.3s ease;
color: white;
font-size: 36px;
}
.icon-bar a:hover {
background-color: #0073C4;
}
.active {
background-color: #9b0a0a !important;
}
<div class="icon-bar">
<i class="fa fa-home"></i>
<i class="fa fa-search"></i>
<i class="fa fa-envelope"></i>
<i class="fa fa-globe"></i>
<i class="fa fa-trash"></i>
</div>
Maybe he is new to html and css...
Try to use css rules to achieve this, like Robert said media queries.
Put in your html head this line:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
And in your css file wirte below your div-rules (lets say your div has the id="test"):
#media only screen and (min-width: 800px) {
#test {
display: none;
}
}
Now the div is hidden when the screen width is larger than e.g. 800px.