I am trying to align main content vertically center of screen. I did vertically center of div. But I was not able to do center of screen due to header. I want to do main content vertically center of screen when header is there. Any help would be appreciated.
I have built it at codeopen.io so you guys can play with it.
html {
height: 100%;
}
body {
background: #13385f;
height: 100%;
}
.nav-menu a {
color: rgba(255, 255, 255, .5);
text-decoration: none;
}
.nav-menu a.active {
color: white;
text-decoration: none;
}
.nav-menu a:hover {
color: white;
text-decoration: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-alpha1/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" />
<header>
<div class="p-3 px-md-4">
<div class="d-flex flex-column flex-md-row align-items-center container justify-content-between">
<div class="my-0 ml-md-4 mr-md-auto">
<h5 class="my-0 font-weight-normal">
<!-- <img src="assets/images/logo.png" class="img-reponsive" width="50" /> -->
<b class="text-white">LOGO</b>
</h5>
</div>
<nav class="my-2 my-md-0 mr-md-4 nav-menu">
<a class="p-2 active" href="#">Sign in</a>
<a class="p-2" href="#">Register</a>
</nav>
</div>
</div>
</header>
<main role="main" class="h-100">
<div class="container d-flex h-100 align-items-center justify-content-center">
<div class="row text-white">
I'm vertically centered
</div>
</div>
</main>
<header>
<div class="p-3 px-md-4">
<div class="d-flex flex-column flex-md-row align-items-center container justify-content-between fixed-header">
<div class="my-0 ml-md-4 mr-md-auto">
<h5 class="my-0 font-weight-normal">
<!-- <img src="assets/images/logo.png" class="img-reponsive" width="50" /> -->
<b class="text-white">LOGO</b>
</h5>
</div>
<nav class="my-2 my-md-0 mr-md-4 nav-menu">
<a class="p-2 active" href="#">Sign in</a>
<a class="p-2" href="#">Register</a>
</nav>
</div>
</div>
</header>
I think you want your header to be fixed on top if that is your problem add fixed-top class to the second div of your header to make your header fixed top. check the second div in the above code.
Related
I want to put the <hr closer to the content in the header.
I try to use position-absolute but the disappears.
This is my first project with bootstrap.
<!-- Bootstrap-5 -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<!--Body -->
<header class="header row">
<div class="d-flex justify-content-between">
<div id="logo" class="pb-2 ps-2 pe-0 col-2">
<img class="float-start py-2 ps-2 pe-2" src="assets/img/unknown.png">
<a href="#" class="sidebar-toggler flex-shrink-0" id="menu-toggle">
<i class="fa-solid fa-angle-left py-4 pe-2"></i>
</a>
</div>
<div class="col-10 row">
<h2 class="col-9 px-0 text-primary d-flex align-items-center">CHƯƠNG TRÌNH REBATE</h2>
<div class="col-3 px-0">
<div class="float-end d-flex justify-content-between">
<i class="fa fa-bell me-lg-2 d-flex align-items-center"></i>
<div class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown">
<img class="rounded-circle " src="assets/img/aTu.png" alt="" style="width: 40px; height: 40px;">
<span class="d-none d-lg-inline-flex text-primary">TuNTC23</span>
</a>
<div class="dropdown-menu bg-transparent border-0">
My Profile
Settings
Log Out
</div>
</div>
</div>
</div>
</div>
</div>
<hr style="height:1px;color:#1968B2;">
</header>
<hr style="height:1px;color:#1968B2; margin-top: -4px">
you can adjust the margin top according to your usage
I suggest you do not use the <hr> tag but a new css class or ::after to do that.
<header class="header row hr-bottom">
.hr-bottom {
border-bottom: 1px solid black;
}
OR
.hr-bottom::after {
border-bottom: 1px solid black;
}
The fastest way add class to hr for example bar
<hr class="bar" style="height:1px;color:#1968B2;">
and in CSS add class:
.bar {
transform: translateY(-10px);
}
Values up to you It may take px or procentage
So I have this code
<nav class="hhc-navbar-noshadow navMasterPageAgency">
<div class="container container-nav-master-page-agency ">
<div class="row w-100 align-items-center" >
<div class="row col-12">
<div class="col-1" style="min-width:120px;max-width:120px;width:120px"></div>
<div class="col-8 d-flex align-items-center nav-master-page-agency-links">
<a class="item-menu-famille-metier f1" href="#" >Link1</a>
<a class="item-menu-famille-metier f2" href="#" >Link2</a>
<a class="item-menu-famille-metier f3" href="#" >Link3</a>
</div>
</div>
<div class="row col-lg-1 col-xl-2 pageNameTitle">
<div class="logo-ma-team accueil" >
<img src="unsplash.it/450/150" />
</div>
</div>
</div>
</div>
</nav>
.navMasterPageAgency {
background: #F6F8FF 0% 0% no-repeat padding-box;
width: 100% !important;
height: 130px
}
.nav-master-page-agency-links {
background: #FFF 0% 0% no-repeat padding-box !important;
height: 40px;
}
The nav-master-page-agency-links should be on the top and should have #FFF background color
and the reset should be under it with another color.
The problem is the nav-master-page-agency-links is in a container and I can't make the #FFF for 100% width of the page and a the same it's position should be relative to the logo-ma-team accueil class
well I change to container-fluid it does help but the content of the reset of the page will not be aligned with the logo, because the reset of the page is in a container not container-fluid
so any idea or help? thank you
Based on my understanding of the question is that you are trying to align the content on the left side and make the .nav-master-page-agency-links full width of the web page.
This snippet should do the job:
Explanation:
I have just wrapped the containers inside a <div class="bg-colorName"></div> to make it 100% of the outer container which is .container-nav-master-page-agency. This will result in making the color expand the whole page and then shrink the content inside the .container.
.nav-master-page-agency-links {
height: 40px;
}
.bg-violet {
background: #F6F8FF 0% 0% no-repeat padding-box;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#4.0.0/dist/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="hhc-navbar-noshadow navMasterPageAgency">
<div class="container-nav-master-page-agency">
<div class="bg-white">
<div class="container">
<div class="row">
<div class="col-8 d-flex justify-space-between flex-row align-items-center nav-master-page-agency-links">
<a class="item-menu-famille-metier f1" href="#">Link1</a>
<a class="item-menu-famille-metier f2 ml-3" href="#">Link2</a>
<a class="item-menu-famille-metier f3 ml-3" href="#">Link3</a>
</div>
</div>
</div>
</div>
<div class="bg-violet py-5">
<div class="container">
<div class="row col-lg-1 col-xl-2 pageNameTitle">
<div class="logo-ma-team">
<img class="img-fluid" src="https://icons-for-free.com/download-icon-placeholder-1320568685473343206_128.ico" />
</div>
</div>
</div>
</div>
</div>
</nav>
I am trying to position an image to the right of the content area as shown in this dribble shot.
https://dribbble.com/shots/15571736-Money-Transfer-Website
Here is what I have so far.
https://codepen.io/pinapelkod/pen/RwLJJNm
.content {
position: relative;
}
.bg-image {
position: relative;
top: 350px;
left: 450px;
height: 350px;
z-index: 2;
}
When I float the image or position using top and left properties, the layout gets distorted.
By updating the bg-image class style I got the following result. If there is a different problem, specify it more clearly.
body {
background-color: white;
color: #1d2331;
}
.bg-image {
float: right !important;
width: 100%;
position: relative;
height: auto;
margin-right: -40% !important;
}
a.nav-link,
a.navbar-brand {
color: #1d2331;
}
a i {
color: #c9327b;
}
form .btn {
background-color: #1d2331;
color: #f3f1fe;
}
.action-call {
min-height: 35vh;
}
.feature {
background-color: #f3f1fe;
min-height: 56vh;
}
.feature .icon-link {
text-decoration: none;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<header>
<nav class="navbar navbar-expand-md mt-4">
<div class="container-fluid mx-5">
<a class="navbar-brand" href=""> <i class="bi bi-app-indicator me-2"></i> <strong>Fincy App</strong></a>
<div class="vr ms-0"></div>
<div class="dropdown">
<button class="btn dropdown-toggle" type=" button" id="personalbtn" data-bs-toggle="dropdown"
aria-expanded="false"><strong>Personal</strong></button>
</div>
<ul class="navbar-nav ms-auto">
<li class="nav-item me-4">
<a class="nav-link" href="#"><strong>Download</strong></a>
</li>
<li class="nav-item me-4"><a class="nav-link" href="#"> <strong>Plans</strong></a></li>
<li class="nav-item me-4"><a class="nav-link dropdown-toggle" href="#"> <strong>Product </strong></a>
</li>
</ul>
<form class="ms-5">
<button class="btn btn-outline-success px-5" type="submit">Login</button>
</form>
</div>
</nav>
</header>
<article class="content">
<img class="bg-image" src="https://pinapelkod.github.io/assets/imgs/03_1.svg" alt="">
<section class="mx-5 action-call d-flex align-items-center ">
<div class="container-fluid">
<div class="row t-row">
<h1> <strong>Send money <br>abroad more faster</strong></h1>
<div class="sendnow"></div>
</div>
</div>
</section>
<section class="feature d-flex align-items-center">
<div class="container-fluid">
<div class="mx-5 row b-row">
<div class="d-flex justify-content-start">
<div class="col-3 me-3">
<i class="fs-2 bi bi-shield-shaded"></i>
<h5> <strong>Safety guarantee</strong></h5>
<p>We make sure your money will <br>be safe 100% guarantee</p>
<a href="#" class="icon-link"> <strong>Read more</strong><i class="bi bi-chevron-right text-primary"></i>
</a>
</div>
<div class="col-3 me-3">
<i class="fs-2 bi bi-credit-card-2-front-fill"></i>
<h5> <strong>Send money in minutes</strong></h5>
<p>Your money will be sent faster <br>than your blue wallet</p>
<a href="#" class="icon-link"> <strong>Send money now</strong><i
class="bi bi-chevron-right text-primary"></i> </a>
</div>
</div>
</div>
</div>
</section>
</article>
<img style="float: right;" alt="" src="http://example.com/image.png" />
<div style="clear: right">
...text...
</div>
I restructured the html and added a bootstrap display (d-flex) class as shown below.
Update HTML structure:
<div class="d-flex mt-5">
<div class="col-3 ">
.....
</div>
<div class="col-3">
.....
</div>
<div class="col-6 content">
<img class="bg-image" src="https://pinapelkod.github.io/assets/imgs/03_1.svg" alt="">
</div>
</div>
The corresponding CSS:
.content {
position: relative;
}
.bg-image {
position: relative;
top: -310px;
left: 160px;
height: 500px;
}
Link to codepen:
https://codepen.io/pinapelkod/pen/RwLJJNm
Imagen de un diseno en UPlabs
Hi im trying to make a navbar like this but i cant finish it.
someone can help me? Only want to know how round the border of links when they are active
Now i have this resolved, but i dont know how round borders on the container of the links like we see in the design of UpLabs
Image of my project
HTML
<div id="navbar" class="sticky-top">
<div class="d-flex flex-wrap justify-content-center align-content-center" style="height: 20%;">
<img class="{{url}}" alt="">
</div>
<nav class="nav flex-column ml-4">
<a id="link" routerLink="sales" routerLinkActive="active" class="nav-link font-weight-bold">
<div class="row">
<div class="col-3 p-0 text-right">
<i class="fas fa-cash-register"></i>
</div>
<div class="col-9">
Ventas
</div>
</div>
</a>
<a id="link" routerLink="debtors" routerLinkActive="active" class="nav-link font-weight-bold">
<div class="row">
<div class="col-3 p-0 text-right">
<i class="fas fa-user-friends"></i>
</div>
<div class="col-9">
Deudores
</div>
</div>
</a>
<a id="link" routerLink="balance" routerLinkActive="active" class="nav-link font-weight-bold">
<div class="row">
<div class="col-3 p-0 text-right">
<i class="fas fa-chart-line"></i>
</div>
<div class="col-9">
Balance
</div>
</div>
</a>
<a id="link" routerLink="products" routerLinkActive="active" class="nav-link font-weight-bold">
<div class="row">
<div class="col-3 p-0 text-right">
<i class="fas fa-boxes"></i>
</div>
<div class="col-9">
Productos
</div>
</div>
</a>
</nav>
</div>
and this is the file CSS that round borders of links when they are active and other parts of desing.
div#navbar {
left: 0px;
width: 100%;
height: 100vh;
border-radius: 0 40px 40px 0;
background: #f4755f;
}
a#link {
font-size: 18px;
padding: 20px 0;
color: white;
}
.active {
background: #fbf3f2;
color: #f4755f !important;
border-radius: 30px 0 0 30px;
}
img {
width: 45%;
height: 70%;
}
Making the border of a link round is done like that:
html:
Link 1
css
a {
background: red;
border-radius: 10px 0px 0 10px;
}
To make it round only when it is active you need to add a class to the active link and style that instead of the a tag, though.
My Jumbotron cut's the text and button, when I have a low resolution.
Do I need to solve this problem with a media query?
Or is there a "nicer" solution for this? at the moment I have only media query for the width.
.hero-bg {
background-color: #2e82b0;
}
.img-logo {
max-width: 100%;
}
.jumbotron {
height: 100vh;
}
<!-- Header -->
<section id="home" class="hero-bg jumbotron">
<div class="container">
<div class="row align-items-center justify-content-center mx-auto">
<div class="col mt-0 pt-0">
<hr class="mt-0 pt-0 mb-5 sichtbar" style="background: white;">
<br>
<img class="img-logo mt-5 pt5 mx-auto img-fluid d-block img-responsive" src="assets/img/logo.png" alt="Rollywood-Logo">
</div>
</div>
<div data-aos="zoom-in" class="row align-items-end justify-content-center mx-auto text-center mt-5 pt-5">
<div class="col pb-3">
<h2 class="jumb-title">Willkommen in meiner Welt:</h2>
<p class="lead jumb-p">
Mit emotionalen Worten und kreativen Konzepten die passende Bühne bereiten. <br />
<span>Überzeugen. Begeistern. Bewegen – und der Star sind SIE!</span></p>
<a href="#texting" role="button" class="jumb-btn btn-round mt-2 smooth">
<large><span class="icon-arrow-down"></span></large>
</a>
</div>
</div>
<!-- col -->
</div>
<!-- container -->
</section>
</header>
<!-- Header -->
You should use min-height instead of height...
.jumbotron {
min-height: 100vh;
}