This is on a normal window size:
And this is how it looks like when I resize window
I want to move these 2 elements from bottom to up smoothly when someone resizes the web screen. I even tried to add here an extra element between up elements and down elements, but it still doesn't work.
I know that I can use #medi" elements, but it doesn't make it move smoothly. Is there any other way to do this?
.nav-bar {
background-color: #e4e8ea;
position: fixed;
display: flex;
flex-direction: column;
justify-content: space-between;
margin-top: -20px;
width: 75px;
height: 840px;
z-index: 101;
}
.nav-bar-top {
height: 380px;
}
.nav-bar-top-button {
height: 90px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
cursor: pointer;
}
.nav-bar-top-button div {
font-family: Multiround Pro;
}
.pop {
font-size: 13px;
}
.fav {
font-size: 11px;
}
.recently {
font-size: 13px;
}
.home-button {
background: url('/Images/home-page.png') no-repeat;
background-size: 28px;
background-position: 35px 20px;
padding-top: 60px;
font-size: 15px;
padding-left: 27px;
transition: background 0.5s;
height: 90px;
width: 75px;
}
.pop-button {
background: url('/Images/popular-button.png') no-repeat;
background-size: 28px;
background-position: 27px 20px;
padding-top: 60px;
font-size: 15px;
padding-left: 9px;
transition: background 0.5s;
height: 90px;
width: 75px;
}
.fav-button {
background: url('/Images/favourite-1.png') no-repeat;
background-size: 28px;
background-position: 24px 20px;
padding-top: 60px;
font-size: 15px;
padding-left: 3px;
transition: background 0.5s;
height: 90px;
width: 75px;
}
.recently-viewed-button {
background: url('/Images/recently-viewed-1.png') no-repeat;
background-size: 28px;
background-position: 24px 13px;
padding-top: 51px;
font-size: 15px;
transition: background 0.5s;
height: 90px;
width: 75px;
text-align: center;
}
.nav-bar-middle {
flex: 1;
max-height: 10px;
display: flex;
align-items: center;
}
.nav-bar-bottom {
height: 200px;
width: 75px;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
}
.nav-bar-bottom-button {
height: 90px;
width: 75px;
cursor: pointer;
}
.nav-bar-bottom div {
font-family: Multiround Pro;
}
.support-button {
font-size: 14px;
}
.support-button,
.setting-button {
padding-top: 40px;
}
.support-button {
background: url('/Images/support-1.png') no-repeat;
background-size: 28px;
background-position: 24px 20px;
padding: 60px 0px 0px 4px;
transition: background 0.5s;
height: 90px;
width: 75px;
}
.setting-button {
background: url('/Images/settings.png') no-repeat;
background-size: 28px;
background-position: 24px 20px;
padding: 60px 0px 0px 4px;
transition: background 0.5s;
height: 90px;
width: 75px;
}
<nav class="nav-bar">
<div class="nav-bar-top">
<div class="nav-bar-top-button">
<div class="home-button" title="Home">
<div>Home</div>
</div>
</div>
<div class="nav-bar-top-button">
<div class="pop-button">
<div class="pop">Popular</div>
</div>
</div>
<div class="nav-bar-top-button">
<div class="fav-button">
<div class="fav">Favourites</div>
</div>
</div>
<div class="nav-bar-top-button">
<div class="recently-viewed-button">
<div class="recently">Recently viewed</div>
</div>
</div>
</div>
<div class="nav-bar-middle">
<div></div>
</div>
<div class="nav-bar-bottom">
<div class="nav-bar-bottom-button">
<div class="support-button">Support</div>
</div>
<div class="nav-bar-bottom-button">
<div class="setting-button">Setting</div>
</div>
</div>
</nav>
Related
This question already has answers here:
How can I vertically center a div element for all browsers using CSS?
(48 answers)
Closed 9 months ago.
I currently have two divs in each other and I want to center the parent div on the page so that no matter if I zoom in/out the parent div will always be in the center of the page.
.marioHeader {
background-image: url("resources/marioBackground.jpg");
background-size: 1800px;
background-position: bottom;
display: flex;
justify-content: center;
align-items: center;
background-repeat: repeat-x;
background-color: #2596be;
margin-top: 50px;
text-align: center;
flex-direction: column;
border-style: solid;
border-width: 10px;
margin-bottom: 350px;
max-width: 1800px;
margin-left: auto;
margin-right: auto;
}
.headermario {
background-image: url("resources/banner.png");
background-size: 600px;
background-repeat: no-repeat;
background-position: bottom;
background-color: red;
height: 200px;
width: 90%;
margin-bottom: 100px;
border-style: solid;
border-width: 10px;
}
.topnav {
overflow: hidden;
display: flex;
justify-content: center;
margin-top: 230px;
}
<div class="marioHeader"><h1 class="title">Super Mario</h1><div class="headermario"><div class="topnav">AboutHistory</div></div></div>
<div class="marioHeader">
<h1 class="title">Super Mario</h1>
<div class="headermario">
<div class="topnav">
About
History
</div>
</div>
</div>
It looks like this now:
But I want it to look like this:
Added everything to a single html file. Commented some of the existing css which defined margin for the container. And added
width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center;
to make it center. The basic idea is to containe the the div and move the div to the center of the container.
Happy hacking. Cheers.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Super Mario</title>
<style type="text/css">
#charset "utf-8";
/* CSS Document */
.nav {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
padding-top: 60px;
transition: 0.5s;
}
.nav a {
padding: 8px 8px 30px 65px;
text-decoration: none;
font-size: 35px;
color: #818181;
display: block;
transition: 0.3s;
font-weight: 500;
}
.nav a:hover {
color: #f1f1f1;
}
.nav .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
margin-left: 50px;
}
.menu {
font-size: 1.8vw;
position: absolute;
font-weight: bolder;
}
#main {
transition: margin-left .5s;
/* padding: 10px; */
}
#media screen and (max-height: 450px) {
.nav {
padding-top: 15px;
}
.nav a {
font-size: 18px;
}
}
.headerText {
text-align: center;
}
.marioHeader {
background-image: url("resources/marioBackground.jpg");
background-size: 1800px;
/* height: 450px; */
background-position: bottom;
display: flex;
justify-content: center;
align-items: center;
background-repeat: repeat-x;
background-color: #2596be;
margin-top: 50px;
text-align: center;
flex-direction: column;
border-style: solid;
border-width: 10px;
/* margin-bottom: 350px; */
max-width: 1800px;
/* margin-left: auto;
margin-right: auto; */
}
.title {
font-size: 50px;
font-weight: bolder;
}
.headermario {
background-image: url("resources/banner.png");
background-size: 600px;
background-repeat: no-repeat;
background-position: bottom;
background-color: red;
height: 200px;
min-width: 70%;
margin-bottom: 100px;
border-style: solid;
border-width: 10px;
}
.topnav {
overflow: hidden;
display: flex;
justify-content: center;
margin-top: 230px;
}
.topnav a {
float: left;
color: red;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 23px;
border-left: 1px solid;
border-right: 1px solid;
text-shadow: #000 0px 0px 1px, #000 0px 0px 1px, #000 0px 0px 1px, #000 0px 0px 1px, #000 0px 0px 1px, #000 0px 0px 1px, #000 0px 0px 1px, #000 0px 0px 1px;
}
.topnav a:hover {
background-color: #ddd;
color: black;
}
.menu {
cursor: pointer;
}
.aboutp {
width: 1000px;
text-align: center;
display: block;
margin: auto;
}
.mario {
display: block;
margin-left: auto;
margin-right: auto;
width: 200px;
}
.topContent {
background-color: red;
height: 100px;
width: 70%;
margin: auto;
justify-content: center;
align-items: center;
display: flex;
max-width: 700px;
}
.mainContent {
height: 100%;
width: 100%;
margin: 0 auto 50px;
justify-content: center;
align-items: center;
display: flex;
flex-wrap: wrap;
max-width: 768px;
}
.left {
width: 15%;
}
.right {
width: 15%;
}
.center {
width: 70%;
background-color: antiquewhite;
min-height: 50%;
}
.bottom {
background-color: red;
width: 100%;
height: 100px;
max-width: 1800px;
margin: auto;
}
body {
background-color: saddlebrown;
margin: 0 auto;
display: flex;
flex-direction: column;
}
.mariogif {
float: right;
width: 200px;
margin: auto 20px auto 10px;
}
</style>
<script type="text/javascript">
function openNav() {
document.getElementById("nav").style.width = "250px";
document.getElementById("main").style.marginLeft = "250px";
}
function closeNav() {
document.getElementById("nav").style.width = "0";
document.getElementById("main").style.marginLeft = "0";
}
</script>
</head>
<body>
<div id="nav" class="nav">
×
Home
About
History
</div>
<span class="menu" onclick="openNav()">☰ Menu</span>
<div id="main" style="width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center;">
<div class="marioHeader" style="width: 70%">
<h1 class="title">Super Mario</h1>
<div class="headermario">
<div class="topnav">
About
History
</div>
</div>
</div>
</div>
</body>
</html>
Remove margins on .marioHeader then nest the code in a .container. with a min-height: 100vh;. Then you can set display: flex; on this new parent container with align-items: center; and justify-content: center; to get it centered.
.marioHeader {
background-image: url("resources/marioBackground.jpg");
background-size: 1800px;
background-position: bottom;
display: flex;
justify-content: center;
align-items: center;
background-repeat: repeat-x;
background-color: #2596be;
width: 100%;
text-align: center;
flex-direction: column;
border-style: solid;
border-width: 10px;
max-width: 1800px;
}
.headermario {
background-image: url("resources/banner.png");
background-size: 600px;
background-repeat: no-repeat;
background-position: bottom;
background-color: red;
height: 200px;
width: 90%;
margin-bottom: 100px;
border-style: solid;
border-width: 10px;
}
.topnav {
overflow: hidden;
display: flex;
justify-content: center;
}
.container {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
<div class="container">
<div class="marioHeader">
<h1 class="title">Super Mario</h1>
<div class="headermario">
<div class="topnav">
About
History
</div>
</div>
</div>
</div>
I dont want blur on button but hover make button blured. I make some z-index positions like 1-2 but doesnt work.
You can see error in snippet I just want blur main-card but doesnt work blur.
How can I fix button blur?
I just try z-index and child on css but i cant make.
I am newbie on CSS Thanks for help.
For editing:
JS Fiddle
CODE:
.main-card{
width: 326px;
height: 360px;
background-color: white;
border-radius: 15px;
display: inline-grid;
margin: 60px;
padding-bottom: 21px;
z-index: 1;
}
.main-card:hover{
webkit-filter: blur(1px); /* Chrome, Safari, Opera */
filter: blur(1px);
}
.rafflelink{
filter: blur(0px);
z-index: 2;
}
.main-card > .rafflelink{
opacity: 0;
height: 50px;
position: absolute;
width: 200px;
align-self: center;
justify-self: center;
z-index: 2;
}
.main-card:hover > .rafflelink{
opacity: 1;
filter: none;
}
.header-card{
font-family: 'Poppins', sans-serif;
text-align: center;
height: 20px;
background-color: white;
border-top-left-radius:15px ;
border-top-right-radius:15px ;
}
.img-bg-card{
background-color:#0779e4;
text-align: center;
}
.img{
height: 157px;
padding-top: 5px;
width: 95%;
}
.progress-bar{
height: 16px;
background-color: grey;
border:solid 2px #0779e4;
}
.price-bar{
text-align: center;
justify-content: space-between;
display: -webkit-flex;
border-bottom: solid 2px cornflowerblue;
margin-left: 40px;
margin-right: 40px;
margin-top: 15px;
padding-right: 5px;
padding-left: 5px;
}
.ticket-bar{
text-align: center;
justify-content: space-between;
display: -webkit-flex;
border-bottom: solid 2px cornflowerblue;
margin-left: 40px;
margin-right: 40px;
margin-top: 15px;
padding-right: 5px;
padding-left: 5px;
}
.date-bar{
text-align: center;
justify-content: space-between;
display: -webkit-flex;
border-bottom: solid 2px cornflowerblue;
margin-left: 40px;
margin-right: 40px;
margin-top: 15px;
padding-right: 5px;
padding-left: 5px;
}
.price-left,.ticket-left,.date-left{
font-family: 'Poppins', sans-serif;
}
.price-right,.ticket-right,.date-right{
font-family: 'Poppins', sans-serif;
}
body {
width: 100%;
height: 100%;
background-color: #0695ff;
}
<body>
<div class="main" style="text-align: -webkit-center; padding-bottom: 60px;">
<div class="main-card">
<button class="rafflelink" href="/urun/Random Random Random">Random Click</button>
<div class="header-card">Random Random Random</div>
<div class="img-bg-card">
<img class="img" src="">
</div>
<div class="progress-bar"></div>
<div class="price-bar">
<div class="price-left">Random Price:</div>
<div class="price-right">1</div>
</div>
<div class="ticket-bar">
<div class="ticket-left">Random Ticket:</div>
<div class="ticket-right">10000</div>
</div>
<div class="date-bar">
<div class="date-left">Random Date:</div>
<div class="date-right">05/06/2021</div>
</div>
</div>
</div>
</body>
First add position: relative to .main-card so that position: absolute buttons work correctly.
Change selector .main-card:hover to selector .main-card:hover > *. This is necessary in order to blur the children, but not the .main-card in general. Like this:
.main-card:hover > * {
webkit-filter: blur(1px); /* Chrome, Safari, Opera */
filter: blur(1px);
}
And remove .rafflelink {} from css - this selector makes no sense.
.main-card {
width: 326px;
height: 360px;
background-color: white;
border-radius: 15px;
display: inline-grid;
margin: 60px;
padding-bottom: 21px;
z-index: 1;
position: relative;
}
.main-card:hover > * {
webkit-filter: blur(1px); /* Chrome, Safari, Opera */
filter: blur(1px);
}
/*.rafflelink {
filter: blur(0px);
z-index: 2;
}*/
.main-card > .rafflelink {
opacity: 0;
height: 50px;
position: absolute;
width: 200px;
align-self: center;
justify-self: center;
z-index: 2;
}
.main-card:hover > .rafflelink {
opacity: 1;
filter: none;
}
.header-card {
font-family: "Poppins", sans-serif;
text-align: center;
height: 20px;
background-color: white;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
}
.img-bg-card {
background-color: #0779e4;
text-align: center;
}
.img {
height: 157px;
padding-top: 5px;
width: 95%;
}
.progress-bar {
height: 16px;
background-color: grey;
border: solid 2px #0779e4;
}
.price-bar {
text-align: center;
justify-content: space-between;
display: -webkit-flex;
border-bottom: solid 2px cornflowerblue;
margin-left: 40px;
margin-right: 40px;
margin-top: 15px;
padding-right: 5px;
padding-left: 5px;
}
.ticket-bar {
text-align: center;
justify-content: space-between;
display: -webkit-flex;
border-bottom: solid 2px cornflowerblue;
margin-left: 40px;
margin-right: 40px;
margin-top: 15px;
padding-right: 5px;
padding-left: 5px;
}
.date-bar {
text-align: center;
justify-content: space-between;
display: -webkit-flex;
border-bottom: solid 2px cornflowerblue;
margin-left: 40px;
margin-right: 40px;
margin-top: 15px;
padding-right: 5px;
padding-left: 5px;
}
.price-left,
.ticket-left,
.date-left {
font-family: "Poppins", sans-serif;
}
.price-right,
.ticket-right,
.date-right {
font-family: "Poppins", sans-serif;
}
body {
width: 100%;
height: 100%;
background-color: #0695ff;
}
<body>
<div class="main" style="text-align: -webkit-center; padding-bottom: 60px;">
<div class="main-card">
<button class="rafflelink" href="/urun/Random Random Random">Random Click</button>
<div class="header-card">Random Random Random</div>
<div class="img-bg-card">
<img class="img" src="">
</div>
<div class="progress-bar"></div>
<div class="price-bar">
<div class="price-left">Random Price:</div>
<div class="price-right">1</div>
</div>
<div class="ticket-bar">
<div class="ticket-left">Random Ticket:</div>
<div class="ticket-right">10000</div>
</div>
<div class="date-bar">
<div class="date-left">Random Date:</div>
<div class="date-right">05/06/2021</div>
</div>
</div>
</div>
</body>
I am running into some issues with resizing of the window (shrinking). When I shrink it down, the background colors no longer stay at the edge of the viewport, and content goes beyond it.
I thought that setting the width on the entire body to 100% would fix that, but it didn't?
Here is a JSFiddle of my current code, for the index page and the stylesheet:
* {
margin: 0;
padding: 0;
}
body {
font-family: Segoe UI, helvetica, arial;
display: flex;
flex-direction: column;
min-height: 100vh;
font-size: 18px;
width: 100%;
}
a {
color: hsl(344, 69%, 70%);
font-weight: bold;
}
a:hover {
text-decoration: none;
color: #67c3b2;
}
.menu-container {
background-color: rgba(150, 150, 150, 0.2);
padding: 20px 0;
display: flex;
justify-content: center;
text-transform: uppercase;
width: 100%;
}
.menu {
width: 90%;
display: flex;
top: 10px;
justify-content: space-between;
font-size: 16px;
overflow: hidden;
position: relative;
left: 10px;
}
.header-container {
background-color: rgba(150, 150, 150, 0.2);
display: flex;
justify-content: center;
height: 30px;
width: 100%;
position: relative;
}
.logo {
position: relative;
bottom: 37px;
z-index: 1;
}
.flex-container {
display: flex;
justify-content: center;
}
.flex-container p {
position: relative;
margin-left: 40px;
margin-right: 40px;
font-weight: bold;
top: 40px;
margin-top: 40px;
text-align: center;
}
.main {
display: flex;
color: #464646;
background: linear-gradient(to right, #77C9D4, #57BC90);
flex: 1;
}
.cakelist {
position: relative;
bottom: 50px;
display: flex;
font-weight: bold;
list-style-position: inside;
margin-top: 130px;
}
.cakelist ol,
table {
margin-left: 25px;
}
.cakelist h2 {
margin-left: 25px;
margin-top: 20px;
}
.carousel {
color: #464646;
top: 80px;
position: relative;
display: flex;
justify-content: center;
border: 3px outset gray;
align-items: center;
padding: 60px 60px 60px 60px;
}
.buttons {
position: relative;
width: 1600px;
margin-right: 25px;
justify-content: space-around;
display: flex;
top: 160px;
text-align: center;
}
.button a:hover {
opacity: 0.2;
}
.buttons p {
margin-top: 20px;
}
.buttons img {
padding-top: 25px;
height: 200px;
}
.gallery {
position: relative;
top: 80px;
}
.pricing {
display: flex;
position: relative;
top: 80px;
justify-content: center;
flex-direction: column;
padding-bottom: 140px;
}
.pricing p,
h1 {
margin-left: 250px;
text-align: left;
margin-top: 5px;
}
.pricing span {
opacity: 0;
user-select: none;
}
.order {
position: relative;
border-radius: 5px;
background: hsl(344, 69%, 70%);
top: 20px;
margin-top: 60px;
padding: 5px;
}
#order-link {
color: white;
text-decoration: none;
}
.order-button {
width: 180px;
margin-left: auto;
margin-right: auto;
text-align: center;
}
.footer-container {
display: flex;
justify-content: flex-end;
align-items: center;
background: #9A9A9A;
height: 90px;
max-height: 90px;
}
.footer-logo {
height: 80px;
position: relative;
right: 10px;
}
.subscribe {
border-radius: 25px;
background: hsl(344, 69%, 70%);
padding: 5px 20px 5px 20px;
width: 80px;
}
#subscribe-link {
position: relative;
color: white;
text-decoration: none;
right: 40px;
}
<div class="menu-container">
<div class="menu">
<div class="flex-item">About Us</div>
<div class="flex-item">Cakes</div>
<div class="flex-item">Cupcakes</div>
<div class="flex-item">Gallery</div>
<div class="flex-item">Prices/Order</div>
<div class="flex-item">Search</div>
</div>
</div>
<header class="header-container">
<img src="TCCLogo.png" class="logo" />
</header>
<div class="flex-container main">
<div class="container">
<div class="carousel">
Here is where I will have the quick gallery/carousel when I get to JS.
</div>
<div class="buttons">
<div class="button">
<img src="cake.png" />
<p>Check out our delicious cake options!</p>
</div>
<div class="button">
<img src="cupcake.png" />
<p>Check out our delicious cupcake options!</p>
</div>
<div class="button">
<img src="prices.png" />
<p>Check out our competitive pricing!</p>
</div>
</div>
</div>
</div>
<footer class="footer-container">
<a id="subscribe-link" target="_blank" href="#">
<div class="subscribe">
<p>Subscribe</p>
</div>
</a>
<img src="TCCLogo.png" class="footer-logo" />
</footer>
I have tried going through my stylesheet, changing the widths on anything I have set with pixels to percentages, but it didn't seem to fix it. The only thing that -sort of- worked was changing the body position to fixed, but then none of the content was view-able if it got shrunk down, all it fixed was keeping the background/header/footer colors the same.
I imagine maybe my coding is a bit messy - I tried my best to be extensible, but being 100% new at this made it difficult.
Your problem is that you have width:1600px in .buttons just remove it and also add box-sizing:border-box to all (pseudo-)elements
EDIT:
you also need to add max-width:100% to .container and flex-wrap:wrap in .buttons
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box
}
body {
font-family: Segoe UI, helvetica, arial;
display: flex;
flex-direction: column;
min-height: 100vh;
font-size: 18px;
}
a {
color: hsl(344, 69%, 70%);
font-weight: bold;
}
a:hover {
text-decoration: none;
color: #67c3b2;
}
.menu-container {
background-color: rgba(150, 150, 150, 0.2);
padding: 20px 0;
display: flex;
justify-content: center;
text-transform: uppercase;
width: 100%;
}
.menu {
width: 90%;
display: flex;
top: 10px;
justify-content: space-between;
font-size: 16px;
overflow: hidden;
position: relative;
left: 10px;
}
.header-container {
background-color: rgba(150, 150, 150, 0.2);
display: flex;
justify-content: center;
height: 30px;
width: 100%;
position: relative;
}
.logo {
position: relative;
bottom: 37px;
z-index: 1;
}
.flex-container {
display: flex;
justify-content: center;
}
.flex-container p {
position: relative;
margin-left: 40px;
margin-right: 40px;
font-weight: bold;
top: 40px;
margin-top: 40px;
text-align: center;
}
.main {
display: flex;
color: #464646;
background: linear-gradient(to right, #77C9D4, #57BC90);
flex: 1;
}
.cakelist {
position: relative;
bottom: 50px;
display: flex;
font-weight: bold;
list-style-position: inside;
margin-top: 130px;
}
.cakelist ol,
table {
margin-left: 25px;
}
.cakelist h2 {
margin-left: 25px;
margin-top: 20px;
}
.container {
max-width: 100%
}
.carousel {
color: #464646;
top: 80px;
position: relative;
display: flex;
justify-content: center;
border: 3px outset gray;
align-items: center;
padding: 60px;
}
.buttons {
position: relative;
margin-right: 25px;
justify-content: space-around;
display: flex;
flex-wrap: wrap;
top: 160px;
text-align: center;
}
.button a:hover {
opacity: 0.2;
}
.buttons p {
margin-top: 20px;
}
.buttons img {
padding-top: 25px;
height: 200px;
}
.gallery {
position: relative;
top: 80px;
}
.pricing {
display: flex;
position: relative;
top: 80px;
justify-content: center;
flex-direction: column;
padding-bottom: 140px;
}
.pricing p,
h1 {
margin-left: 250px;
text-align: left;
margin-top: 5px;
}
.pricing span {
opacity: 0;
user-select: none;
}
.order {
position: relative;
border-radius: 5px;
background: hsl(344, 69%, 70%);
top: 20px;
margin-top: 60px;
padding: 5px;
}
#order-link {
color: white;
text-decoration: none;
}
.order-button {
width: 180px;
margin-left: auto;
margin-right: auto;
text-align: center;
}
.footer-container {
display: flex;
justify-content: flex-end;
align-items: center;
background: #9A9A9A;
height: 90px;
max-height: 90px;
}
.footer-logo {
height: 80px;
position: relative;
right: 10px;
}
.subscribe {
border-radius: 25px;
background: hsl(344, 69%, 70%);
padding: 5px 20px 5px 20px;
width: 80px;
}
#subscribe-link {
position: relative;
color: white;
text-decoration: none;
right: 40px;
}
<div class="menu-container">
<div class="menu">
<div class="flex-item">About Us</div>
<div class="flex-item">Cakes</div>
<div class="flex-item">Cupcakes</div>
<div class="flex-item">Gallery</div>
<div class="flex-item">Prices/Order</div>
<div class="flex-item">Search</div>
</div>
</div>
<header class="header-container">
<img src="TCCLogo.png" class="logo" />
</header>
<div class="flex-container main">
<div class="container">
<div class="carousel">
Here is where I will have the quick gallery/carousel when I get to JS.
</div>
<div class="buttons">
<div class="button">
<img src="cake.png" />
<p>Check out our delicious cake options!</p>
</div>
<div class="button">
<img src="cupcake.png" />
<p>Check out our delicious cupcake options!</p>
</div>
<div class="button">
<img src="prices.png" />
<p>Check out our competitive pricing!</p>
</div>
</div>
</div>
</div>
<footer class="footer-container">
<a id="subscribe-link" target="_blank" href="#">
<div class="subscribe">
<p>Subscribe</p>
</div>
</a>
<img src="TCCLogo.png" class="footer-logo" />
</footer>
I have made it proper as you needed. And it's working for me.
Please add below css
.container, .buttons {
max-width: 100%;
}
My text is pushing div element that contains them below.
slidepassos{
position: relative;
height: 100vh;
width: 100%;
background: rgba(0,0,0,1);
float: left;
margin-top: -1px;
}
#anchorHow{
margin-top: 65px;
width: 100%;
float: left;
}
.swipe {
overflow: hidden;
visibility: hidden;
position: relative;
}
.swipe-wrap{
overflow: hidden;
position: relative;
}
.swipe-wrap > div {
float: left;
width: 100%;
position: relative;
}
.passo-um{
height: 100vh;
width: 100%;
background: #000101;
}
.passoumback{
height: 100%;
width: 100%;
background-image: url("../img/passoumu.jpg");
background-position: top center;
}
.passoumgrad{
height: 100vh;
width: 100%;
background: rgba(0,37,63,0.7);
}
.passo-um h1{
color: white;
font-weight: bold;
font-size: 45px;
text-align: center;
}
.passo-um h2{
color: #EBAC00;
font-weight: bolder;
font-size: 53px;
text-align: center;
margin-top: 15px;
margin-left: 35%;
}
.passo-um p{
color: white;
padding: 18px 8%;
font-size: 20px;
font-weight: lighter;
text-align: center;
margin-top: 23px;
float: left;
}
.passoumilu {
width: 300px;
float: left;
margin-left: 9%;
margin-top: 50px;
}
.swipeleftcontent{
z-index: 1;
background-size: 60px 60px;
margin-left: 157px;
width: 60px;
height: 60px;
position: absolute;
bottom: 14%;
}
<div id="slidepassos" class="swipe slidepassos">
<div class="swipe-wrap">
<div class="mySlides">
<div class="passo-um">
<h1>How?</h1>
<h2>Step 1:</h2>
<img src="img/passoumilu.svg" class="passoumilu">
<p>Do your coach oriented WOD. Remember, know your limits and try to break them.</p>
<div class="passoumback">
<div class="passoumgrad"></div>
</div>
<img src="img/swipeleft.png" class="swipeleftcontent">
</div>
</div>
</div>
</div>
image showing the text on top of the DIV instead inside it.
example
Ive tried to mess with the floats, and inline-blocks, but nothing affects it. Dont know how to fix it.
yesterday I posted a question asking how can I center a div inside a div... Now I have another problem, I want to center a div on the screen. I want it to be in the middle and to take up 50% of the screen;
Here is a pic of the problem:
As you can see there isn't anything in the middle of the screen, that is my problem. Here is my HTML code:
* {
font-size: 100%;
font-family: Serif;
}
body {
background: url("images/background.jpg") repeat;
font-size: 100%;
}
.items {
background-color: rgba(0,0,0,.5);
width: 100%;
text-align: center;
margin: 0;
}
#basicInfo{
background-color: rgba(255,150,0,.8);
width: 100px;
height: 100px;
display: inline-block;
margin-top: 10px;
margin-bottom: 10px;
}
#basicInfo:hover{
background-color: rgba(255,150,0,1);
}
#basicInfo img{
display: block;
margin-left: auto;
margin-right: auto;
padding-top: 16px;
}
#langs{
background-color: rgba(255,150,0,.8);
width: 100px;
height: 100px;
display: inline-block;
margin-top: 10px;
margin-bottom: 10px;
}
#langs img{
display: block;
margin-left: auto;
margin-right: auto;
padding-top: 16px;
}
#langs:hover{
background-color: rgba(255,150,0,1);
}
.navbar {
background-color: rgba(0,0,0,0.1);
position: fixed;
bottom: 0px;
left: 0px;
right: 0px;
width: 100%;
min-height: 5%;
}
.button{
background-color: rgba(0,0,0,.5);
font-size: 2em;
color: white;
width: 33%;
margin: 0 .16%;
height: 100%;
float: left;
}
.button:hover{
background-color: rgba(0,0,0,.7);
}
.button a{
text-decoration: none;
display: block;
color: white;
text-align: center;
vertical-align: middle;
}
#textSpace {
background-color: rgba(0,0,0, .5);
width: 100%;
height: 50%;
display: block;
top: auto;
bottom: auto;
}
<title>Mateo's About Page</title>
</head>
<body>
<div class="items">
<div id="basicInfo">
<img src="images/question.png">
</div>
<div id="langs">
<img src="images/code.jpg">
</div>
</div>
<div id="textSpace">
</div>
<div class="navbar">
<div class="button">
<b>Mateo</b>
</div>
<div class="button">
<b>Home</b>
</div>
<div class="button">
<b>Josh</b>
</div>
</div>
Any help is apriciated! Thanks in advance!
To horizontally centre a div in the middle of the screen use:
margin-left:auto;
margin-right:auto;