I would like to fill the whole free bottom space (white color) in case of display with a big width (bigger than content) so how to set css3 style to do this?
CSS:
.footer {
background-color: #FFFFFF;
line-height: 20px;
/*border-top: 1px solid #DDDDDD;*/
overflow: hidden;
}
.footer .copyright {
font-family:Lato;
color: #f6f6f6;
padding: 10px 15px;
margin: 15px 3px;
line-height: 20px;
text-align: center;
font-size:0.9em;
font-weight:400;
}
.footer-color-black,
.footer-transparent {
background-color: #595324;
color: #DDDDDD;
text-align:center;
}
https://jsfiddle.net/3re9wbr2/1/
First, adding margin: 0 to the html/body tag will give you this
html,
body {
margin: 0;
}
.footer {
background-color: #FFFFFF;
line-height: 20px;
/*border-top: 1px solid #DDDDDD;*/
overflow: hidden;
}
.footer .copyright {
font-family: Lato;
color: #f6f6f6;
padding: 10px 15px;
margin: 15px 3px;
line-height: 20px;
text-align: center;
font-size: 0.9em;
font-weight: 400;
}
.footer-color-black,
.footer-transparent {
background-color: #595324;
color: #DDDDDD;
text-align: center;
}
<div class="section">
<div class="container">
<div class="title-area">
<div class="gallerygrid">
<h5>content ldosalodaslodlsoalodslaodasol</h5>
<h5>content ldosalodaslodlsoalodslaodasol</h5>
</div>
</div>
</div>
</div>
<footer class="footer footer-big footer-color-black" data-color="black">
<div class="copyright">
©
<script>
document.write(new Date().getFullYear())
</script> · Lorem Ipsum · All Copyright reserved
</div>
</footer>
Second, adding a wrapper using display: flex with a min-width: 100vh and give the .footer flex: 1 will give you this
html,
body {
margin: 0;
}
.wrapper {
min-height: 100vh;
display: flex;
flex-direction: column;
}
.section {
}
.footer {
flex: 1;
background-color: #FFFFFF;
line-height: 20px;
/*border-top: 1px solid #DDDDDD;*/
overflow: hidden;
}
.footer .copyright {
font-family: Lato;
color: #f6f6f6;
padding: 10px 15px;
margin: 15px 3px;
line-height: 20px;
text-align: center;
font-size: 0.9em;
font-weight: 400;
}
.footer-color-black,
.footer-transparent {
background-color: #595324;
color: #DDDDDD;
text-align: center;
}
<div class="wrapper">
<div class="section">
<div class="container">
<div class="title-area">
<div class="gallerygrid">
<h5>content ldosalodaslodlsoalodslaodasol</h5>
<h5>content ldosalodaslodlsoalodslaodasol</h5>
</div>
</div>
</div>
</div>
<footer class="footer footer-big footer-color-black" data-color="black">
<div class="copyright">
©
<script>
document.write(new Date().getFullYear())
</script> · Lorem Ipsum · All Copyright reserved
</div>
</footer>
</div>
Sounds like you want a sticky footer.
Ryan Fait's method works well.
Related
Hello, I created a site but I have a problem with my buttons I think
it comes largely from the fact that I use <a> tags (impossible for
me to create from scratch starting from a tag If someone can
explain to me this way of doing things I'm interested because I've
tried many times and it's impossible for me now
I want this style of button : 1) Invite & Support button: https://i.imgur.com/U4wF4H7.png 2) Login Button in the header section:
https://i.imgur.com/rajn8eU.png But i have this style actually :
https://i.imgur.com/xbDuOe3.png
```<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Poseidon | The Perfect Discord Bot</title>
<link rel="stylesheet" href="main.css">
<link rel="icon" type="image/svg+xml" href="img/favicon.svg">
</head>
<body>
<header class="topbar">
<img class="header-logo" src="img/logo.svg" alt="Poseidon Logo" href="index.html">
<nav>
<div class="middle">
Invite
Commands
Documentation
Premium
Support
</div>
<div class="login">
Login
</div>
</nav>
</header>
<div class="circuit">
<h1 class="header_title">The Perfect <br>Discord Music Bot.</h1>
<h2 class="header_second_title">Poseidon is the only Discord bot you'll ever need!</h2>
Invite
Support
</div>
<div class="dark">
<h1>The Perfect Discord Bot.</h1>
<h2>Poseidon is the only Discord bot you'll ever need!</h2>
<h1>The Perfect Discord Bot.</h1>
<h2>Poseidon is the only Discord bot you'll ever need!</h2>
<h1>The Perfect Discord Bot.</h1>
<h2>Poseidon is the only Discord bot you'll ever need!</h2>
</div>
<div class="circuit">
<h1>The Perfect Discord Bot.</h1>
<h2>Poseidon is the only Discord bot you'll ever need!</h2>
</div>
<div id="footer">
<div class="logo">
<div class="flex">
<img class="img" src="img/logo.svg" alt="Poseidon Logo" href="index.html">
</div>
<div class="copyright">© Poseidon Bot 2012 - All Rights Reserved.</div>
</div>
<ul class="product">
<li><b>Product</b></li>
<li>Invite</li>
<li>Commands</li>
<li>Premium</li>
</ul>
<ul class="resources">
<li><b>Resources</b></li>
<li>Docs</li>
<li>Provacy</li>
<li>Refunds</li>
</ul>
<ul class="business">
<li><b>Business</b></li>
<li>Contact</li>
</ul>
<div class="design">
designed with <span style="color: red;">❤</span> by <span style="color: #00e09d;">My Discord
ID</span></div> <!-- Javascript clickable text // add function js -->
<div class="social">
<img src="https://img.icons8.com/material-sharp/24/ffffff/github.png" href="https://google.fr" />
<img src="https://img.icons8.com/material-sharp/24/ffffff/discord-logo.png" href="#" />
<img src="https://img.icons8.com/android/24/ffffff/twitter.png" href="#" />
</div>
</div>
</body>
</html>```
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body, html {
font-size: 16px;
color: rgba(0, 0, .87);
font-family: "Montserrat", sans serif;
line-height: 1.6;
margin: 0;
padding: 0;
font-weight: 500;
width: 100%;
}
.topbar {
height: 80px;
box-shadow: 0 8px 15px rgba(0, 0, 0, .05);
display: flex;
align-items: center;
width: 100%;
background-image: url(img/background.svg);
background-color: rgba(62,62,62, 1);
}
.topbar nav {
display: flex;
width: 100%;
}
.middle {
margin: 0 auto;
}
.topbar nav a {
color: #9F9F9F;
text-decoration: none;
font-weight: 500;
padding: 0 20px;
display: inline-block;
text-align: center;
font-size: 21px;
}
.topbar nav a:hover, .topbar nav a.active {
color: #94C8D0;
}
.header-logo {
padding: 0px 20px;
cursor: pointer;
width: 25vh;
}
.login_btn {
margin: auto 25px auto;
background-color: #EEEEEE;
color: #3b3b3b;
}
.circuit {
background-image: url(img/background.svg);
background-color: rgba(62,62,62, 1);
padding: 192px 0 112px;
}
.dark {
background-color: rgb(35,35,35);
padding: 192px 0 192px;
box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
}
.header_title {
text-align: center;
color: #ffffff;
font-family: 'Inter', sans-serif;
font-weight: 1000;
font-size: 72px;
word-spacing: 0px;
margin: 0px;
padding: 0px;
letter-spacing: normal;
line-height: 72px;
}
.header_second_title {
text-align: center;
color: #9F9F9F;
font-family: 'Inter';
font-size: 30px;
margin: 16px 0px 0px;
padding: 0px;
line-height: 36px;
font-weight: 500;
}
.header_btn {
display: flex;
justify-content: space-evenly;
}
.invite_btn {
display: flex;
justify-content: center;
font-size: 24px;
font-family: 'Inter';
background-color: #1A9BB6;
color: #ffffff;
border: none;
text-align: center;
text-decoration: none;
padding: 15px 32px;
}
.support_btn {
display: flex;
justify-content: center;
font-size: 24px;
font-family: 'Inter';
background-color: #EEEEEE;
color: #282828;
border: none;
text-align: center;
text-decoration: none;
padding: 15px 32px;
}
h1 {
text-align: center;
color: #9F9F9F;
}
h2 {
text-align: center;
color: #9F9F9F;
}
#footer {
font-family: sans-serif;
display: grid;
height: 20%;
background-color: black;
color: white;
grid-template-rows: 1fr;
grid-template-columns: 2fr .6fr .6fr 1fr;
grid-template-areas: "logo product resources business"
"social . . design";
}
li {
list-style: none;
padding-top: 8%;
font-size: .9em;
line-height: 1px;
}
.flex {
display: flex;
}
#footer li a {
color: rgb(22,145,176);
text-decoration: none;
}
.logo {
display: flex;
flex-direction: column;
justify-content: flex-start;
grid-area: logo;
padding-left: 1rem;
padding-top: .5rem;
}
.img {
padding-top: .5rem;
width: 25vh;
cursor: pointer;
}
.logo h4 {
line-height: 1rem;
margin-left: 2rem;
}
.copyright {
padding-top: .3rem;
font-size: 1em;
color: rgb(97,97,97);
}
.product {
grid-area: product;
font-size: 20px;
padding-top: .5rem;
}
.resources {
grid-area: resources;
font-size: 20px;
padding-top: .5rem;
}
.business {
grid-area: business;
font-size: 20px;
padding: 8px 0px 0px;
}
.social {
grid-area: social;
padding-top: 1em;
padding-left: 1em;
cursor: pointer;
}
.design {
grid-area: design;
font-size: 1em;
text-align: right;
To train myself, I decided to reproduce this website:
https://hydra.bot/ this project taught me many things despite the fact
that my current project does not correspond to 100% (Very complex for
me to reproduce it to 100% currently), I block especially on the
buttons, so if someone can help me I'm interested, thank you in
advance
You need to wrap your invite and support button in another div that has display flex property.
If you make display flex it is not going to do anything to itself, rather it modifies its child components
.container {
display: flex;
justify-content: center;
}
<div class='container'>
Invite
Support
</div>
I'm trying to draw the black border around Test1 - Test4 to also span around Test5. At the moment, Test5 falls outside. Does anyone know how to draw it to include Test5?
.description {
border: 1px solid;
}
.descriptionTop {
display: inline-block;
}
.ao {
padding: 5px;
font-weight: 700;
text-transform: uppercase;
}
.pr {
text-align: right;
float: right;
}
.pm {
border: solid 1px #53a318;
border-radius: 3px;
color: #53a318;
box-sizing: border-box;
font-size: 12px;
float: right;
padding: 2px 8px;
}
<div class="description">
<div class="descriptionTop">
<span class="descriptionLeft">Test1</span>
<span class="ao">Test2</span>
</div>
<div class="pr">
<div>
<span>Test3</span>
<span>Test4</span>
</div>
<div class="pm">Test5</div>
</div>
</div>
Add overflow: auto; to the container to include floated elements:
.description {
border: 1px solid;
overflow: auto;
}
.descriptionTop {
display: inline-block;
}
.altOffer {
padding: 5px;
font-weight: 700;
text-transform: uppercase;
}
.prices {
text-align: right;
float: right;
}
.promotion {
border: solid 1px #53a318;
border-radius: 3px;
color: #53a318;
box-sizing: border-box;
font-size: 12px;
float: right;
padding: 2px 8px;
}
<div class="description">
<div class="descriptionTop">
<span class="descriptionLeft">Test1</span>
<span class="altOffer">Test2</span>
</div>
<div class="prices">
<div>
<span>Test3</span>
<span>Test4</span>
</div>
<div class="promotion">Test5</div>
</div>
</div>
This is because .prices has float. Explanation of the problem
add the following to your css (the css of famous clearfix class) -
.description:after {
content: "";
display: table;
clear: both;
}
.description {
border: 1px solid;
}
.description:after {
content: "";
display: table;
clear: both;
}
.descriptionTop {
display: inline-block;
}
.ao {
padding: 5px;
font-weight: 700;
text-transform: uppercase;
}
.pr {
text-align: right;
float: right;
}
.pm {
border: solid 1px #53a318;
border-radius: 3px;
color: #53a318;
box-sizing: border-box;
font-size: 12px;
float: right;
padding: 2px 8px;
}
<div class="description">
<div class="descriptionTop">
<span class="descriptionLeft">Test1</span>
<span class="ao">Test2</span>
</div>
<div class="pr">
<div>
<span>Test3</span>
<span>Test4</span>
</div>
<div class="pm">Test5</div>
</div>
</div>
This is my current code and the problem now is that image3, which is the 2nd box is not showing the correct height... The following is the updated code for my style.css:
body {
margin: 0;
padding: 0;
font-family: 'Arial', 'serif';
}
.nav {
background-color: #ffffff;
color: #000000;
list-style: none;
text-align: right;
padding: 20px 0 0 0;
}
.nav > li {
display: inline-block;
padding-right: 50px;
font-size: 12px;
}
.nav > li > a {
text-decoration: none;
color: #000000;
}
.nav > li > a:hover {
color: #c1c1c1;
}
.logo {
color: black;
float: left;
padding-left: 25px;
font-size: 12px;
font-weight: bold;
}
.logo > a {
text-decoration: none;
color:black;
}
.banner {
width: 100%;
display:block;
}
.banner > .banner-image {
width: 100%;
display: block;
height: 700;
}
.service1 {
width: 298px;
border: 1px solid #c1c1c1;
margin: 20px 10px;
padding: 0 5px;
float: left;
}
.service1 > p {
font-size: 14px;
color: #636363;
max-width: 200px;
text-align: justify;
}
.services {
width: 1500px;
margin:0 auto;
}
h1 {
font-size: 16px;
font-weight: bold;
background-color: #c1c1c1;
color: #ffffff;
padding: 10px 0;
margin: 0 -6px;
}
.image {
max-width: 135px;
margin: 15px 0 0 0;
}
.heading {
text-align:center;
font-size: 25px;
color: #000000;
margin:100px 0 50px 0;
font-weight: bold;
}
.service1 > image1 {
max-width: 120;
margin: 15px 0 0 0;
}
.service1 > image3 {
max-width: 120;
margin: 15px 0 15px 0;
}
.image:hover {
opacity: 0.2;
max-width: 200px;
margin-top:15px;
}
.image1:hover {
opacity: 0.2;
max-width: 200px;
margin-top:15px;
}
.message {
text-align: center;
font-size: 30px;
font-weight: bold;
}
.message ul {
text-align: center;
list-style-position: inside;
}
This is my index.html code:
<!DOCTYPE>
<html>
<head>
<link rel="stylesheet" type ="text/css" href="style.css">
<title>Pianocourse101</title>
</head>
<body>
<ul class="nav">
<div class="logo">
Pianocourse101
</div>
<li><a href="http://localhost/pianocourse101/register.php">Register</li>
</a>
<li>Login</li>
<li>About Me</li>
<li>Contact Us</li>
<div class="banner">
<img class="banner-image" src="images/mervin.gif">
</div>
<br></br>
<br></br>
<div class="message">
<p> At Pianocourse101, you will learn the following</p>
<ul>
<li>Basic hand positions</li>
<li>Posture</li>
<li>Rhythm</li>
<li>Finger numbers</li>
<li>Letter names</li>
</ul>
</div>
<div class="heading">Services</div>
<div align="center" class="services">
<div class="service1">
<h1>Download Section: Primer Level</h1>
<img class="image1" src="images/treble.png">
<p>Access full contents for just <strong>$50!</strong> Learn the
basic hand positions, finger numbers and letter names!</p>
</div>
<div class="service1">
<h1>Download Section: Level 1</h1>
<img class="image3" src="images/bass.jpg">
<p>Access full contents for just <strong>$100!</strong> Learn some
advanced pieces, slurs and staccatos!</p>
</div>
<div class="service1">
<h1>Download Section: Level 2</h1>
<img class="image" src="images/crotchet.png">
<p>Access full contents for just <strong>$150!</strong> Progress and
play some more advanced pieces hands together!</p>
</div>
<div class="service1">
<h1>Download Section: Level 3</h1>
<img class="image2" src="images/bass.jpg">
<p>Access full contents for just <strong>200!</strong> Feeling more
confident and need a challenge? Level 3 will provide you with more
challenging pieces!</p>
</div>
</div>
<section>
</section>
<footer>
</footer>
</body>
</html>
I am not sure why I have to add more comments but I can't figure out why my second box is not lining up correctly...
/* CSS alignment is read as top, left, bottom, right*/
I've been trying and trying to get this to work. But no matter what I try, I can't get this to show up in the center.
I searched stackoverflow. I tried margin: 0 auto; and tried removing floating elements. But nothing seems to work.
I must be missing something simple. I'm not very knowledgeable about CSS. Could you please point it out?
body {
align-content: center;
text-align: center;
background-image: url(images/marble.gif);
margin: 0 auto;
}
#about {
align-content: center;
text-align: center;
width: 700px;
}
#about img {
align-content: center;
text-align: center;
border-right: black thick solid;
border-top: black thick solid;
border-left: black thick solid;
border-bottom: black thick solid;
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
margin: 3px;
padding-top: 0px;
}
#myPicture p {
align-content: center;
text-align: center;
font-weight: bold;
font-size: 11pt;
}
#myName p {
align-content: center;
text-align: center;
font-weight: bold;
font-size: 24pt;
clear: both;
margin-top: 15px;
}
<div id="about">
<div id="myPicture">
<p> </p>
<p>
<img src="images/profile2.jpg" />
</p>
</div>
<div id="myName">
<p>Dude</p>
</div>
<div id="myTitles">
<div class="myTitleClass">
<p>...
</div>
</div>
You have centered the image and the text inside div#about which is 700px wide, but the div#about itself is not centered. I added background-color: orange; to the div, so you can see what's happening here:
All you have to do is add margin: 0 auto; to div#about and you'll get this:
It's centered now. You can get rid of orange background.
Also I've shorten your CSS, check this:
body {
margin: 0;
}
#about {
width: 700px;
background-color: orange;
margin: 0 auto;
}
#about img {
border: black thick solid;
padding: 0;
margin: 3px;
}
#myPicture p {
text-align: center;
}
#myName p {
text-align: center;
font-weight: bold;
font-size: 24pt;
margin-top: 15px;
}
<div id="about">
<div id="myPicture">
<p> </p>
<p>
<img src="images/profile2.jpg" />
</p>
</div>
<div id="myName">
<p>Dude</p>
</div>
</div>
ADd margin-left:auto and margin-right:auto to your about section
Here is a fiddle
body {
width: 100%;
text-align: center;
background-image: url(images/marble.gif);
margin: 0 auto;
}
#about {
margin-left: auto;
margin-right: auto;
text-align: center;
width: 700px;
}
#about img {
text-align: center;
border-right: black thick solid;
border-top: black thick solid;
border-left: black thick solid;
border-bottom: black thick solid;
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
margin: 3px;
padding-top: 0px;
}
#myPicture p {
text-align: center;
font-weight: bold;
font-size: 11pt;
}
#myName p {
text-align: center;
font-weight: bold;
font-size: 24pt;
clear: both;
margin-top: 15px;
}
<body>
<div id="about">
<div id="myPicture">
<p> </p>
<p>
<img src="images/profile2.jpg" />
</p>
</div>
<div id="myName">
<p>Dude</p>
</div>
<div id="myTitles">
<div class="myTitleClass">
<p>...
</div>
</div>
</body>
I'm trying to align several DIVS, Images and text and I can't figure this out..
Here's what I'm trying to achieve:
Heres' my HTML
<div class="section5">
<div class="outer">
<div class="container1">
<img src="icon.png" width="85">
<div class="title1">Text</div>
<div class="subtitle1">Text</div>
</div>
<div class="container2">
<img src="iphone.png" width="375">
<div class="subtitle2">Text</div>
</div>
</div>
</div>
Here is my CSS:
.section5{ height: 525px; background-color: #5e6172; text-align: center; position: relative;}
.outer{ width: 80%; background-color: #45da45; height: 100%; margin: 0 auto; position: relative;}
.title1{color: #ffffff; font-size: 2.6em; font-family: h35; }
.subtitle1{color: #ffffff; font-size: 1.5em; font-family: h35; margin-top: 0.25em; }
.subtitle2{color: #ffffff; font-size: 1.5em; font-family: h35; margin-top: 0.25em; }
.container1{display: block; background-color: #ccc; }
.container2{display: block; background-color: #fffc1e; }
Here is the JSFIDDLE:
http://jsfiddle.net/mib92/hogwohf8/
My current problems:
1) My text at the bottom needs to be on the right side of the image.. center like in my example image.
2) the bottom of my bottom picture must be align to the bottom of container2 AND the bottom of section5
3) While doing this, the container 1 must remain in the vertical middle of the remaining space of the section5.
Thank you
I hops it's help you.
.section5 {
height: 525px;
background-color: #5e6172;
text-align: center;
position: relative;
}
.outer {
width: 80%;
background-color: #45da45;
height: 100%;
margin: 0 auto;
position: relative;
}
.title1 {
color: #ffffff;
font-size: 2.6em;
font-family: h35;
}
.subtitle1 {
color: #ffffff;
font-size: 1.5em;
font-family: h35;
margin-top: 0.25em;
}
.subtitle2 {
color: #ffffff;
font-size: 1.5em;
font-family: h35;
margin-top: 0.25em;
}
.container1 {
display: block;
background-color: #ccc;
}
.container2 {
display: block;
background-color: #fffc1e;
}
.right-sied {
display: inline-block;
vertical-align: top;
width: 41%;
}
.left-sied {
display: inline-block;
width: 49%;
}
.left-sied img {
max-width: 100%;
}
<div class="section5">
<div class="outer">
<div class="container1">
<img src="icon.png" width="85">
<div class="title1">Text</div>
<div class="subtitle1">Text</div>
</div>
<div class="container2">
<div class="left-sied">
<img src="iphone.png" width="375">
</div>
<div class="right-sied">
<div class="subtitle2">Text</div>
</div>
</div>
</div>
</div>
Live Demo
check this:
.section5 {
height: 525px;
background-color: #5e6172;
text-align: center;
position: relative;
}
.outer {
width: 80%;
background-color: #45da45;
height: 100%;
margin: 0 auto;
position: relative;
}
.title1 {
color: #ffffff;
font-size: 2.6em;
font-family: h35;
}
.subtitle1 {
color: #ffffff;
font-size: 1.5em;
font-family: h35;
margin-top: 0.25em;
}
.subtitle2 {
color: #ffffff;
font-size: 1.5em;
font-family: h35;
margin-top: 0.25em;
}
.container1 {
display: block;
background-color: #ccc;
}
.container2 {
display: block;
background-color: #fffc1e;
}
.container1 .wrapper {
display: inline-block;
float: right;
}
.container2 img {
margin: 0 auto;
}
<div class="section5">
<div class="outer">
<div class="container1">
<img src="http://images.all-free-download.com/images/graphiclarge/daisy_pollen_flower_220533.jpg" width="85">
<div class="wrapper">
<div class="title1">Text</div>
<div class="subtitle1">Text</div>
</div>
</div>
<div class="container2">
<div class="subtitle2">Text</div>
<img src="http://images.all-free-download.com/images/graphiclarge/daisy_pollen_flower_220533.jpg" width="375">
</div>
</div>
</div>