This question already has answers here:
What is a clearfix?
(10 answers)
What methods of ‘clearfix’ can I use?
(29 answers)
Closed 2 years ago.
I'm creating a simple chat app with Bootstrap 4 and I'm having difficulty with a static footer. The messages are getting hidden behind the footer. How can I make it so that the messages do not get put underneath the input box/footer?
.content {
margin-bottom: 100px;
}
.message {
float: left;
padding: 10px;
border-radius: 17px;
background: #e8e8f8;
margin: 13px 11px 0 11px;
clear: both;
}
.my-message {
float: right;
}
.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 100px;
text-align: center;
}
.input-form {
position: absolute;
bottom: 0;
text-align: center;
width: 100%;
margin-bottom: 15px;
border-radius: 10px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="content">
<nav class="navbar navbar-dark bg-dark blue fixed-top">
<span class="navbar-brand mb-0 h1"><img style="margin-top: -5px;" /> Chat</span>
</nav>
<div class="container" style="padding-top: 85px;">
<div class="message">
<table>
<tr><td><b>Other User</b><td></tr>
<tr><td>Hello.<td></tr>
</table>
</div>
<div class="message my-message">
<table>
<tr><td><b>User</b><td></tr>
<tr><td>Hello!<td></tr>
</table>
</div>
<div class="message">
<table>
<tr><td><b>Other User</b><td></tr>
<tr><td>Hello.<td></tr>
</table>
</div>
<div class="message my-message">
<table>
<tr><td><b>User</b><td></tr>
<tr><td>Hello!<td></tr>
</table>
</div>
<div class="message">
<table>
<tr><td><b>Other User</b><td></tr>
<tr><td>Hello.<td></tr>
</table>
</div>
<div class="message my-message">
<table>
<tr><td><b>User</b><td></tr>
<tr><td>Hello!<td></tr>
</table>
</div>
<div class="message">
<table>
<tr><td><b>Other User</b><td></tr>
<tr><td>Hello.<td></tr>
</table>
</div>
<div class="message my-message">
<table>
<tr><td><b>User</b><td></tr>
<tr><td>Hello!<td></tr>
</table>
</div>
<div class="message">
<table>
<tr><td><b>Other User</b><td></tr>
<tr><td>Hello.<td></tr>
</table>
</div>
<div class="message my-message">
<table>
<tr><td><b>User</b><td></tr>
<tr><td>Hello!<td></tr>
</table>
</div>
</div>
</div>
<div class="footer">
<form class="input-form">
<div>
Please wait for a user to join ...
</div>
<div class="input-group mb-1 px-2">
<input type="text" class="form-control" id="message" name="message" placeholder="Type your message" required>
<div class="input-group-append">
<button class="btn btn-success" type="submit" id="sendmessage">Send</button>
</div>
</div>
</form>
</div>
The problem is your .messages are floating, so you need to clear them on the the .content container. I added an ::after element to clear, and padding instead of margin to the .content container.
.content {
padding-bottom: 100px;
}
.content::after {
content: '';
display: block;
clear: both;
}
.message {
float: left;
padding: 10px;
border-radius: 17px;
background: #e8e8f8;
margin: 13px 11px 0 11px;
clear: both;
}
.my-message {
float: right;
}
.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 100px;
text-align: center;
}
.input-form {
position: absolute;
bottom: 0;
text-align: center;
width: 100%;
margin-bottom: 15px;
border-radius: 10px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="content">
<nav class="navbar navbar-dark bg-dark blue fixed-top">
<span class="navbar-brand mb-0 h1"><img style="margin-top: -5px;" /> Chat</span>
</nav>
<div class="container" style="padding-top: 85px;">
<div class="message">
<table>
<tr>
<td><b>Other User</b>
<td>
</tr>
<tr>
<td>Hello.
<td>
</tr>
</table>
</div>
<div class="message my-message">
<table>
<tr>
<td><b>User</b>
<td>
</tr>
<tr>
<td>Hello!
<td>
</tr>
</table>
</div>
<div class="message">
<table>
<tr>
<td><b>Other User</b>
<td>
</tr>
<tr>
<td>Hello.
<td>
</tr>
</table>
</div>
<div class="message my-message">
<table>
<tr>
<td><b>User</b>
<td>
</tr>
<tr>
<td>Hello!
<td>
</tr>
</table>
</div>
<div class="message">
<table>
<tr>
<td><b>Other User</b>
<td>
</tr>
<tr>
<td>Hello.
<td>
</tr>
</table>
</div>
<div class="message my-message">
<table>
<tr>
<td><b>User</b>
<td>
</tr>
<tr>
<td>Hello!
<td>
</tr>
</table>
</div>
<div class="message">
<table>
<tr>
<td><b>Other User</b>
<td>
</tr>
<tr>
<td>Hello.
<td>
</tr>
</table>
</div>
<div class="message my-message">
<table>
<tr>
<td><b>User</b>
<td>
</tr>
<tr>
<td>Hello!
<td>
</tr>
</table>
</div>
<div class="message">
<table>
<tr>
<td><b>Other User</b>
<td>
</tr>
<tr>
<td>Hello.
<td>
</tr>
</table>
</div>
<div class="message my-message">
<table>
<tr>
<td><b>User</b>
<td>
</tr>
<tr>
<td>Hello!
<td>
</tr>
</table>
</div>
</div>
</div>
<div class="footer">
<form class="input-form">
<div>
Please wait for a user to join ...
</div>
<div class="input-group mb-1 px-2">
<input type="text" class="form-control" id="message" name="message" placeholder="Type your message" required>
<div class="input-group-append">
<button class="btn btn-success" type="submit" id="sendmessage">Send</button>
</div>
</div>
</form>
</div>
You can also try this with flex :
.content {
margin-bottom: 100px;
}
.container {
display: flex;
justify-content: flex-start;
align-items: flex-start;
align-self: flex-start;
flex-direction: column;
}
.message {
padding: 10px;
border-radius: 17px;
background: #e8e8f8;
margin: 13px 11px 0 11px;
}
.my-message {
align-self: flex-end;
}
.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 100px;
text-align: center;
}
.input-form {
position: absolute;
bottom: 0;
text-align: center;
width: 100%;
margin-bottom: 15px;
border-radius: 10px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="content">
<nav class="navbar navbar-dark bg-dark blue fixed-top">
<span class="navbar-brand mb-0 h1"><img style="margin-top: -5px;" /> Chat</span>
</nav>
<div class="container" style="padding-top: 85px;">
<div class="message">
<table>
<tr><td><b>Other User</b><td></tr>
<tr><td>Hello.<td></tr>
</table>
</div>
<div class="message my-message">
<table>
<tr><td><b>User</b><td></tr>
<tr><td>Hello!<td></tr>
</table>
</div>
<div class="message">
<table>
<tr><td><b>Other User</b><td></tr>
<tr><td>Hello.<td></tr>
</table>
</div>
<div class="message my-message">
<table>
<tr><td><b>User</b><td></tr>
<tr><td>Hello!<td></tr>
</table>
</div>
<div class="message">
<table>
<tr><td><b>Other User</b><td></tr>
<tr><td>Hello.<td></tr>
</table>
</div>
<div class="message my-message">
<table>
<tr><td><b>User</b><td></tr>
<tr><td>Hello!<td></tr>
</table>
</div>
<div class="message">
<table>
<tr><td><b>Other User</b><td></tr>
<tr><td>Hello.<td></tr>
</table>
</div>
<div class="message my-message">
<table>
<tr><td><b>User</b><td></tr>
<tr><td>Hello!<td></tr>
</table>
</div>
<div class="message">
<table>
<tr><td><b>Other User</b><td></tr>
<tr><td>Hello.<td></tr>
</table>
</div>
<div class="message my-message">
<table>
<tr><td><b>User</b><td></tr>
<tr><td>Hello!<td></tr>
</table>
</div>
</div>
</div>
<div class="footer">
<form class="input-form">
<div>
Please wait for a user to join ...
</div>
<div class="input-group mb-1 px-2">
<input type="text" class="form-control" id="message" name="message" placeholder="Type your message" required>
<div class="input-group-append">
<button class="btn btn-success" type="submit" id="sendmessage">Send</button>
</div>
</div>
</form>
</div>
Related
I'm having a hard time fixing the issue.
My webpage consists of two divs with 25% and 60% of the width aligned side by side. The right div has cards inside (made it using Bootstrap 5).
Have a look at the following image. I want it like this in every viewport.
I want the entire UI to remain the same when the user resizes the window meaning that the width of the first div remains 25% and the second div remains 60% in all viewports. One more thing, I want to get rid of the Display: flex property when the window resizes so that the cards inside the div remain in a row or something else needs to be done instead of flex property.
My current display: 1920 * 1080.
I've seen many questions related to mine but I'm unable to fix this problem. Can anyone help with this one?
I am new to this platform, I hope I made it clear what my problem is.
#import url("https://fonts.googleapis.com/css2?family=Bungee+Outline&display=swap");
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
background: url(/assets/bg.jpg);
background-size: cover;
background-repeat: no-repeat;
background-position: bottom center;
height: 100vh;
width: 100%;
color: white !important;
}
#font-face {
font-family: myFont;
src: url(/assets/myFont.ttf);
}
#font-face {
font-family: mainFont;
src: url(/assets/mainFont.otf);
}
/* .main {
} */
.main-row:after {
content: "";
display: table;
clear: both;
}
.logo {
height: 120px;
width: 130px;
position: absolute;
top: 2%;
left: 60%;
}
.border-radius-2 {
border-radius: 2rem !important;
}
.fs-4 {
font-size: 4rem !important;
}
.fs-25 {
font-size: 20px !important;
}
/* MAIN COLS */
.column {
float: left;
height: 100%;
margin-top: 7rem;
}
.column:not(.col-right) {
margin-right: 4rem;
}
/* COLUMN LEFT */
.col-left {
width: 25%;
background: rgb(0, 0, 0);
background: linear-gradient(180deg, rgba(0, 0, 0, 0.5242471988795518) 53%, rgba(255, 8, 24, 0.6895133053221288) 100%);
}
.rangliste {
font-family: myFont !important;
font-size: 75px !important;
color: rgba(255, 0, 0, 0.602);
padding: 0.5rem 1rem;
}
.front-text {
position: fixed;
top: 14.5%;
left: 14%;
font-family: mainFont;
}
.col-left-child {
background-color: black;
margin: 30px !important;
}
/* COLUMN RIGHT */
.col-right {
width: 60%;
background: rgb(0, 0, 0);
background: linear-gradient(180deg, rgba(0, 0, 0, 0.5242471988795518) 53%, rgba(255, 8, 24, 0.6895133053221288) 100%);
/* z-index: 9999; */
}
.col-right-child-bottom .new-row {
--bs-gutter-x: -10.5rem !important;
}
.row-two:not(.row-one) {
margin-top: 2rem;
}
.card-right-col {
background-color: Black !important;
border: none !important;
border-radius: 2rem !important;
width: 16rem !important;
height: 18rem !important;
}
.card-right-col img {
border-top-left-radius: 2rem !important;
border-top-right-radius: 2rem !important;
filter: grayscale(100%);
}
/* BUTTONS */
.btn-danger {
background-color: rgba(255, 0, 0, 0.274) !important;
border: none !important;
color: red !important;
font-weight: 600 !important;
}
.btn-red {
padding: 0.2rem 2.5rem !important;
border-radius: 1rem !important;
}
.card-btn {
padding: 0 1rem !important;
border-radius: 0.5rem !important;
}
.btn-success {
background-color: rgba(4, 104, 4, 0.493) !important;
border: none !important;
border-radius: 1rem !important;
color: rgba(5, 212, 5, 0.842) !important;
font-weight: 600 !important;
padding: 0.2rem 3rem !important;
}
/* ICONS */
.fa-circle {
color: rgb(5, 212, 5) !important;
}
/* TABLE */
table {
table-layout: fixed;
border-collapse: collapse;
width: 100%;
}
td,
th {
padding: 8px;
}
td {
width: 25%;
color: rgb(216, 212, 212);
}
td:not(:nth-child(3)) {
border-right: 1px solid rgba(238, 238, 238, 0.185) !important;
}
th:not(:nth-child(3)) {
border-right: 1px solid rgba(238, 238, 238, 0.185) !important;
}
.active-card {
border: 1px solid red !important;
}
<!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=0.1" />
<title>HEX FFA</title>
<!-- CSS -->
<link rel="stylesheet" href="css/style.css" />
<link rel="shortcut icon" type="assets/png" href="assets/logo.png">
<!-- BOOTSTRAP 5 CDN -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" />
<!-- FONT-AWESOME -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" integrity="sha512-Fo3rlrZj/k7ujTnHg4CGR2D7kSs0v4LLanw2qksYuRlEzO+tcaEPQogQ0KaoGN26/zrn20ImR1DfuLWnOo7aBA==" crossorigin="anonymous" referrerpolicy="no-referrer"
/>
</head>
<body>
<div class="main">
<!-- LOGO -->
<img src="assets/logo.png" class="img-fluid logo"></img>
<div class="main-row d-flex justify-content-center">
<!-- LEFT COLUMN -->
<div class="column col-left border-radius-2">
<div class="behind-text m-0">
<h1 class="text-center rangliste m-0">RANGLISTE</h1>
</div>
<div class="front-text p-0 m-0">
<h1 class="text-center rangliste-2 p-0 m-0">Rangliste</h1>
</div>
<!-- CHILD -->
<div class="col-left-child border-radius-2 mt-0">
<div class="container">
<div class="row">
<table>
<tr class="text-center fs-25">
<th>Spieler</th>
<th>Kills</th>
<th>K/D</th>
</tr>
<tr class="text-center fs-25">
<td>Movas</td>
<td>1337</td>
<td>0.5</td>
</tr>
<tr class="text-center fs-25">
<td>Movas</td>
<td>1337</td>
<td>0.5</td>
</tr>
<tr class="text-center fs-25">
<td>Movas</td>
<td>1337</td>
<td>0.5</td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="text-center">
<td></td>
<td></td>
<td></td>
</tr
</table>
</div>
</div>
</div>
</div>
<!-- LEFT COLUMN END -->
<!-- RIGHT COLUMN -->
<div class="column col-right border-radius-2">
<!-- CHILD TOP -->
<div class="container col-right-child-top">
<div class="row">
<div class="col"></div>
<div class="col d-flex justify-content-center">
<div class="card-body text-center">
<h1 class="card-title">HEX FFA</h1>
<h5 class="card-subtitle mb-2 ">Karte auswählen</h5>
</div>
</div>
<div class="col">
<div class="button-red d-flex justify-content-end p-3 ">
<button type="button" class="btn btn-danger btn-red fs-4">
<i class="fas fa-times"></i> Schließen
</button>
</div>
</div>
</div>
</div>
<!-- CHILD BOTTOM -->
<div class="container col-right-child-bottom">
<div class="container">
<div class="row new-row row-one">
<div class="col d-flex justify-content-center">
<div class="card card-right-col border-radius-2" id="card-1">
<img src="https://images.pexels.com/photos/374023/pexels-photo-374023.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="card-img-top" alt="..." />
<div class="card-body pb-0">
<div class="container">
<div class="row ">
<div class="col ">
<h6>würfelpark</h6>
</div>
<div class="col d-flex justify-content-end "> <a href="#" class="card-link"><button
type="button" class="btn btn-danger card-btn ">Beliebt</button></a></div>
</div>
</div>
<p class="p-2 "><i class="fas fa-circle"></i> Spieler : 15</p>
</div>
</div>
</div>
<div class="col d-flex justify-content-center">
<div class="card card-right-col" id="card-2">
<img src="https://images.pexels.com/photos/374023/pexels-photo-374023.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="card-img-top" alt="..." />
<div class="card-body pb-0">
<div class="container ">
<div class="row ">
<div class="col ">
<h6>würfelpark</h6>
</div>
<div class="col d-flex justify-content-end "> <a href="#" class="card-link"><button
type="button" class="btn btn-danger card-btn">Beliebt</button></a></div>
</div>
</div>
<p class="p-2"><i class="fas fa-circle"></i> Spieler : 15</p>
</div>
</div>
</div>
<div class="col d-flex justify-content-center">
<div class="card card-right-col" id="card-3">
<img src="https://images.pexels.com/photos/374023/pexels-photo-374023.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="card-img-top" alt="..." />
<div class="card-body pb-0">
<div class="container ">
<div class="row ">
<div class="col ">
<h6>würfelpark</h6>
</div>
<div class="col d-flex justify-content-end "> <a href="#" class="card-link"><button
type="button" class="btn btn-danger card-btn">Beliebt</button></a></div>
</div>
</div>
<p class="p-2"><i class="fas fa-circle"></i> Spieler : 15</p>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row new-row row-two">
<div class="col d-flex justify-content-center">
<div class="card card-right-col" id="card-4">
<img src="https://images.pexels.com/photos/374023/pexels-photo-374023.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="card-img-top" alt="..." />
<div class="card-body pb-0">
<div class="container ">
<div class="row ">
<div class="col ">
<h6>würfelpark</h6>
</div>
<div class="col d-flex justify-content-end "> <a href="#" class="card-link"><button
type="button" class="btn btn-danger card-btn">Beliebt</button></a>
</div>
</div>
</div>
<p class="p-2"><i class="fas fa-circle"></i> Spieler : 15</p>
</div>
</div>
</div>
<div class="col d-flex justify-content-center">
<div class="card card-right-col" id="card-5">
<img src="https://images.pexels.com/photos/374023/pexels-photo-374023.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="card-img-top" alt="..." />
<div class="card-body pb-0">
<div class="container ">
<div class="row ">
<div class="col ">
<h6>würfelpark</h6>
</div>
<div class="col d-flex justify-content-end "> <a href="#" class="card-link"><button
type="button" class="btn btn-danger card-btn">Beliebt</button></a>
</div>
</div>
</div>
<p class="p-2"><i class="fas fa-circle"></i> Spieler : 15</p>
</div>
</div>
</div>
<div class="col d-flex justify-content-center">
<div class="card card-right-col" id="card-6">
<img src="https://images.pexels.com/photos/374023/pexels-photo-374023.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="card-img-top" alt="..." />
<div class="card-body pb-0">
<div class="container ">
<div class="row ">
<div class="col ">
<h6>würfelpark</h6>
</div>
<div class="col d-flex justify-content-end ">
<a href="#" class="card-link"><button
type="button" class="btn btn-danger card-btn">Beliebt</button></a>
</div>
</div>
</div>
<p class="p-2"><i class="fas fa-circle"></i> Spieler : 15</p>
</div>
</div>
</div>
</div>
</div>
<div class="button-green d-flex justify-content-center p-3">
<button type="button" class="btn btn-success fs-4"> <i class="fas fa-file-export"></i> Beitreten</button>
</div>
</div>
</div>
<!-- RIGHT COLUMN END -->
</div>
</div>
<!-- BOOTSTRAP JS -->
<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>
<script src="js/script.js"></script>
</body>
</html>
I'm facing this on window resize:
I have header and footer when i printing.
But on the first page, i just want that cover page to be clean. So i only can have a picture or title there.
Right now i have my header and footer also at this cover page. I don´t want that.
I have tried to use
#page:first {margin:0;}
I still have the header and footer.
Give me the easiest way to do this in CSS, and please explain why.
The Code
<html>
<head>
<style>
</style>
</head>
<body>
<div class="page-header ">
<table style="width:100%">
<tr>
<p>Hello</p>
</tr>
</table>
</div>
<div class="page-footer">
I'm The Footer
</div>
<table>
<thead>
<tr>
<td>
<!--place holder for the fixed-position header-->
<div class="page-header-space"></div>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<!--*** CONTENT GOES HERE ***-->
<div class="masthead">
<p>Hello</p>
</div>
<div class="page">
<div>
<p class="test"> </p>
</div>
<div class=" col test-2">
<p>
Text
</p>
</div>
</div>
<div class="page">
<div>
<p class="test-3"> </p>
<h1 style="text-align:center">Text</h1>
</div>
<div style="margin-top: 100px;">
<p>Text.</p>
</div>
</div>
<div class="page">
<div>
<p style="margin-top:10px;">
<h1 class="test">Text</h1>
</p>
</div>
<div>
<p class="test-5"> </p>
<h2 style="text-align:left">Text</h2>
</div>
<div>
<p class="test-5"> </p>
</div>
<div>
<div>
<p class="test-5"> </p>
</div>
<br />
<div>
<p class="test-5"> </p>
</div>
<br />
</div>
</div>
<div class="page">
<div>
<p style="margin-top:10px;">
<h1 class="test">Text</h1>
</p>
</div>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
<!--place holder for the fixed-position footer-->
<div class="page-footer-space"></div>
</td>
</tr>
</tfoot>
</table>
</body>
</html>
You may add an element to display as first page, like this:
<div class="print-first-page">
your first page content here
</div>
Then hide it from screen and show on printed page:
.print-first-page {
display: none;
}
#media print {
.print-first-page {
display: block;
width: 100%;
height: 100%;
}
}
Here is the complete example with your code:
<head>
<style>
.print-first-page {
display: none;
}
#media print {
.print-first-page {
display: block;
width: 100%;
height: 100%;
}
}
</style>
</head>
<body>
<div class="print-first-page">
your first page content here
</div>
<div class="page-header ">
<table style="width:100%">
<tr>
<p>Hello</p>
</tr>
</table>
</div>
<div class="page-footer">
I'm The Footer
</div>
<table>
<thead>
<tr>
<td>
<!--place holder for the fixed-position header-->
<div class="page-header-space"></div>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<!--*** CONTENT GOES HERE ***-->
<div class="masthead">
<p>Hello</p>
</div>
<div class="page">
<div>
<p class="test"> </p>
</div>
<div class=" col test-2">
<p>
Text
</p>
</div>
</div>
<div class="page">
<div>
<p class="test-3"> </p>
<h1 style="text-align:center">Text</h1>
</div>
<div style="margin-top: 100px;">
<p>Text.</p>
</div>
</div>
<div class="page">
<div>
<p style="margin-top:10px;"><h1 class="test">Text</h1></p>
</div>
<div>
<p class="test-5"> </p>
<h2 style="text-align:left">Text</h2>
</div>
<div>
<p class="test-5"> </p>
</div>
<div>
<div>
<p class="test-5"> </p>
</div>
<br />
<div>
<p class="test-5"> </p>
</div>
<br />
</div>
</div>
<div class="page">
<div>
<p style="margin-top:10px;"><h1 class="test">Text</h1></p>
</div>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
<!--place holder for the fixed-position footer-->
<div class="page-footer-space"></div>
</td>
</tr>
</tfoot>
</table>
</body>
</html>
I have html code which is used to display two tables. When I run the program the two tables appear one below the other, but I want the two tables to be on the extreme left.
<!DOCTYPE html>
<html>
<head>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 50px;
margin-left: auto;
margin-right: auto;
}
td,
th {
border: 1px solid #dddddd;
text-align: center;
padding: 20px;
}
#table {
margin-left: -850px;
}
</style>
<body style="background-color: #E6E6FA">
<div class="container text-center">
<div class="row">
<div class="col-sm-4">
<div class="panel panel-primary">
<div class="panel-heading">Reportees List</div>
<table id="employee_table" class="table table-hover" cellspacing="0">
<tr>
<th>Number</th>
<th>Name</th>
<th>UserId</th>
<th>Count</th>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="jiratable" style="display: none;">
<div class="container text-center">
<div class="row">
<div class="col-sm-4">
<div class="panel panel-primary" style="width: 240%;">
<div class="panel-heading">JIRA - List</div>
<table id="Jira_table" class="table table-hover" cellspacing="0">
<thead>
<tr>
<th width="80">Number</th>
<th>JiraNumber</th>
<th>JiraStatus</th>
<th>EmailId</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="sendmail" style="display: none;">
<div class="container">
<div style="text-align:right; width:100%; padding:0;">
<button id="sendMail" style='margin-right:16px' class="btn btn-
primary btn-lg pull-right">Cancel</button>
<button id="sendMail" class="btn btn-primary btn-lg pull-right" onclick="sendMail()">SendMail</button>
</div>
</div>
</body>
</html>
The output is:
Number Name UserId count
1 Ram 56782 1
2 Raj 56187 2
Expected Output is:
Number Name UserId count
1 Ram 56782 1
2 Raj 56187 2
Here for sample I am writing only one table output, but in actuality there are two tables each, one below the other.
Just remove the margin-left and margin-right. You can also remove the width because tables always automatically are as wide as their content and there's nothing you can do about it.
body {
background-color: #E6E6FA;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
}
td,
th {
border: 1px solid #dddddd;
text-align: center;
padding: 20px;
}
#table {
margin-left: -850px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container text-center">
<div class="row">
<div class="col-sm-4">
<div class="panel panel-primary">
<div class="panel-heading">Reportees List</div>
<table id="employee_table" class="table table-hover" cellspacing="0">
<tr>
<th>Number</th>
<th>Name</th>
<th>UserId</th>
<th>Count</th>
</tr>
</table>
</div>
</div>
</div>
</div>
<div id="jiratable">
<div class="container text-center">
<div class="row">
<div class="col-sm-4">
<div class="panel panel-primary" style="width: 240%;">
<div class="panel-heading">JIRA - List</div>
<table id="Jira_table" class="table table-hover" cellspacing="0">
<thead>
<tr>
<th width="80">Number</th>
<th>JiraNumber</th>
<th>JiraStatus</th>
<th>EmailId</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="sendmail">
<div class="container">
<div style="text-align:right; width:100%; padding:0;">
<button id="sendMail" style='margin-right:16px' class="btn btn-
primary btn-lg pull-right">Cancel</button>
<button id="sendMail" class="btn btn-primary btn-lg pull-right" onclick="sendMail()">SendMail</button>
</div>
</div>
Use float property. In this case, you want to float your element to the left.
<!DOCTYPE html>
<html>
<head>
<style>
table{
font-family:arial,sans-serif;
border-collapse: collapse;
width:50px;
margin-left: auto;
margin-right: auto;
float:left;
}
td,
th{
border:1px solid #dddddd;
text-align: center;
padding: 20px;
}
#table {
margin-left: -850px;
}
</style>
<body style="background-color: #E6E6FA">
<div class="container text-center" >
<div class="row">
<div class="col-sm-4">
<div class="panel panel-primary">
<div class="panel-heading" >Reportees List</div>
<table id = "employee_table" class="table table-hover" cellspacing="0">
<tr>
<th>Number</th>
<th>Name</th>
<th>UserId</th>
<th>Count</th>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div id ="jiratable" style="display: none;">
<div class="container text-center" >
<div class="row">
<div class="col-sm-4">
<div class="panel panel-primary" style="width: 240%;">
<div class="panel-heading">JIRA - List</div>
<table id = "Jira_table" class="table table-hover"
cellspacing="0">
<thead>
<tr>
<th width="80">Number</th>
<th>JiraNumber</th>
<th>JiraStatus</th>
<th>EmailId</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<div id ="sendmail" style="display: none;">
<div class="container">
<div style="text-align:right; width:100%; padding:0;">
<button id ="sendMail" style='margin-right:16px' class="btn btn-
primary btn-lg pull-right">Cancel</button>
<button id ="sendMail" class="btn btn-primary btn-lg pull-right"
onclick="sendMail()">SendMail</button>
</div>
</div>
</body>
</html>
I see two issues with my code. Header is not getting fixed and second issue is word wrap is not applicable for the headers/rows.
I have used bootstrap classes, but still facing issues. I want to fix the table header and only rows should be scrollable and if the text is long it should automatically word wrap. I have multiple columns in my application(approximately 15 columns).Please advice.
To view the sample code click here.
Sample html code:
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
<div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body" id="modal-body">
<table id="myTable" class="table table-fixedheader table-bordered table-striped">
<thead>
<tr class="row">
<th class="col-md-3">Header1</th>
<th class="col-md-4">Header2Header2Header2Header2</th>
<th class="col-md-3">Header3</th>
<th class="col-md-4">Header4</th>
</tr>
</thead>
<tbody>
<tr class="row">
<td class="col-md-3">111111111111111111111111111111111111111111111111111111111111111111111</td>
<td class="col-md-4">33333</td>
<td class="col-md-3">1111</td>
<td class="col-md-4">5443545435354543</td>
</tr>
<tr class="row">
<td class="col-md-3">1111</td>
<td class="col-md-4">33333</td>
<td class="col-md-3">1111</td>
<td class="col-md-4">5437665</td>
</tr>
<tr class="row">
<td class="col-md-3">1111</td>
<td class="col-md-4">33333</td>
<td class="col-md-3">1111</td>
<td class="col-md-4">5435435443</td>
</tr>
<tr class="row">
<td class="col-md-3">1111</td>
<td class="col-md-4">33333</td>
<td class="col-md-3">1111</td>
<td class="col-md-4">68678454</td>
</tr>
<tr class="row">
<td class="col-md-3">1111</td>
<td class="col-md-4">786876</td>
<td class="col-md-3">8787876</td>
<td class="col-md-4">6765767</td>
</tr>
<tr class="row">
<td class="col-md-3">7656765</td>
<td class="col-md-4">656456</td>
<td class="col-md-3">116611</td>
<td class="col-md-4">43434</td>
</tr>
<tr class="row">
<td class="col-md-3">43243432434324342</td>
<td class="col-md-4">33344343233</td>
<td class="col-md-3">1111</td>
<td class="col-md-4">4343</td>
</tr>
<tr class="row">
<td class="col-md-3">1111</td>
<td class="col-md-4">432434343243243</td>
<td class="col-md-3">1111</td>
<td class="col-md-4">432443</td>
</tr>
<tr class="row">
<td class="col-md-3">1111</td>
<td class="col-md-4">333333</td>
<td class="col-md-3">111312312123121</td>
<td class="col-md-4">32112</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
You could try a non table approach. If your ok with having set widths on the columns with content wrapping in the cells. Here's an example https://codepen.io/flurrd/pen/jmMNxK?editors=1100
Note: Class names are terrible in this example. I'd BEM it up for proper usage.
.table-body {
max-height: 200px;
overflow-y:auto;
}
.t-row {
display: flex;
border-bottom: 1px solid grey;
}
.t-row:nth-child(even){
background: #e3e3e3;
}
.col {
word-wrap: break-word;
flex: 1 0 30%;
max-width: 33.3333%;
}
.cell {
padding: 8px;
}
<div class="table-wrap">
<div class="t-row t-header">
<div class="col">
<div class="cell">
Header 1
</div>
</div>
<div class="col">
<div class="cell">
Header 1
</div>
</div>
<div class="col">
<div class="cell">
Header 1
</div>
</div>
</div>
<div class="table-body">
<div class="t-row">
<div class="col">
<div class="cell">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</div>
</div>
<div class="col">
<div class="cell">
1111
</div>
</div>
<div class="col">
<div class="cell">
11111111
</div>
</div>
</div>
</div>
</div>
Hi this is my first time using semantic-ui framework & I have some problem with footer. I want to make footer to always stick in the bottom of page (not fixed).
this is the simple html of mine
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<nav class="ui borderless menu">
</nav>
<div class="desc">
</div>
<div class="ui container">
</div>
<div class="ui container">
</div>
<footer class="footer">
</footer>
</body>
</html>
I was trying use this css:
body {
position: relative;
height: 100%;
}
.footer {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
}
but it doesn't work, it just work when the height of page is less than 100% of the monitor height, when it's height have more than 100% of monitor height the footer will float like this:
I also already change the css body with this:
body {
position: relative;
min-height: 100%;
}
but still doesn't work, anyone can help?
This is the full code, I made a long list table so you would know when you click the filter it will push the table down and the footer will mess.
body {
height: 100%;
color: #696F84;
position: relative;
}
.menu {
border-radius: 0 !important;
}
.item {
color: #696F84 !important;
}
.logo {
margin-right: 7px !important;
}
.company {
font-family: 'Righteous', cursive;
font-weight: normal;
font-size: 27px;
color: #515151;
padding-bottom: 2px;
}
.desc {
position: relative;
background-color: #EEEEEE;
margin-top: -1rem;
padding: 30px 0;
font-family: Raleway;
font-size: 24px;
color: #757575;
}
#filter {
width: 100%;
margin: 20px 0;
}
.footer {
background-color: #212121;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 15px 0;
}
<link href="//oss.maxcdn.com/semantic-ui/2.1.6/semantic.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="//oss.maxcdn.com/semantic-ui/2.1.6/semantic.min.js"></script>
<nav class="ui borderless menu">
<div class="header item">
<img class="logo" src="./img/logo.jpg" alt="logo">
<div class="company">Company Name</div>
</div>
<!-- end left menu -->
</nav>
<!-- end navbar -->
<div>
<div class="ui container">
<p>"Description here | Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard."</p>
</div>
</div>
<!-- end description -->
<div class="ui container">
<div class="ui styled accordion" id="filter">
<div class="title">
<i class="dropdown icon"></i>
Filter
</div>
<div class="content">
<div class="ui grid">
<div class="four wide column" id="radio">
<div class="ui form">
<div class="grouped fields">
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="size" value="small">
<label>Small</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="size" value="medium">
<label>Medium</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="size" value="large">
<label>Large</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="size" value="x-large">
<label>X-Large</label>
</div>
</div>
</div>
<!-- end grouped fields -->
</div>
<!-- end form -->
</div>
<!-- end radio -->
<div class="four wide column" id="checkbox">
<div class="ui form">
<div class="grouped fields">
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="small">
<label>Red</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="medium">
<label>Orange</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="large">
<label>Green</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="x-large">
<label>Blue</label>
</div>
</div>
</div>
<!-- end grouped fields -->
</div>
<!-- end form -->
</div>
<!-- end checkbox -->
<div class="eight wide column" id="input">
<div class="ui form">
<div class="grouped fields">
<div class="field">
<div class="ui labeled input">
<div class="ui label">
Name
</div>
<input type="text" placeholder="your name">
</div>
</div>
<div class="field">
<div class="ui selection dropdown">
<input type="hidden" name="gender">
<i class="dropdown icon"></i>
<div class="default text">Gender</div>
<div class="menu">
<div class="item" data-value="1">Male</div>
<div class="item" data-value="0">Female</div>
</div>
</div>
</div>
</div>
<!-- end grouped fields -->
</div>
<!-- end form -->
</div>
<!-- end input -->
</div>
<!-- end grid -->
</div>
<!-- end content -->
</div>
<!-- end accordion -->
<table class="ui blue celled striped compact table">
<thead>
<tr>
<th class="collapsing">No</th>
<th>Food</th>
<th>Code</th>
<th>Calories</th>
<th>Protein</th>
<th class="center aligned collapsing">Action</th>
</tr>
</thead>
<tbody>
<tr>
<td class="collapsing">1</td>
<td>Apples</td>
<td>Ap</td>
<td>200</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">2</td>
<td>Orange</td>
<td>Or</td>
<td>310</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">3</td>
<td>Mango</td>
<td>Mg</td>
<td>360</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
</tbody>
</table>
<!-- end table -->
</div>
<!-- end container -->
<footer class="footer">
Micro Tech 2015. All Rights Reserved
</footer>
<script type="text/javascript">
$(document).ready(function() {
$('.ui.accordion').accordion();
})
</script>
add a warp div like below
<div class="main">
.......
</div>
<div class="footer">
......
</div>
and set css
.main{min-height:100%;
padding-bottom:60px;
box-sizing:border-box;}
.footer {
background-color: #212121;
position: absolute;
/* bottom: 0; remove this */
margin-top: -50px; /* add this */
left: 0;
width: 100%;
padding: 15px 0;
}
body {
height: 100%;
color: #696F84;
position: relative;
}
.menu {
border-radius: 0 !important;
}
.item {
color: #696F84 !important;
}
.logo {
margin-right: 7px !important;
}
.company {
font-family: 'Righteous', cursive;
font-weight: normal;
font-size: 27px;
color: #515151;
padding-bottom: 2px;
}
.desc {
position: relative;
background-color: #EEEEEE;
margin-top: -1rem;
padding: 30px 0;
font-family: Raleway;
font-size: 24px;
color: #757575;
}
#filter {
width: 100%;
margin: 20px 0;
}
.main{min-height:100%; padding-bottom:60px; box-sizing:border-box;}
.footer {
background-color: #212121;
position: absolute;
/* bottom: 0; remove this */
margin-top: -50px; /* add this */
left: 0;
width: 100%;
padding: 15px 0;
}
<link href="//oss.maxcdn.com/semantic-ui/2.1.6/semantic.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="//oss.maxcdn.com/semantic-ui/2.1.6/semantic.min.js"></script>
<div class="main">
<nav class="ui borderless menu">
<div class="header item">
<img class="logo" src="./img/logo.jpg" alt="logo">
<div class="company">Company Name</div>
</div>
<!-- end left menu -->
</nav>
<!-- end navbar -->
<div>
<div class="ui container">
<p>"Description here | Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard."</p>
</div>
</div>
<!-- end description -->
<div class="ui container">
<div class="ui styled accordion" id="filter">
<div class="title">
<i class="dropdown icon"></i>
Filter
</div>
<div class="content">
<div class="ui grid">
<div class="four wide column" id="radio">
<div class="ui form">
<div class="grouped fields">
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="size" value="small">
<label>Small</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="size" value="medium">
<label>Medium</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="size" value="large">
<label>Large</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="size" value="x-large">
<label>X-Large</label>
</div>
</div>
</div>
<!-- end grouped fields -->
</div>
<!-- end form -->
</div>
<!-- end radio -->
<div class="four wide column" id="checkbox">
<div class="ui form">
<div class="grouped fields">
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="small">
<label>Red</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="medium">
<label>Orange</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="large">
<label>Green</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="x-large">
<label>Blue</label>
</div>
</div>
</div>
<!-- end grouped fields -->
</div>
<!-- end form -->
</div>
<!-- end checkbox -->
<div class="eight wide column" id="input">
<div class="ui form">
<div class="grouped fields">
<div class="field">
<div class="ui labeled input">
<div class="ui label">
Name
</div>
<input type="text" placeholder="your name">
</div>
</div>
<div class="field">
<div class="ui selection dropdown">
<input type="hidden" name="gender">
<i class="dropdown icon"></i>
<div class="default text">Gender</div>
<div class="menu">
<div class="item" data-value="1">Male</div>
<div class="item" data-value="0">Female</div>
</div>
</div>
</div>
</div>
<!-- end grouped fields -->
</div>
<!-- end form -->
</div>
<!-- end input -->
</div>
<!-- end grid -->
</div>
<!-- end content -->
</div>
<!-- end accordion -->
<table class="ui blue celled striped compact table">
<thead>
<tr>
<th class="collapsing">No</th>
<th>Food</th>
<th>Code</th>
<th>Calories</th>
<th>Protein</th>
<th class="center aligned collapsing">Action</th>
</tr>
</thead>
<tbody>
<tr>
<td class="collapsing">1</td>
<td>Apples</td>
<td>Ap</td>
<td>200</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">2</td>
<td>Orange</td>
<td>Or</td>
<td>310</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">3</td>
<td>Mango</td>
<td>Mg</td>
<td>360</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
<tr>
<td class="collapsing">4</td>
<td>Grape</td>
<td>Gr</td>
<td>210</td>
<td>0g</td>
</tr>
</tbody>
</table>
<!-- end table -->
</div>
<!-- end container -->
</div>
<footer class="footer">
Micro Tech 2015. All Rights Reserved
</footer>
<script type="text/javascript">
$(document).ready(function() {
$('.ui.accordion').accordion();
})
</script>
Just set
.footer{
position:fixed;
bottom:0;
}
fixed position in this case is the best way to position your footer always on the bottom.
OP stated he does not want a fixed footer
This is what is causing your issue:
body, html {
height: 100%;
}
height should not be set for your footer to be at the bottom (it comes from semantic.min.css).
To cancel this, add this at the beginning of your CSS stylesheet (!important is needed here to override the value set by the other stylesheet, but you should otherwise avoid using it at all costs):
body, html {
height: auto!important;
}
body {
font-size: 40px;
position: relative;
}
.footer {
background-color: black;
color: red;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
}
<nav class="ui borderless menu">
</nav>
<div class="desc">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<div class="ui container">
</div>
<div class="ui container">
</div>
<footer class="footer">
some footer at the bottom
</footer>