Position icons on same line as text - html
I want to make icons to be on the left side and the text right next to them.
In my code, the icons are above the text.
How can I make them organized and near the text without everything to get messy?
/* Universal reset: */
* {
margin: 0;
padding: 0;
}
/* Body CSS (Background image, font) */
body {
font-size: 0.825em;
background-image: url(img/Background_Image.jpg);
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-color: #464646;
font-family: Arial, Helvetica, sans-serif;
}
/* Chef Logo */
.img-logo {
position: relative;
top: 37px;
float: left;
width: 100px;
height: 100px;
background: #fcfcfc00;
right: 25px;
}
/* The clearfix hack to clear the floats: */
.clear:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
article {
background-color: #ffffffe0;
margin: 3em 0;
padding: 20px;
border: 1px solid #00000094;
/* black Transerent #a29b94a3 */
}
/* All Footer Styling: */
footer {
margin-bottom: 30px;
text-align: center;
font-size: 0.825em;
}
/* "Article" Footer Styling: */
.footer {
/* The dividing footer: */
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 200px;
background-color: #ffffffe0;
/* #efebe785 */
color: #000000;
/* Align all the text left so it lines up */
text-align: left;
border: 1px solid #00000094;
}
/* "Article" Footer "table": */
.left,
.right,
.center {
float: left;
width: 33.333%;
position: relative;
box-sizing: border-box;
padding-right: 15px;
padding-left: 15px;
}
/* Text on footer: */
footer p {
margin-bottom: -2.5em;
position: relative;
}
/* Text on footer: */
footer a {
color: #000000;
background-color: #ffffffe0;
display: block;
padding: 2px 4px;
z-index: 100;
position: relative;
border: 1px solid #00000094;
text-decoration: none;
outline: none;
}
footer a:hover {
text-decoration: none;
background-color: #000000e0;
color: white;
}
footer a.class1 {
color: #000000;
background-color: #efebe700;
display: block;
padding: 1px 1px;
z-index: 100;
position: relative;
border: none;
}
footer a.by {
float: left;
position: relative;
top: 11px
}
footer a.up {
float: right;
top: 11px
}
.myImg {
border-radius: 5px;
cursor: pointer;
transition: 0.3s;
}
/* W3.CSS 4.08 January 2018 by Jan Egil and Borge Refsnes */
html {
box-sizing: border-box
}
*,
*:before,
*:after {
box-sizing: inherit
}
/* Extract from normalize.css by Nicolas Gallagher and Jonathan Neal git.io/normalize */
html {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%
}
body {
margin: 0
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
menu,
nav,
section,
summary {
display: block
}
audio,
canvas,
progress,
video {
display: inline-block
}
progress {
vertical-align: baseline
}
audio:not([controls]) {
display: none;
height: 0
}
[hidden],
template {
display: none
}
a {
background-color: transparent;
-webkit-text-decoration-skip: objects
}
a:active,
a:hover {
outline-width: 0
}
abbr[title] {
border-bottom: none;
text-decoration: underline;
text-decoration: underline dotted
}
dfn {
font-style: italic
}
mark {
background: #ff0;
color: #000
}
small {
font-size: 80%
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline
}
sub {
bottom: -0.25em
}
sup {
top: -0.5em
}
svg:not(:root) {
overflow: hidden
}
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em
}
hr {
box-sizing: content-box;
height: 0;
overflow: visible
}
button,
input,
select,
textarea {
font: inherit;
margin: 0
}
optgroup {
font-weight: bold
}
button,
input {
overflow: visible
}
button,
select {
text-transform: none
}
button,
html [type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button
}
button::-moz-focus-inner,
[type=button]::-moz-focus-inner,
[type=reset]::-moz-focus-inner,
[type=submit]::-moz-focus-inner {
border-style: none;
padding: 0
}
button:-moz-focusring,
[type=button]:-moz-focusring,
[type=reset]:-moz-focusring,
[type=submit]:-moz-focusring {
outline: 1px dotted ButtonText
}
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: .35em .625em .75em
}
legend {
color: inherit;
display: table;
max-width: 100%;
padding: 0;
white-space: normal
}
textarea {
overflow: auto
}
[type=checkbox],
[type=radio] {
padding: 0
}
[type=number]::-webkit-inner-spin-button,
[type=number]::-webkit-outer-spin-button {
height: auto
}
[type=search] {
-webkit-appearance: textfield;
outline-offset: -2px
}
[type=search]::-webkit-search-cancel-button,
[type=search]::-webkit-search-decoration {
-webkit-appearance: none
}
::-webkit-input-placeholder {
color: inherit;
opacity: 0.54
}
::-webkit-file-upload-button {
-webkit-appearance: button;
font: inherit
}
/* End extract */
.w3-image {
max-width: 100%;
height: auto
}
img {
vertical-align: middle
}
a {
color: inherit
}
.w3-table,
.w3-table-all {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
display: table
}
.w3-table-all {
border: 1px solid #ccc
}
.w3-bordered tr,
.w3-table-all tr {
border-bottom: 1px solid #ddd
}
.w3-striped tbody tr:nth-child(even) {
background-color: #f1f1f1
}
.w3-table-all tr:nth-child(odd) {
background-color: #fff
}
.w3-table-all tr:nth-child(even) {
background-color: #f1f1f1
}
.w3-hoverable tbody tr:hover,
.w3-ul.w3-hoverable li:hover {
background-color: #ccc
}
.w3-centered tr th,
.w3-centered tr td {
text-align: center
}
.w3-table td,
.w3-table th,
.w3-table-all td,
.w3-table-all th {
padding: 8px 8px;
display: table-cell;
text-align: left;
vertical-align: top
}
.w3-table th:first-child,
.w3-table td:first-child,
.w3-table-all th:first-child,
.w3-table-all td:first-child {
padding-left: 16px
}
.w3-btn,
.w3-button {
border: none;
display: inline-block;
outline: 0;
padding: 8px 16px;
vertical-align: middle;
overflow: hidden;
text-decoration: none;
color: inherit;
background-color: inherit;
text-align: center;
cursor: pointer;
white-space: nowrap
}
.w3-btn:hover {
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)
}
.w3-btn,
.w3-button {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none
}
.w3-disabled,
.w3-btn:disabled,
.w3-button:disabled {
cursor: not-allowed;
opacity: 0.3
}
.w3-disabled *,
:disabled * {
pointer-events: none
}
.w3-btn.w3-disabled:hover,
.w3-btn:disabled:hover {
box-shadow: none
}
.w3-badge,
.w3-tag {
background-color: #000;
color: #fff;
display: inline-block;
padding-left: 8px;
padding-right: 8px;
text-align: center
}
.w3-badge {
border-radius: 50%;
cursor: pointer;
height: 15px;
width: 15px;
padding: 0
}
.w3-ul {
list-style-type: none;
padding: 0;
margin: 0
}
.w3-ul li {
padding: 8px 16px;
border-bottom: 1px solid #ddd
}
.w3-ul li:last-child {
border-bottom: none
}
.w3-tooltip,
.w3-display-container {
position: relative
}
.w3-tooltip .w3-text {
display: none
}
.w3-tooltip:hover .w3-text {
display: inline-block
}
.w3-ripple:active {
opacity: 0.5
}
.w3-ripple {
transition: opacity 0s
}
.w3-input {
padding: 8px;
display: block;
border: none;
border-bottom: 1px solid #ccc;
width: 100%
}
.w3-select {
padding: 9px 0;
width: 100%;
border: none;
border-bottom: 1px solid #ccc
}
.w3-dropdown-click,
.w3-dropdown-hover {
position: relative;
display: inline-block;
cursor: pointer
}
.w3-dropdown-hover:hover .w3-dropdown-content {
display: block
}
.w3-dropdown-hover:first-child,
.w3-dropdown-click:hover {
background-color: #ccc;
color: #000
}
.w3-dropdown-hover:hover>.w3-button:first-child,
.w3-dropdown-click:hover>.w3-button:first-child {
background-color: #ccc;
color: #000
}
.w3-dropdown-content {
cursor: auto;
color: #000;
background-color: #fff;
display: none;
position: absolute;
min-width: 160px;
margin: 0;
padding: 0;
z-index: 1
}
.w3-check,
.w3-radio {
width: 24px;
height: 24px;
position: relative;
top: 6px
}
.w3-sidebar {
height: 100%;
width: 200px;
background-color: #fff;
position: fixed;
z-index: 1;
overflow: auto
}
.w3-bar-block .w3-dropdown-hover,
.w3-bar-block .w3-dropdown-click {
width: 100%
}
.w3-bar-block .w3-dropdown-hover .w3-dropdown-content,
.w3-bar-block .w3-dropdown-click .w3-dropdown-content {
min-width: 100%
}
.w3-bar-block .w3-dropdown-hover .w3-button,
.w3-bar-block .w3-dropdown-click .w3-button {
width: 100%;
text-align: left;
padding: 8px 16px
}
.w3-main,
#main {
transition: margin-left .4s
}
.w3-modal {
z-index: 3;
display: none;
padding-top: 100px;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0, 0, 0);
background-color: rgba(0, 0, 0, 0.4)
}
.w3-modal-content {
margin: auto;
background-color: #fff;
position: relative;
padding: 0;
outline: 0;
width: 600px
}
.w3-bar {
width: 100%;
overflow: hidden
}
.w3-center .w3-bar {
display: inline-block;
width: auto
}
.w3-bar .w3-bar-item {
padding: 8px 16px;
float: left;
width: auto;
border: none;
outline: none;
display: block
}
.w3-bar .w3-dropdown-hover,
.w3-bar .w3-dropdown-click {
position: static;
float: left
}
.w3-bar .w3-button {
white-space: normal
}
.w3-bar-block .w3-bar-item {
width: 100%;
display: block;
padding: 8px 16px;
text-align: left;
border: none;
outline: none;
white-space: normal;
float: none
}
.w3-bar-block.w3-center .w3-bar-item {
text-align: center
}
.w3-block {
display: block;
width: 100%
}
.w3-responsive {
display: block;
overflow-x: auto
}
.w3-container:after,
.w3-container:before,
.w3-panel:after,
.w3-panel:before,
.w3-row:after,
.w3-row:before,
.w3-row-padding:after,
.w3-row-padding:before,
.w3-cell-row:before,
.w3-cell-row:after,
.w3-clear:after,
.w3-clear:before,
.w3-bar:before,
.w3-bar:after {
content: "";
display: table;
clear: both
}
.w3-col,
.w3-half,
.w3-third,
.w3-twothird,
.w3-threequarter,
.w3-quarter {
float: left;
width: 100%
}
.w3-col.s1 {
width: 8.33333%
}
.w3-col.s2 {
width: 16.66666%
}
.w3-col.s3 {
width: 24.99999%
}
.w3-col.s4 {
width: 33.33333%
}
.w3-col.s5 {
width: 41.66666%
}
.w3-col.s6 {
width: 49.99999%
}
.w3-col.s7 {
width: 58.33333%
}
.w3-col.s8 {
width: 66.66666%
}
.w3-col.s9 {
width: 74.99999%
}
.w3-col.s10 {
width: 83.33333%
}
.w3-col.s11 {
width: 91.66666%
}
.w3-col.s12 {
width: 99.99999%
}
#media (min-width:601px) {
.w3-col.m1 {
width: 8.33333%
}
.w3-col.m2 {
width: 16.66666%
}
.w3-col.m3,
.w3-quarter {
width: 24.99999%
}
.w3-col.m4,
.w3-third {
width: 33.33333%
}
.w3-col.m5 {
width: 41.66666%
}
.w3-col.m6,
.w3-half {
width: 49.99999%
}
.w3-col.m7 {
width: 58.33333%
}
.w3-col.m8,
.w3-twothird {
width: 66.66666%
}
.w3-col.m9,
.w3-threequarter {
width: 74.99999%
}
.w3-col.m10 {
width: 83.33333%
}
.w3-col.m11 {
width: 91.66666%
}
.w3-col.m12 {
width: 99.99999%
}
}
#media (min-width:993px) {
.w3-col.l1 {
width: 8.33333%
}
.w3-col.l2 {
width: 16.66666%
}
.w3-col.l3 {
width: 24.99999%
}
.w3-col.l4 {
width: 33.33333%
}
.w3-col.l5 {
width: 41.66666%
}
.w3-col.l6 {
width: 49.99999%
}
.w3-col.l7 {
width: 58.33333%
}
.w3-col.l8 {
width: 66.66666%
}
.w3-col.l9 {
width: 74.99999%
}
.w3-col.l10 {
width: 83.33333%
}
.w3-col.l11 {
width: 91.66666%
}
.w3-col.l12 {
width: 99.99999%
}
}
.w3-content {
max-width: 980px;
margin: auto
}
.w3-rest {
overflow: hidden
}
.w3-cell-row {
display: table;
width: 100%
}
.w3-cell {
display: table-cell
}
.w3-cell-top {
vertical-align: top
}
.w3-cell-middle {
vertical-align: middle
}
.w3-cell-bottom {
vertical-align: bottom
}
.w3-hide {
display: none
}
.w3-show-block,
.w3-show {
display: block
}
.w3-show-inline-block {
display: inline-block
}
#media (max-width:600px) {
.w3-modal-content {
margin: 0 10px;
width: auto
}
.w3-modal {
padding-top: 30px
}
.w3-dropdown-hover.w3-mobile .w3-dropdown-content,
.w3-dropdown-click.w3-mobile .w3-dropdown-content {
position: relative
}
.w3-hide-small {
display: none
}
.w3-mobile {
display: block;
width: 100%
}
.w3-bar-item.w3-mobile,
.w3-dropdown-hover.w3-mobile,
.w3-dropdown-click.w3-mobile {
text-align: center
}
.w3-dropdown-hover.w3-mobile,
.w3-dropdown-hover.w3-mobile .w3-btn,
.w3-dropdown-hover.w3-mobile .w3-button,
.w3-dropdown-click.w3-mobile,
.w3-dropdown-click.w3-mobile .w3-btn,
.w3-dropdown-click.w3-mobile .w3-button {
width: 100%
}
}
#media (max-width:768px) {
.w3-modal-content {
width: 500px
}
.w3-modal {
padding-top: 50px
}
}
#media (min-width:993px) {
.w3-modal-content {
width: 900px
}
.w3-hide-large {
display: none
}
.w3-sidebar.w3-collapse {
display: block
}
}
#media (max-width:992px) and (min-width:601px) {
.w3-hide-medium {
display: none
}
}
#media (max-width:992px) {
.w3-sidebar.w3-collapse {
display: none
}
.w3-main {
margin-left: 0;
margin-right: 0
}
}
.w3-top,
.w3-bottom {
position: fixed;
width: 100%;
z-index: 1
}
.w3-top {
top: 0
}
.w3-bottom {
bottom: 0
}
.w3-overlay {
position: fixed;
display: none;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 2
}
.w3-display-topleft {
position: absolute;
left: 0;
top: 0
}
.w3-display-topright {
position: absolute;
right: 0;
top: 0
}
.w3-display-bottomleft {
position: absolute;
left: 0;
bottom: 0
}
.w3-display-bottomright {
position: absolute;
right: 0;
bottom: 0
}
.w3-display-middle {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%)
}
.w3-display-left {
position: absolute;
top: 50%;
left: 0%;
transform: translate(0%, -50%);
-ms-transform: translate(-0%, -50%)
}
.w3-display-right {
position: absolute;
top: 50%;
right: 0%;
transform: translate(0%, -50%);
-ms-transform: translate(0%, -50%)
}
.w3-display-topmiddle {
position: absolute;
left: 50%;
top: 0;
transform: translate(-50%, 0%);
-ms-transform: translate(-50%, 0%)
}
.w3-display-bottommiddle {
position: absolute;
left: 50%;
bottom: 0;
transform: translate(-50%, 0%);
-ms-transform: translate(-50%, 0%)
}
.w3-display-container:hover .w3-display-hover {
display: block
}
.w3-display-container:hover span.w3-display-hover {
display: inline-block
}
.w3-display-hover {
display: none
}
.w3-display-position {
position: absolute
}
.w3-circle {
border-radius: 50%
}
.w3-round-small {
border-radius: 2px
}
.w3-round,
.w3-round-medium {
border-radius: 4px
}
.w3-round-large {
border-radius: 8px
}
.w3-round-xlarge {
border-radius: 16px
}
.w3-round-xxlarge {
border-radius: 32px
}
.w3-row-padding,
.w3-row-padding>.w3-half,
.w3-row-padding>.w3-third,
.w3-row-padding>.w3-twothird,
.w3-row-padding>.w3-threequarter,
.w3-row-padding>.w3-quarter,
.w3-row-padding>.w3-col {
padding: 0 8px
}
.w3-container,
.w3-panel {
padding: 0.01em 16px
}
.w3-panel {
margin-top: 16px;
margin-bottom: 16px
}
.w3-code,
.w3-codespan {
font-family: Consolas, "courier new";
font-size: 16px
}
.w3-code {
width: auto;
background-color: #fff;
padding: 8px 12px;
border-left: 4px solid #4CAF50;
word-wrap: break-word
}
.w3-codespan {
color: crimson;
background-color: #f1f1f1;
padding-left: 4px;
padding-right: 4px;
font-size: 110%
}
.w3-card,
.w3-card-2 {
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)
}
.w3-card-4,
.w3-hover-shadow:hover {
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.2), 0 4px 20px 0 rgba(0, 0, 0, 0.19)
}
.w3-spin {
animation: w3-spin 2s infinite linear
}
#keyframes w3-spin {
0% {
transform: rotate(0deg)
}
100% {
transform: rotate(359deg)
}
}
.w3-animate-fading {
animation: fading 10s infinite
}
#keyframes fading {
0% {
opacity: 0
}
50% {
opacity: 1
}
100% {
opacity: 0
}
}
.w3-animate-opacity {
animation: opac 0.8s
}
#keyframes opac {
from {
opacity: 0
}
to {
opacity: 1
}
}
.w3-animate-top {
position: relative;
animation: animatetop 0.4s
}
#keyframes animatetop {
from {
top: -300px;
opacity: 0
}
to {
top: 0;
opacity: 1
}
}
.w3-animate-left {
position: relative;
animation: animateleft 0.4s
}
#keyframes animateleft {
from {
left: -300px;
opacity: 0
}
to {
left: 0;
opacity: 1
}
}
.w3-animate-right {
position: relative;
animation: animateright 0.4s
}
#keyframes animateright {
from {
right: -300px;
opacity: 0
}
to {
right: 0;
opacity: 1
}
}
.w3-animate-bottom {
position: relative;
animation: animatebottom 0.4s
}
#keyframes animatebottom {
from {
bottom: -300px;
opacity: 0
}
to {
bottom: 0;
opacity: 1
}
}
.w3-animate-zoom {
animation: animatezoom 0.6s
}
#keyframes animatezoom {
from {
transform: scale(0)
}
to {
transform: scale(1)
}
}
.w3-animate-input {
transition: width 0.4s ease-in-out
}
.w3-animate-input:focus {
width: 100%
}
.w3-opacity,
.w3-hover-opacity:hover {
opacity: 0.60
}
.w3-opacity-off,
.w3-hover-opacity-off:hover {
opacity: 1
}
.w3-opacity-max {
opacity: 0.25
}
.w3-opacity-min {
opacity: 0.75
}
.w3-greyscale-max,
.w3-grayscale-max,
.w3-hover-greyscale:hover,
.w3-hover-grayscale:hover {
filter: grayscale(100%)
}
.w3-greyscale,
.w3-grayscale {
filter: grayscale(75%)
}
.w3-greyscale-min,
.w3-grayscale-min {
filter: grayscale(50%)
}
.w3-sepia {
filter: sepia(75%)
}
.w3-sepia-max,
.w3-hover-sepia:hover {
filter: sepia(100%)
}
.w3-sepia-min {
filter: sepia(50%)
}
.w3-tiny {
font-size: 10px
}
.w3-small {
font-size: 12px
}
.w3-medium {
font-size: 15px
}
.w3-large {
font-size: 25px;
font-weight: bold
}
.w3-xlarge {
font-size: 24px
}
.w3-xxlarge {
font-size: 36px
}
.w3-xxxlarge {
font-size: 48px
}
.w3-jumbo {
font-size: 64px
}
.w3-left-align {
text-align: left
}
.w3-right-align {
text-align: right
}
.w3-justify {
text-align: justify
}
.w3-center {
text-align: center
}
.w3-border-0 {
border: 0!
}
.w3-border {
border: 1px solid #ffffff
}
/* #ccc transparent color */
.w3-border-top {
border-top: 1px solid #ccc
}
.w3-border-bottom {
border-bottom: 1px solid #ccc
}
.w3-border-left {
border-left: 1px solid #ccc
}
.w3-border-right {
border-right: 1px solid #ccc
}
.w3-topbar {
border-top: 6px solid #ccc
}
.w3-bottombar {
border-bottom: 6px solid #ccc
}
.w3-leftbar {
border-left: 6px solid #ccc
}
.w3-rightbar {
border-right: 6px solid #ccc
}
.w3-section,
.w3-code {
margin-top: 50px;
margin-bottom: 50px
}
.w3-margin {
margin: 16px
}
.w3-margin-top {
margin-top: 16px
}
.w3-margin-bottom {
margin-bottom: 16px
}
.w3-margin-left {
margin-left: 16px
}
.w3-margin-right {
margin-right: 16px
}
.w3-padding-small {
padding: 4px 8px
}
.w3-padding {
padding: 8px 16px
}
.w3-padding-large {
padding: 12px 24px
}
.w3-padding-16 {
padding-top: 16px;
padding-bottom: 16px
}
.w3-padding-24 {
padding-top: 24px;
padding-bottom: 24px
}
.w3-padding-32 {
padding-top: 32px;
padding-bottom: 32px
}
.w3-padding-48 {
padding-top: 48px;
padding-bottom: 48px
}
.w3-padding-64 {
padding-top: 64px;
padding-bottom: 64px
}
.w3-left {
float: left;
cursor: pointer
}
.w3-right {
float: right;
cursor: pointer
}
.w3-button:hover {
color: #000;
background-color: #ffffffe0
}
.w3-transparent,
.w3-hover-none:hover {
color: #fff;
background-color: transparent
}
.w3-hover-none:hover {
box-shadow: none
}
/* Colors */
.w3-amber,
.w3-hover-amber:hover {
color: #000;
background-color: #ffc107
}
.w3-aqua,
.w3-hover-aqua:hover {
color: #000;
background-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<footer>
<!-- Marking the footer section -->
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<div class="footer">
<div class="left">
<p class="left">
<br/>
<i class="fa fa-wechat" style="font-size:15px;"></i>
<font size="5">SOCIAL</font> <br/><br/>
<i class="fa fa-facebook" style="font-size:15px;"></i>
<a href="http://www.facebook.com" class="class1">
<font size="3">Facebook </font> <br/><br/></a>
<i class="fa fa-twitter" style="font-size:15px;"></i>
<a href="http://www.Twitter.com" class="class1">
<font size="3">Twitter </font> <br/><br/></a>
<i class="fa fa-youtube" style="font-size:15px;"></i>
<a href="http://www.Youtube.com" class="class1">
<font size="3">Youtube </font> <br/><br/></a>
</p>
</div>
<div class="center">
<p class="center">
<br/>
<i class="fa fa-headphones" style="font-size:15px;"></i>
<font size="5">SUPPORT</font> <br/><br/>
<i class="fa fa-phone" style="font-size:15px;"></i>
<font size="3">Tellphone</font> <br/><br/>
<i class="fa fa-envelope" style="font-size:15px;"></i>
<font size="3">Email</font>
</p>
</div>
<div class="right">
<p class="right">
<br/>
<i class="fa fa-plus" style="font-size:15px;"></i>
<font size="5">EXTRA</font> <br/><br/>
<i class="fa fa-star" style="font-size:15px;"></i>
<font size="3">Chefs</font> <br/><br/>
<i class="fa fa-info" style="font-size:15px;"></i>
<font size="3">Facts</font>
</p>
</div>
</div>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
Go UP
Copyright 2018 - CookingClub.com
</footer>
Note that the <font> tag is obsolete. I recommend using CSS to style the font, instead.
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
That being said, I made a few immediate changes:
.left, .right, and .center are set to width:33%. Since this is applied to <div> elements and their <p> children, the width of the <p> elements is too narrow (33% of 33%) and the contents wrap to two lines. I just removed the width for now, but it could be applied only to the <div> elements and not the <p> elements.
.footer a and footer a.class1 are set to display:block, which puts those elements on their own lines. I removed them.
Additionally, I recommend not using <br> elements for layout purposes.
See Using <br/> versus <p> and Is it sometimes bad to use <BR />?
* {
margin: 0;
padding: 0;
}
/* Body CSS (Background image, font) */
body {
font-size: 0.825em;
background-image: url(img/Background_Image.jpg);
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-color: #464646;
font-family: Arial, Helvetica, sans-serif;
}
/* All Footer Styling: */
footer {
margin-bottom: 30px;
text-align: center;
font-size: 0.825em;
}
/* "Article" Footer Styling: */
.footer {
/* The dividing footer: */
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 200px;
background-color: #ffffffe0;
/* #efebe785 */
color: #000000;
/* Align all the text left so it lines up */
text-align: left;
border: 1px solid #00000094;
}
/* "Article" Footer "table": */
.left,
.right,
.center {
float: left;
/*width: 33.333%;*/
position: relative;
box-sizing: border-box;
padding-right: 15px;
padding-left: 15px;
}
/* Text on footer: */
footer p {
margin-bottom: -2.5em;
position: relative;
}
/* Text on footer: */
footer a {
color: #000000;
background-color: #ffffffe0;
/*display: block;*/
padding: 2px 4px;
z-index: 100;
position: relative;
border: 1px solid #00000094;
text-decoration: none;
outline: none;
}
footer a:hover {
text-decoration: none;
background-color: #000000e0;
color: white;
}
footer a.class1 {
color: #000000;
background-color: #efebe700;
/*display: block;*/
padding: 1px 1px;
z-index: 100;
position: relative;
border: none;
}
<!--Script Links -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<footer>
<div class="footer">
<div class="left">
<p class="left">
<i class="fa fa-wechat" style="font-size:15px;"></i>
<font size="5">SOCIAL</font> <br/><br/>
<i class="fa fa-facebook" style="font-size:15px;"></i>
<a href="http://www.facebook.com" class="class1">
<font size="3">Facebook </font> <br/><br/></a>
<i class="fa fa-twitter" style="font-size:15px;"></i>
<a href="http://www.Twitter.com" class="class1">
<font size="3">Twitter </font> <br/><br/></a>
<i class="fa fa-youtube" style="font-size:15px;"></i>
<a href="http://www.Youtube.com" class="class1">
<font size="3">Youtube </font> <br/><br/></a>
</p>
</div>
<div class="center">
<p class="center">
<i class="fa fa-headphones" style="font-size:15px;"></i>
<font size="5">SUPPORT</font> <br/><br/>
<i class="fa fa-phone" style="font-size:15px;"></i>
<font size="3">Tellphone</font> <br/><br/>
<i class="fa fa-envelope" style="font-size:15px;"></i>
<font size="3">Email</font>
</p>
</div>
<div class="right">
<p class="right">
<i class="fa fa-plus" style="font-size:15px;"></i>
<font size="5">EXTRA</font> <br/><br/>
<i class="fa fa-star" style="font-size:15px;"></i>
<font size="3">Chefs</font> <br/><br/>
<i class="fa fa-info" style="font-size:15px;"></i>
<font size="3">Facts</font>
</p>
</div>
</div>
</footer>
I agree with nootnoot that the structure of the footer elements could be optimized.
Here an example of one method:
* {
margin: 0;
padding: 0;
}
/* Body CSS (Background image, font) */
body {
font-size: 0.825em;
background-image: url(img/Background_Image.jpg);
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-color: #464646;
font-family: Arial, Helvetica, sans-serif;
}
footer {
margin-bottom: 30px;
text-align: center;
font-size: 0.825em;
}
.footer {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 200px;
background-color: #ffffffe0;
color: #000000;
text-align: left;
border: 1px solid #00000094;
}
/* "Article" Footer "table": */
.column {
width: 33%;
float: left;
box-sizing: border-box;
padding-right: 15px;
padding-left: 15px;
}
.footer_item {
display: block;
margin: 0 0 .25em;
font-size: 1.2em;
color: black;
}
a.footer_item {
color: #555;
text-decoration: none;
}
a.footer_item:hover {
color: black;
}
.footer_item_large {
font-size: 1.8em;
}
.footer_item .fa {
font-size: 15px;
width: 1.5em;
}
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<footer>
<div class="footer">
<div class="column">
<span class="footer_item footer_item_large">
<i class="fa fa-wechat"></i>SOCIAL
</span>
<a href="http://www.facebook.com" class="footer_item">
<i class="fa fa-facebook"></i>Facebook
</a>
<a href="http://www.Twitter.com" class="footer_item">
<i class="fa fa-twitter"></i>Twitter
</a>
<a href="http://www.Youtube.com" class="footer_item">
<i class="fa fa-youtube"></i>Youtube
</a>
</div>
<div class="column">
<span class="footer_item footer_item_large">
<i class="fa fa-headphones"></i>SUPPORT
</span>
<span class="footer_item">
<i class="fa fa-phone"></i>Telephone
</span>
<span class="footer_item">
<i class="fa fa-envelope"></i>Email
</span>
</div>
<div class="column">
<span class="footer_item footer_item_large">
<i class="fa fa-plus"></i>EXTRA
</span>
<span class="footer_item">
<i class="fa fa-star"></i>Chefs
</span>
<span class="footer_item">
<i class="fa fa-info"></i>Facts
</span>
</div>
</div>
</footer>
I also agree with Liamm12's comment that you could use flexbox for the footer elements.
Example below:
* {
margin: 0;
padding: 0;
}
/* Body CSS (Background image, font) */
body {
font-size: 0.825em;
background-image: url(img/Background_Image.jpg);
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-color: #464646;
font-family: Arial, Helvetica, sans-serif;
}
footer {
margin-bottom: 30px;
text-align: center;
font-size: 0.825em;
}
.footer {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
background-color: #ffffffe0;
color: #000000;
text-align: left;
border: 1px solid #00000094;
display:flex;
justify-content:space-between;
padding:5%;
box-sizing:border-box;
}
.footer_item {
display: block;
margin: 0 0 .25em;
font-size: 1.2em;
color: black;
}
.footer_item_large {
font-size: 1.8em;
}
a.footer_item {
color: #555;
text-decoration: none;
}
a.footer_item:hover {
color: black;
}
.footer_item .fa {
font-size: 15px;
width: 1.5em;
}
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<footer>
<div class="footer">
<div class="column">
<span class="footer_item footer_item_large">
<i class="fa fa-wechat"></i>SOCIAL
</span>
<a href="http://www.facebook.com" class="footer_item">
<i class="fa fa-facebook"></i>Facebook
</a>
<a href="http://www.Twitter.com" class="footer_item">
<i class="fa fa-twitter"></i>Twitter
</a>
<a href="http://www.Youtube.com" class="footer_item">
<i class="fa fa-youtube"></i>Youtube
</a>
</div>
<div class="column">
<span class="footer_item footer_item_large">
<i class="fa fa-headphones"></i>SUPPORT
</span>
<span class="footer_item">
<i class="fa fa-phone"></i>Telephone
</span>
<span class="footer_item">
<i class="fa fa-envelope"></i>Email
</span>
</div>
<div class="column">
<span class="footer_item footer_item_large">
<i class="fa fa-plus"></i>EXTRA
</span>
<span class="footer_item">
<i class="fa fa-star"></i>Chefs
</span>
<span class="footer_item">
<i class="fa fa-info"></i>Facts
</span>
</div>
</div>
</footer>
have you tried putting the icons inside the tags? Like this:
<font size="5"><i class="fa fa-wechat" style="font-size:15px;"></i> SOCIAL</font>
That might help put the icons inline with the text
Related
How can I automatically make an Image in my navbar the max height without changing the size of the navabar?
I have a navbar at the top of my page with an image logo and some hyperlinks. I want to make it so the image is always the max height it can be while staying within the foot print of the navbar. Here's what I mean: As you can see, the image in the top left has 10px padding, but the image is slightly too small and has a larger gap at the bottom. This is my code: HTML: <!DOCTYPE html> <html lang="en-GB"> <head> <meta charset="UTF-8"> <title>Home | Aeron</title> <link rel="icon" type="image/x-icon" href="./images/favicon.png"> <link rel="stylesheet" media="screen and (min-width: 1294px)" href="main.css"> <link rel="stylesheet" media="screen and (max-width: 1294px)" href="mobile.css"> <link href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <div class="header"> <img src="./images/logo.png" title="Aeron" alt="logo" class="header-logo"> <div class="desktop-nav"> <ul class="desktop-nav-links"> <li>Home</li> <li>Portfolio</li> <li>Contact me</li> <li>About me</li> <li>Recipes</li> <li>Progress</li> <li>PC Setup Designer</li> <li>Gallery</li> </ul> </div> </body> </html> CSS: html { box-sizing: border-box; scroll-behavior: smooth; font-family: 'Poppins', sans-serif; height: 100%; } body { margin: 0; background: linear-gradient(45deg, #280036 0%, #000836 100%); background-size: cover; background-repeat: no-repeat; background-attachment: fixed; height: 100%; } .header-logo { margin: 10px; float: left; height: 72px; } .header { background-color: #000000; overflow: hidden; width: 100%; } .desktop-nav-links { float: right; margin-right: 1.5vw; } .desktop-nav-links a { margin: 1.5vw; display: block; color: white; font-size: 1vw; } .desktop-nav-links li { float: left; list-style: none; } How can I make it so no matter what screen size is, the image is always as big as it can be without influening the navbar height?
Basically by making it position:absolute inside the position:relative header, you can control where it begins top:0 and where it'll end bottom:0. Update: We will wrap the image inside a container. That container will take 100% of the height by using absolute position with top and bottom equals 0. It will have a padding of the desired 10px, where as inside of it the image will reside having a height of 100%. :root { color-scheme: dark; } html { box-sizing: border-box; scroll-behavior: smooth; font-family: 'Poppins', sans-serif; height: 100%; } body { margin: 0; background: linear-gradient(45deg, #280036 0%, #000836 100%); background-size: cover; background-repeat: no-repeat; background-attachment: fixed; height: 100%; } .heading { margin: 20px; font-size: 2.5vw; text-align: center; color: #ffffff; } p { color: #ffffff; font-size: 20px; } a { text-decoration: none; } .slideshow-container { display: block; width: 80%; position: relative; margin: 10px; margin-left: auto; margin-right: auto; } .mySlides { display: none; } .prev, .next { cursor: pointer; position: absolute; top: 50%; width: auto; margin-top: -22px; padding: 16px; color: white; font-weight: bold; font-size: 18px; transition: 0.6s ease; border-radius: 0 3px 3px 0; user-select: none; } .next { right: 0; border-radius: 3px 0 0 3px; } .prev:hover, .next:hover { background-color: #a6a6a650; } .slide-name { color: #f2f2f2; font-size: 15px; padding: 8px 12px; position: absolute; bottom: 8px; width: 100%; text-align: center; } .slide-number { color: #f2f2f2; font-size: 12px; padding: 8px 12px; position: absolute; top: 0; } .progress-bar { width: 100%; border: none; border-radius: 100px; background-color: #FFFFFF; padding: 3px; } .progress-tag { color: #DDDDDD; margin-left: 10px; } .fill-html { width: 75%; background-color: #FA3200; border-radius: 100px; } .fill-css { width: 60%; background-color: #0000C8; border-radius: 100px; } .fill-js { width: 10%; background-color: #C80000; border-radius: 100px; } .fill-php { width: 0%; background-color: #00C832; border-radius: 100px; } .fill-rwpd { width: 100%; background-color: #450099; border-radius: 100px; } #return { display: none; position: fixed; bottom: 50px; right: 50px; z-index: 99; border: none; background-color: #3a3a3a; cursor: pointer; border-radius: 100px; width: 60px; height: 60px; } #return:hover { background-color: #2a2a2a; } .progress-container { padding: 10px; } .headar-logo-container { position: absolute; left: 0; top: 0; bottom: 0; padding: 10px; } .header-logo { height: 100%; } .header { background-color: #000000; overflow: hidden; width: 100%; position: relative; } .desktop-nav-links { float: right; margin-right: 1.5vw; } .desktop-nav-links a { margin: 1.5vw; display: block; color: white; font-size: 1vw; } .desktop-nav-links a:hover { color: #b4b4b4; transition: 0.2s all ease; } .desktop-nav-links li { float: left; list-style: none; } .menu-button { display: none; } .copyright { color: #b4b4b4; font-size: 15px; } footer { background: #000000; padding: 25px 0; text-align: center; bottom: 0; width: 100%; height: auto; display: block; } .hyperlink { display: inline-block; position: relative; color: #b4b4b4; } .hyperlink:after { content: ''; position: absolute; width: 100%; transform: scaleX(0); height: 2px; bottom: 0px; left: 0; background-color: #b4b4b4; transform-origin: bottom right; transition: transform 0.25s ease-out; } .hyperlink:hover:after { transform: scaleX(1); transform-origin: bottom left; } .sidenav { height: 100%; width: 0; position: fixed; z-index: 1; top: 0; right: 0; background-color: #111111; overflow-x: hidden; transition: 0.5s; padding-top: 60px; } .sidenav .closebtn { position: absolute; top: 0; right: 25px; font-size: 35px; margin-left: 50px; } .recipe-container { margin: 0px; display: grid; grid-template-columns: auto auto auto; justify-content: center; } .recipe-window { margin: 10px; padding: 10px; border: 1px solid #ffffff; background-color: #ffffff; word-break: break-word; width: min-content; border-radius: 10px; } .recipe-title { color: black; margin-top: 5px; padding: 0px; font-size: 25px; } .footer-links { display: flex; justify-content: center; align-items: center; } .footer-links p { margin: 0; } .footer-links a { color: #ffffff; margin: auto 10px auto 10px; } .footer-links a:hover { color: #b4b4b4; } .about { text-align: center; padding: 0 300px; } .mobile-nav { display: none; } .footer-logo { width: 160px; } .table-container { display: grid; grid-template-columns: auto; justify-content: center; } table { font-family: arial, sans-serif; border-collapse: collapse; width: 100%; background-color: white; color: black; border: 2px solid black; } td, th { border: 1px solid black; padding: 10px 20px; } th { font-size: 20px; } td { font-size: 15px; } tr:nth-child(even) { background-color: #dddddd; } .output { display: grid; grid-template-columns: auto; justify-content: center; border-radius: 10px; } .total1 { border: none; } .pc-border-title { text-align: center; } .intro-heading { font-size: 25px; text-align: center; color: #ffffff; } .pcbuilder-link { color: #cecece; } .pcbuilder-link:hover { color: #adadad; } .table-heading { font-size: 50px; text-align: center; color: #000000; margin-bottom: 10px; margin-top: 0px; border: 2px solid #000000; } #photo { padding: 10px; background-color: #ffffff; border-radius: 10px; } .scrn_button { font-size: 30px; background-color: #bfbfbf; border: 2px solid black; border-radius: 10px; color: black; } .scrn_button:hover { cursor: pointer; background-color: #9b9b9b; } .scrn_button:active { background-color: #797979; } .contact-form { border-radius: 10px; background-color: #ffffff; color: #000000; padding: 10px; width: auto; } .input { width: 100%; background-color: #bfbfbf; border: none; color: black; border-radius: 10px 0px 10px 0px; padding: 5px; font-size: 18px; } .contact-form-container { margin: 10px 300px; } .submit-button-container { text-align: center; } .submit-button { font-size: 25px; border-radius: 10px; border: none; background-color: #818181; user-select: none; } .submit-button:active { background-color: #414141; transition: ease 0.1s; } #keyframes fadeInAnimation { 0% { opacity: 0; } 100% { opacity: 1; } } .price::before { content: "\00a3"; } #msg { background-color: #bfbfbf; border: none; color: black; border-radius: 10px 0px 10px 0px; padding: 5px; resize: none; width: 100%; font-size: 15px; } .submit-button:hover::after { content: ' >'; } .upload-label { background-color: #0030b0; color: white; padding: 10px; font-size: 18px; border-radius: 5px; cursor: pointer; border: none; user-select: none; } .upload { margin: 10px; text-align: center; } #output { width: 100%; text-align: center; padding: 10px; } .portfolio-intro { font-size: 30px; } .content { margin: 10px; } .professional:hover:before { content: 'un-'; font-weight: bolder; } .learn-more { color: #ffd000; font-size: 20px; } .learn-more:hover { color: #dab200; transition: all ease 0.3s; } .learn-more:active { color: #bb9900; transition: all 0s; } <!DOCTYPE html> <html lang="en-GB"> <head> <meta charset="UTF-8"> <title>Home | Aeron</title> <link rel="icon" type="image/x-icon" href="./images/favicon.png"> <link rel="stylesheet" media="screen and (min-width: 1294px)" href="main.css"> <link rel="stylesheet" media="screen and (max-width: 1294px)" href="mobile.css"> <link href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <div class="header"> <div class="headar-logo-container"> <img src="https://picsum.photos/30/20" title="Aeron" alt="logo" class="header-logo"> </div> <div class="desktop-nav"> <ul class="desktop-nav-links"> <li>Home</li> <li>Portfolio</li> <li>Contact me</li> <li>About me</li> <li>Recipes</li> <li>Progress</li> <li>PC Setup Designer</li> <li>Gallery</li> </ul> </div> <div class="mobile-nav"> <span class="menu-button" onclick="openNav()">☰</span> <div id="mobile-nav-panel" class="mobile-nav-panel"> + <ul class="mobile-nav-link-list"> <li class="mobile-nav-link">Home</li> <hr> <li class="mobile-nav-link">Portfolio</li> <hr> <li class="mobile-nav-link">Contact me</li> <hr> <li class="mobile-nav-link">About me</li> <hr> <li class="mobile-nav-link">Recipes</li> <hr> <li class="mobile-nav-link">Progress</li> <hr> <li class="mobile-nav-link">PC Setup Designer</li> <hr> <li class="mobile-nav-link">Gallery</li> <hr> <li class="mobile-nav-link"></li> </ul> </div> </div> </div> <h1 class="heading">Welcome to Aeron</h1> <div class="content"> </div> <div style="height:100%"></div> <footer> <img src="./images/logo.png" title="Aeron" alt="logo" class="footer-logo"> <p class="copyright">Copyright © 2022 Aeron</p> <div class="footer-links"> About me <p>|</p> Policy <p>|</p> <a href=contact.html>Contact me</a> </div> </footer> <button onclick="topFunction()" id="return" title="Return To Top"><img src="./images/arrow_upward.svg" width="30px" alt="Return"></button> <script> let mybutton = document.getElementById("return"); window.onscroll = function() { scrollFunction() }; function scrollFunction() { if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { mybutton.style.display = "block"; } else { mybutton.style.display = "none"; } } function topFunction() { document.body.scrollTop = 0; } function openNav() { document.getElementById("mobile-nav-panel").style.width = "100%"; } function closeNav() { document.getElementById("mobile-nav-panel").style.width = "0"; } </script> </body> </html>
Change font-size does not influence whole header
I am trying to do sticky header on my existing page an I have all margins in rem but when I set up font-size for main header which contains all header content is influenced just ul list part and other margins are the same. Can you please advice me what is problem? I want to make header more slim when I scroll down. JQuery code: $(window).scroll(function() { if ($(this).scrollTop() > 10) { $('.mheader').addClass("sticky_header"); } else { $('.mheader ').removeClass("sticky_header"); } }) CSS header code: .mheader { width: 100%; height: 4.75rem; box-shadow: 1px 1px 1px #ccc; background: #eee; } .sticky_header { position: fixed; z-index: 999; font-size: 0.8rem !important; transition: all 1s ease; } .mheader__logo img { position: relative; width: 10.1%; float: left; height: 2.3rem; margin: 1.225rem 0.9375rem; } .mheader__nav { float: left; width: 55%; margin: 0.9375rem 0 0.9375rem 0; } .mheader__nav-mobilemenu { display: none; } .mheader__nav-list { width: 100%; margin: 0; } .mheader__nav-list li { float: left; width: 18%; margin: 0 20px; padding-left: 10px; border-left: 1px solid #ccc; list-style-type: none; text-transform: uppercase; font-weight: bold; font-family: 'Roboto Condensed', sans-serif; } .mheader__nav-list a { display: block; text-decoration: none; color: black; } .mheader__nav-list a:hover { color: black; border-bottom: 2px solid #111; } .mheader__search { position: relative; float: right; width: 25%; margin: 1.225rem 1.875rem 1.225rem 0; } .mheader__search input { width: 100%; height: 2.3rem; border: 1px solid #aaa; border-radius: 0.25rem; font-size: 1.0625rem; padding-left: 0.25rem; } .mheader__search-button { position: absolute; right: 0px; top: 4px; } .mheader__search button { float: right; border: none; background: none; font-size: 1.125rem; cursor: pointer; } HTML code <header class="mheader"> <div class="mheader__logo"> <img src="/assets/img/logo.png" alt=""> </div> <div class="mheader__nav"> <a href="#menu" class="mheader__nav-mobilemenu"> <img src="/assets/img/mob-menu.svg" alt=""> </a> <!--<i class="fa fa-bars"></i>--> <ul class="mheader__nav-list group"> <!-- use absolute path -> do not change path with subfolder--> <li>Job </br>ToDo</li> <li>Activity </br>Home</li> <li></br>BLOG</li> <li>Sign </br>Out</li> </ul> </div> <div class="mheader__search"> <input type="text" placeholder="Search..."> <div class="mheader__search-button"> <button type="submit"><i class="fa fa-search"></i></button> </div> </div> </header> Thank you
Make sure you use EM instead of REM if you want to make it relative to some parent. So all the REM sizes are based on the <html> tag. If you do em, $(window).scroll(function() { if ($(this).scrollTop() > 10) { $('.mheader').addClass("sticky_header"); } else { $('.mheader ').removeClass("sticky_header"); } }) body{ height:4000px; } .mheader { width: 100%; height: 4.75rem; box-shadow: 1px 1px 1px #ccc; background: #eee; } .sticky_header { position: fixed; z-index: 999; font-size: 0.8em !important; transition: all 1s ease; } .mheader__logo img { position: relative; width: 10.1%; float: left; height: 2.3em; margin: 1.225em 0.9375em; } .mheader__nav { float: left; width: 55%; margin: 0.9375em 0 0.9375em 0; } .mheader__nav-mobilemenu { display: none; } .mheader__nav-list { width: 100%; margin: 0; } .mheader__nav-list li { float: left; width: 18%; margin: 0 20px; padding-left: 10px; border-left: 1px solid #ccc; list-style-type: none; text-transform: uppercase; font-weight: bold; font-family: 'Roboto Condensed', sans-serif; } .mheader__nav-list a { display: block; text-decoration: none; color: black; } .mheader__nav-list a:hover { color: black; border-bottom: 2px solid #111; } .mheader__search { position: relative; float: right; width: 25%; margin: 1.225em 1.875em 1.225em 0; } .mheader__search input { width: 100%; height: 2.3em; border: 1px solid #aaa; border-radius: 0.25em; font-size: 1.0625em; padding-left: 0.25em; } .mheader__search-button { position: absolute; right: 0px; top: 4px; } .mheader__search button { float: right; border: none; background: none; font-size: 1.125em; cursor: pointer; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <header class="mheader"> <div class="mheader__logo"> <img src="/assets/img/logo.png" alt=""> </div> <div class="mheader__nav"> <a href="#menu" class="mheader__nav-mobilemenu"> <img src="/assets/img/mob-menu.svg" alt=""> </a> <!--<i class="fa fa-bars"></i>--> <ul class="mheader__nav-list group"> <!-- use absolute path -> do not change path with subfolder--> <li>Job </br>ToDo</li> <li>Activity </br>Home</li> <li></br>BLOG</li> <li>Sign </br>Out</li> </ul> </div> <div class="mheader__search"> <input type="text" placeholder="Search..."> <div class="mheader__search-button"> <button type="submit"><i class="fa fa-search"></i></button> </div> </div> </header>
Create a responsive burger menu
I've made a lot of progress on my site, but the problem is that my burger menu doesn't show up, does anyone have an idea what's causing this please? I tried different things, debugging and so on but I can't make it appear again -_- So if anyone knows why, and has explanations I'm a taker I'm completely lost I know what to do lol And then if you have other constructive criticism on my code of course I'm a taker thank you in advance for giving me your time $('.m-nav-toggle').click(function(e) { e.preventDefault(); $('.m-right').toggleClass('is-open'); $('m-nav-toggle').toggleClass('is-open'); }) #import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght#0,100;0,300;0,400;0,900;1,700&display=swap'); #import url('https://fonts.googleapis.com/css2?family=Roboto:wght#900&display=swap'); .menu { background: #757de8; width: 100%; height: 66px; line-height: 66px; box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); } .m-left { float: left; } .logo { margin: 0; padding: 0; } .m-right { float: right; } .m-links { text-decoration: none; color: #fff; text-transform: uppercase; font-weight: 700; padding: 0; margin: 0 15px; font-family: 'Lato', sans-serif; transition: all 0.3s ease-in-out; border-bottom: 2px solid transparent; padding-bottom: 3px; } .m-links:hover { border-color: #fff; } .m-links i { margin-right: 5px; } .m-nav-toggle { width: 40px; height: 66px; display: none; align-items: center; float: right; cursor: pointer; } span.m-nav-toggle-icon, span.m-toggle-icon:before, span.m-toggle-icon:after { content: ""; display: block; width: 100%; height: 3px; background: #fff; position: relative; transition: all 0.3s ease-in-out; } span.m-toggle-icon:before { top: 12px; } span.m-toggle-icon:after { top: -14px; } .m-right.is-open { transform: translateX(0); } .m-nav-toggle.is-open span.m-toggle-icon { background: transparent; } .m-nav-toggle.is-open span.m-toggle-icon:before, .m-nav-toggle.is-open span.m-toggle-icon:after { transform-origin: center; transform: rotate(45deg); top: 0; } #media only screen and (max-width: 950px) { .m-right { position: absolute; top: 66px; right: 0; width: 200px; height: 100%; background: #757de8; transform: translateX(100%); transition: all 0.3s ease-in-out; } .m-links { display: block; text-align: center; padding: 0; margin: 0 20px; height: 55px; } .m-nav-toggle.is-open span.m-toggle-icon:before { transform: rotate(-45deg); } .m-nav-toggle { display: flex; } } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer" ></script> <script src="https://kit.fontawesome.com/8b1b202200.js" crossorigin="anonymous"></script> <header role="header"> <nav class="menu" role="navigation"> <div class="inner"> <img class="fit-picture" src="img/logo.svga"> <div class="m-left"></div> <div class="m-right"> <i class="fas fa-home"></i> Home <i class="fas fa-book"></i> Documentation <i class="fas fa-comments"></i> Feedback <i class="fas fa-handshake"></i> Partners <i class="fas fa-envelope"></i> Contact </div> <div class="m-nav-toggle"> <span class="m-toggle-icon"></span> </div> </div> </nav> </header> File : normalize.css : html, body { margin: 0; padding: 0; overflow-x: hidden; } .inner { width: 80%; margin: auto; } enter code here
The "m-toggle-icon" class needs "width:100%" and it will be shown. This is because its parent has "display: flex". Working example: $('.m-nav-toggle').click(function(e) { e.preventDefault(); $('.m-right').toggleClass('is-open'); $('m-nav-toggle').toggleClass('is-open'); }) #import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght#0,100;0,300;0,400;0,900;1,700&display=swap'); #import url('https://fonts.googleapis.com/css2?family=Roboto:wght#900&display=swap'); .menu { background: #757de8; width: 100%; height: 66px; line-height: 66px; box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); } .m-left { float: left; } .logo { margin: 0; padding: 0; } .m-right { float: right; } .m-links { text-decoration: none; color: #fff; text-transform: uppercase; font-weight: 700; padding: 0; margin: 0 15px; font-family: 'Lato', sans-serif; transition: all 0.3s ease-in-out; border-bottom: 2px solid transparent; padding-bottom: 3px; } .m-links:hover { border-color: #fff; } .m-links i { margin-right: 5px; } .m-nav-toggle { width: 40px; height: 66px; display: none; align-items: center; float: right; cursor: pointer; } span.m-nav-toggle-icon, span.m-toggle-icon:before, span.m-toggle-icon:after { content: ""; display: block; width: 100%; height: 3px; background: #fff; position: relative; transition: all 0.3s ease-in-out; } span.m-toggle-icon:before { top: 12px; } span.m-toggle-icon:after { top: -14px; } .m-right.is-open { transform: translateX(0); } .m-nav-toggle.is-open span.m-toggle-icon { background: transparent; } .m-nav-toggle.is-open span.m-toggle-icon:before, .m-nav-toggle.is-open span.m-toggle-icon:after { transform-origin: center; transform: rotate(45deg); top: 0; } #media only screen and (max-width: 950px) { .m-right { position: absolute; top: 66px; right: 0; width: 200px; height: 100%; background: #757de8; transform: translateX(100%); transition: all 0.3s ease-in-out; } .m-links { display: block; text-align: center; padding: 0; margin: 0 20px; height: 55px; } .m-nav-toggle.is-open span.m-toggle-icon:before { transform: rotate(-45deg); } .m-nav-toggle { display: flex; } } .m-toggle-icon { width: 100%; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer" ></script> <script src="https://kit.fontawesome.com/8b1b202200.js" crossorigin="anonymous"></script> <header role="header"> <nav class="menu" role="navigation"> <div class="inner"> <img class="fit-picture" src="img/logo.svga"> <div class="m-left"></div> <div class="m-right"> <i class="fas fa-home"></i> Home <i class="fas fa-book"></i> Documentation <i class="fas fa-comments"></i> Feedback <i class="fas fa-handshake"></i> Partners <i class="fas fa-envelope"></i> Contact </div> <div class="m-nav-toggle"> <span class="m-toggle-icon"></span> </div> </div> </nav> </header>
How to keep div elements at bottom of page
I have a two-columned div element that I need to have at the bottom of the page to act as a footer. The problem is I have tried using position:fixed and bottom:0 to make the element appear at the bottom. This works but only brings one of the #column divs down to the bottom, the other disappears. I would appreciate any assistance. Code: /* ~ Copyright (c) Macleay Netball Association (made by Tom Carpenter for Year 11 IPT Assessment Task #2.) 2019. */ html>body { background: none; padding: 0; margin: 0; height: 100%; overflow: hidden; font-family: 'Trebuchet MS', sans-serif; /* Trebuchet MS as main font throughout website, sans-serif acting as a backup */ } #wrapper { top: 0; bottom: 0; left: 0; right: 0; overflow: hidden; position: absolute; background: #1B315E; } ::-webkit-scrollbar { display: none; } * { box-sizing: border-box; /* Alignment of DropDown Navigation Menu and Slideshow */ } .navigation { background: #444; overflow: hidden; top: 0; } .menuDropDown { overflow: hidden; float: left; } .menuDropDown>#menuButton { font-size: 12px; padding: 16px 16px; /* Will result in final height of navigation */ margin: 0; outline: none; border: none; font: inherit; background: inherit; color: #FFF; } #menuButton:hover, .navigation>.menuDropDown:hover>#menuButton { border: none; outline: none; background: #666; color: #1B315E; } .menuDropDown:hover>.menuContent { display: block; } .menuContent { display: none; position: absolute; background: none; width: 100%; left: 0; max-height: 85vh; overflow: auto; box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); z-index: 1; } .menuRow:after { display: table; clear: both; content: ""; } .menuColumn { width: 25%; height: 100px; overflow-y: auto; padding: 5px; float: left; background: #666; } .menuColumn>a { float: none; display: block; text-align: left; text-decoration: none; font-size: 14px; padding: 8px; color: #1B315E; } .menuColumn>a.current { background: #777; } .menuColumn>a:hover { background: #888; } .logo { float: right; padding-right: 10px; width: 60px; height: 50px; } .main { width: 100%; height: calc(100vh - 43px); float: left; background: none; position: absolute; overflow: auto; padding: 8px; } .mainHeader { color: #FFF; text-align: center; } .mainImg { display: block; margin-left: auto; margin-right: auto; width: 50%; } .mainBody { color: #FFF; padding: 8px; } .row:after { content: ""; clear: both; display: table; } .column { float: left; width: 33.33%; padding: 8px; } #column { float: left; width: 50%; padding: 8px; background: #888; bottom: 0; } .sponsers { float: left; width: 20%; padding: 8px; -webkit-filter: grayscale(100%); filter: grayscale(100%); } .sponsers:hover { -webkit-filter: grayscale(80%); filter: grayscale(80%); } .slideshow { /* Slideshow Container containing Images, Sliders and Captions */ position: relative; margin: auto; max-width: 1000px; } .slides { display: none; } .slideshowImages { width: 100%; } .slideButton { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); background: #888; color: #FFF; border: none; cursor: pointer; padding: 16px 32px; font-size: 18px; text-align: center; border-radius: 10px; font-weight: bold; } .mnaHeader { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); } .slideButton:hover { background: #666; } .previous, .next { cursor: pointer; position: absolute; top: 50%; width: auto; margin-top: -22px; padding: 16px; color: #FFF; font-weight: bold; font-size: 18px; transition: 0.3s ease; border-radius: 0 3px 3px 0; user-select: none; } .next { right: 0; border-radius: 3px 0 0 3px; } .previous:hover, .next:hover { background: rgba(0, 0, 0, 0.8); } table { width: 100%; font-size: 16px; color: #FFF; } .tableCaption { font-weight: bold; font-size: 18px; color: #33CC33; } table, th, td { border-collapse: collapse; border: 2px solid #888; } th, td { padding: 8px; text-align: left; } #headerTable { width: 33.33%; background: #888; font-size: 18px; color: #33CC33; } .linkProp { color: #FFF; text-decoration: underline; } .newsPanel { width: 100%; background: #888; height: 135px; } .imgNewsPreview { width: 215px; height: 135px; padding: 4px; float: left; } .newsHeaderPreview { color: #FFF; margin-top: 0px; } .newsBodyPreview { color: #FFF; margin-top: -12px; } .caption { color: #33CC33; text-align: center; position: absolute; font-size: 20px; width: 100%; padding: 8px 12px; bottom: 16px; } .collapsible { background: #888; color: #FFF; font-weight: bold; width: 100%; padding: 18px; cursor: pointer; font-size: 16px; outline: none; border: none; text-align: left; } .active, .collapsible:hover { background: #666; } .collapsible:after { content: '\002B'; color: #FFF; font-weight: bold; float: right; margin-left: 4px; } .active:after { content: '\2212'; } .contentCollapsible { padding: 0px 18px; max-height: 0; overflow: hidden; transition: max-height 0.2s ease-out; background: #F8F8F8; } .fade { -webkit-animation-name: fade; /* To work on Safari (Apple) */ -webkit-animation-duration: 1s; /* To work on Safari (Apple) */ animation-name: fade; animation-duration: 1s; } .buttonReturn { position: absolute; margin-left: 20px; margin-top: 20px; background: #888; color: #FFF; border: none; cursor: pointer; font-size: 36px; text-align: center; border-radius: 50%; font-weight: bold; } .videoProp { display: block; margin-left: auto; margin-right: auto; width: 50%; height: 400px; } #-webkit-keyframes fade { from { opacity: 0.4 } to { opacity: 1 } } #keyframes fade { from { opacity: 0.4 } to { opacity: 1 } } #media screen and (max-width: 600px) { /* Stacks navigation menu acting for the site to be responsive */ .menuColumn { width: 100%; height: auto; } } #media screen and (max-width: 800px) { /* Stacks Image Header on Top - acting as responsive */ .column, #column { width: 100%; } } #media screen and (max-width: 600px) { /* Responsive Sponser Images */ .sponsers { width: 33.33%; } } #media screen and (max-width: 800px) { /* Increases video resolution as screen reduces */ .videoProp { width: 100%; } } #media screen and (max-width: 600px) { /* Reduces font-size as screen resolution lowers */ .newsBodyPreview { font-size: 14px; } } #media screen and (max-width: 300px) { /* Reduces font-sizes within the slideshow <div> */ .previous, .next, .caption { font-size: 14px; } } <!DOCTYPE HTML> <!-- ~ Copyright (c) Macleay Netball Association (made by Tom Carpenter for Year 11 IPT Assessment Task #2.) 2019. --> <html lang="en-AU"> <head> <title>Contact Us — Macleay Netball Association</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0"> <link rel="stylesheet" href="../style.css" type="text/css"> <!-- Internal Stylesheet --> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous"> <!-- External Font Stylesheet --> <link rel="shortcut icon" href="../Assets/Img/mnaHeader.png"> <!-- Tab Browser Icon (Favicon) --> </head> <body> <div id="wrapper"> <div class="navigation"> <div class="menuDropDown"> <button id="menuButton" title="Navigation Menu"><i class="fas fa-bars"></i> Menu</button> <div class="menuContent"> <div class="menuRow"> <div class="menuColumn"> <a title="Home" href="../index.html"><i class="fas fa-home"></i> Home</a> <a title="Association Contacts" href="contacts.html"><i class="fas fa-address-book"></i> Association Contacts</a> </div> <div class="menuColumn"> <a title="Weekly Draw" href="weekly-draw.html"><i class="fas fa-user-friends"></i> Weekly Draw</a> <a title="News" href="#"><i class="far fa-newspaper"></i> News</a> </div> <div class="menuColumn"> <a title="Quick Links" href="links.html"><i class="fas fa-bookmark"></i> Quick Links</a> <a title="Representative Teams" href="representative-teams.html"><i class="fas fa-certificate"></i> Representative Teams</a> </div> <div class="menuColumn"> <a title="Documentation" href="documentation.html"><i class="fas fa-file"></i> Documentation</a> <a class="current" title="Contact Us" href="contact-us.html"><i class="fas fa-phone"></i> Contact Us</a> </div> </div> </div> </div> <img src="../Assets/Img/mnaHeader.png" alt="Macleay Netball Association" title="Macleay Netball Association" class="logo"> <!-- Macleay Netball Association Main Logo --> </div> <!-- End of Navigation --> <div class="main"> <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3417.0548484369647!2d152.83521681537312!3d-31.080401281517187!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6b9ddf84d6da904b%3A0xfc941d1ded8f7a25!2sPam+Guyer+Netball+Centre!5e0!3m2!1sen!2sau!4v1559129788713!5m2!1sen!2sau" width="100%" height="400px" frameborder="0" style="border:0" allowfullscreen></iframe> <!-- Google Maps Embed --> <br> <div class="row"> <div id="column">1</div> <div id="column">2</div> </div> <!-- End of Footer --> </div> <!-- End of Main --> </div> <!-- End of Wrapper --> </body> </html> Attached are some images if I put position:fixed bottom:0 in the #column CSS Code. Only Column 2 goes down, 1 is hidden.
The best way to achieve this having responsiveness in mind and easier manipulation on different screen sizes is wrapping the two div elements in another div that you will position fixed on the bottom and then adjusting the two divs to take 50% of its parent. You've done half of this job by putting the divs into a .row wrapper. The best solution would probably be using flex to adjust the divs in their parent wrapper like this: Plus, you can not use the same id twice as it is in your example. <div class="row"> <div>1</div> <div>2</div> </div> <style> .row { position: fixed; bottom: 0; left: 0; right: 0; display: flex; } .row > div { flex: 1; } </style> Then on mobile devices you can just change the flex direction and the footer will become one-columned instead of two-columned. Like this: <style> #media only screen and (max-width: 768px) { .row { flex-direction: column; } } </style>
Add an id to the element you want as a footer, remove the class and use the css below to style the element. #footer { clear: both; } <div id="footer"> <div id="column">1</div> <div id="column">2</div> </div> <!-- End of Footer -->
Both 1 and 2 are fixed to the bottom. Only the float: left has no effect here and they are at the exactly same position. The 2 is in front of 1 and latter is not visible behind 2 Do this instead. <div class="row footer"> <div id="column">1</div> <div id="column">2</div> </div> .footer { position: fixed; bottom: 0; left: 0; right: 0; } /* ~ Copyright (c) Macleay Netball Association (made by Tom Carpenter for Year 11 IPT Assessment Task #2.) 2019. */ html>body { background: none; padding: 0; margin: 0; height: 100%; overflow: hidden; font-family: 'Trebuchet MS', sans-serif; /* Trebuchet MS as main font throughout website, sans-serif acting as a backup */ } #wrapper { top: 0; bottom: 0; left: 0; right: 0; overflow: hidden; position: absolute; background: #1B315E; } ::-webkit-scrollbar { display: none; } * { box-sizing: border-box; /* Alignment of DropDown Navigation Menu and Slideshow */ } .navigation { background: #444; overflow: hidden; top: 0; } .menuDropDown { overflow: hidden; float: left; } .menuDropDown>#menuButton { font-size: 12px; padding: 16px 16px; /* Will result in final height of navigation */ margin: 0; outline: none; border: none; font: inherit; background: inherit; color: #FFF; } #menuButton:hover, .navigation>.menuDropDown:hover>#menuButton { border: none; outline: none; background: #666; color: #1B315E; } .menuDropDown:hover>.menuContent { display: block; } .menuContent { display: none; position: absolute; background: none; width: 100%; left: 0; max-height: 85vh; overflow: auto; box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); z-index: 1; } .menuRow:after { display: table; clear: both; content: ""; } .menuColumn { width: 25%; height: 100px; overflow-y: auto; padding: 5px; float: left; background: #666; } .menuColumn>a { float: none; display: block; text-align: left; text-decoration: none; font-size: 14px; padding: 8px; color: #1B315E; } .menuColumn>a.current { background: #777; } .menuColumn>a:hover { background: #888; } .logo { float: right; padding-right: 10px; width: 60px; height: 50px; } .main { width: 100%; height: calc(100vh - 43px); float: left; background: none; position: absolute; overflow: auto; padding: 8px; } .mainHeader { color: #FFF; text-align: center; } .mainImg { display: block; margin-left: auto; margin-right: auto; width: 50%; } .mainBody { color: #FFF; padding: 8px; } .row:after { content: ""; clear: both; display: table; } .column { float: left; width: 33.33%; padding: 8px; } #column { float: left; width: 50%; padding: 8px; background: #888; bottom: 0; } .sponsers { float: left; width: 20%; padding: 8px; -webkit-filter: grayscale(100%); filter: grayscale(100%); } .sponsers:hover { -webkit-filter: grayscale(80%); filter: grayscale(80%); } .slideshow { /* Slideshow Container containing Images, Sliders and Captions */ position: relative; margin: auto; max-width: 1000px; } .slides { display: none; } .slideshowImages { width: 100%; } .slideButton { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); background: #888; color: #FFF; border: none; cursor: pointer; padding: 16px 32px; font-size: 18px; text-align: center; border-radius: 10px; font-weight: bold; } .mnaHeader { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); } .slideButton:hover { background: #666; } .previous, .next { cursor: pointer; position: absolute; top: 50%; width: auto; margin-top: -22px; padding: 16px; color: #FFF; font-weight: bold; font-size: 18px; transition: 0.3s ease; border-radius: 0 3px 3px 0; user-select: none; } .next { right: 0; border-radius: 3px 0 0 3px; } .previous:hover, .next:hover { background: rgba(0, 0, 0, 0.8); } table { width: 100%; font-size: 16px; color: #FFF; } .tableCaption { font-weight: bold; font-size: 18px; color: #33CC33; } table, th, td { border-collapse: collapse; border: 2px solid #888; } th, td { padding: 8px; text-align: left; } #headerTable { width: 33.33%; background: #888; font-size: 18px; color: #33CC33; } .linkProp { color: #FFF; text-decoration: underline; } .newsPanel { width: 100%; background: #888; height: 135px; } .imgNewsPreview { width: 215px; height: 135px; padding: 4px; float: left; } .newsHeaderPreview { color: #FFF; margin-top: 0px; } .newsBodyPreview { color: #FFF; margin-top: -12px; } .caption { color: #33CC33; text-align: center; position: absolute; font-size: 20px; width: 100%; padding: 8px 12px; bottom: 16px; } .collapsible { background: #888; color: #FFF; font-weight: bold; width: 100%; padding: 18px; cursor: pointer; font-size: 16px; outline: none; border: none; text-align: left; } .active, .collapsible:hover { background: #666; } .collapsible:after { content: '\002B'; color: #FFF; font-weight: bold; float: right; margin-left: 4px; } .active:after { content: '\2212'; } .contentCollapsible { padding: 0px 18px; max-height: 0; overflow: hidden; transition: max-height 0.2s ease-out; background: #F8F8F8; } .fade { -webkit-animation-name: fade; /* To work on Safari (Apple) */ -webkit-animation-duration: 1s; /* To work on Safari (Apple) */ animation-name: fade; animation-duration: 1s; } .buttonReturn { position: absolute; margin-left: 20px; margin-top: 20px; background: #888; color: #FFF; border: none; cursor: pointer; font-size: 36px; text-align: center; border-radius: 50%; font-weight: bold; } .videoProp { display: block; margin-left: auto; margin-right: auto; width: 50%; height: 400px; } .footer { position: fixed; bottom: 0; left: 0; right: 0; } #-webkit-keyframes fade { from { opacity: 0.4 } to { opacity: 1 } } #keyframes fade { from { opacity: 0.4 } to { opacity: 1 } } #media screen and (max-width: 600px) { /* Stacks navigation menu acting for the site to be responsive */ .menuColumn { width: 100%; height: auto; } } #media screen and (max-width: 800px) { /* Stacks Image Header on Top - acting as responsive */ .column, #column { width: 100%; } } #media screen and (max-width: 600px) { /* Responsive Sponser Images */ .sponsers { width: 33.33%; } } #media screen and (max-width: 800px) { /* Increases video resolution as screen reduces */ .videoProp { width: 100%; } } #media screen and (max-width: 600px) { /* Reduces font-size as screen resolution lowers */ .newsBodyPreview { font-size: 14px; } } #media screen and (max-width: 300px) { /* Reduces font-sizes within the slideshow <div> */ .previous, .next, .caption { font-size: 14px; } } <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous"> <div id="wrapper"> <div class="navigation"> <div class="menuDropDown"> <button id="menuButton" title="Navigation Menu"><i class="fas fa-bars"></i> Menu</button> <div class="menuContent"> <div class="menuRow"> <div class="menuColumn"> <a title="Home" href="../index.html"><i class="fas fa-home"></i> Home</a> <a title="Association Contacts" href="contacts.html"><i class="fas fa-address-book"></i> Association Contacts</a> </div> <div class="menuColumn"> <a title="Weekly Draw" href="weekly-draw.html"><i class="fas fa-user-friends"></i> Weekly Draw</a> <a title="News" href="#"><i class="far fa-newspaper"></i> News</a> </div> <div class="menuColumn"> <a title="Quick Links" href="links.html"><i class="fas fa-bookmark"></i> Quick Links</a> <a title="Representative Teams" href="representative-teams.html"><i class="fas fa-certificate"></i> Representative Teams</a> </div> <div class="menuColumn"> <a title="Documentation" href="documentation.html"><i class="fas fa-file"></i> Documentation</a> <a class="current" title="Contact Us" href="contact-us.html"><i class="fas fa-phone"></i> Contact Us</a> </div> </div> </div> </div> <img src="../Assets/Img/mnaHeader.png" alt="Macleay Netball Association" title="Macleay Netball Association" class="logo"> <!-- Macleay Netball Association Main Logo --> </div> <!-- End of Navigation --> <div class="main"> <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3417.0548484369647!2d152.83521681537312!3d-31.080401281517187!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6b9ddf84d6da904b%3A0xfc941d1ded8f7a25!2sPam+Guyer+Netball+Centre!5e0!3m2!1sen!2sau!4v1559129788713!5m2!1sen!2sau" width="100%" height="400px" frameborder="0" style="border:0" allowfullscreen></iframe> <!-- Google Maps Embed --> <br> <div class="row footer"> <div id="column">1</div> <div id="column">2</div> </div> <!-- End of Footer --> </div> <!-- End of Main --> </div> <!-- End of Wrapper -->
First of all id must be unique for an element, shouldn't set same id on two elements. When you set position fixed on an element it is positioned relative to viewport, not relative to flow of the page. Both of your elements have bottom: 0, which is relative to browser window, that's why your first element is covered by the second one (it's not hidden). You can group them in the same parent and position the parent, so your elements are stacked as expected. Take a look at the following code: body { min-height: 200vh; } #column { display: block; padding 15px; width: 100%; position: fixed; bottom: 0; background: #e5e5e5; } #column div { display: block; padding: 10px; width: 100%; background: #9b009b; color: #fff; margin-bottom: 10px; } <div id="column"> <div>first col</div> <div>second col</div> </div>
input not aligning with with element under it
My input isnt alignin properly with the element under it, the accordion. I want the input to align horizontally with the accordion as the textt to the left does, Tried around diffrent things, but did more harm then good. //Accordion----------------------------------------------- $(document).ready(function () { $(".accordion-desc").fadeOut(0); $(".accordion").click(function () { $(".accordion-desc").not($(this).next()).slideUp('fast'); $(this).next().slideToggle(400); }); }); $(".accordion").click(function () { $(".accordion").not(this).find(".rotate").removeClass("down"); $(this).find(".rotate").toggleClass("down"); }); //----------------------------------------------------------- body { background-color: #eee; font-family: "Open Sans", sans-serif; } header { background-color: #2cc185; color: #fff; padding: 2em 1em; margin-bottom: 1.5em; } h1 { font-weight: 300; text-align: center; } .container { position: relative; margin: 0 auto; } button { background-color: #2cc185; color: #fff; border: 0; padding: 1em 1.5em; } button:hover { background-color: #239768; color: #fff; } button:focus { background-color: #239768; color: #fff; } .accordion { position: relative; background-color: #fff; display: inline-block; width: 100%; border-top: 1px solid #f1f4f3; border-bottom: 1px solid #f1f4f3; font-weight: 700; color: #74777b; vertical-align: middle; } /*Rotation-------------------------------------*/ .accordion .fa { position: relative; float: right; } .rotate { -moz-transition: all 0.3s linear; -webkit-transition: all 0.3s linear; transition: all 0.3s linear; } .rotate.down { -moz-transform: rotate(90deg); -webkit-transform: rotate(90deg); transform: rotate(90deg); } /*------------------------------------------*/ .link { text-align: right; margin-bottom: 20px; margin-right: 30px; } .accordion h4 { position: relative; /* top: 0.8em; */ margin: 0; font-size: 14px; font-weight: 700; float: left; } .accordion a { position: relative; display: block; color: #74777b; padding: 1em 1em 2.5em 1em; text-decoration: none; } .accordion a:hover { text-decoration: none; color: #2cc185; background-color: #e7ecea; transition: 0.3s; } .accordion-desc { background-color: #f1f4f3; color: #74777b; z-index: 2; padding: 20px 15px; } #media (min-width:480px) { .container { max-width: 80%; } } #media (min-width:768px) { .container { max-width: 1000px; } } .accordion-desc p { word-break: break-all; } .accordion .status { position: relative; float: right; right: 20%; vertical-align: middle; } .btn { margin-top: 10px; } .heading { margin: 10px; vertical-align: middle; display: inline-block; position: relative; width: 100%; } .heading h2 { float: left; position: relative; margin:auto; vertical-align: middle; } .heading .searcheBar { float: right; position: relative; margin: auto; vertical-align: middle; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> <div class="container"> <div class ="heading"> <h2>All projekt</h2> <input class="searcheBar form-control" type="text"/> </div> <div class="accordion"> <a href="#"> <h4>#item.Title</h4> <h4 class="status">#Resource.AccordionStatus</h4> <i class="fa fa-chevron-right rotate"></i> </a> </div> <div class="accordion-desc"> <h3>#Resource.AccordionProjectLead</h3> <h4>Kay Wiberg</h4> <h3>#Resource.AccordionDescription</h3> <p> #item.Description <p> <div class="link"> #Resource.AccordionGoTo </div> </div>
Change : .heading { margin:10px; //more code... } To: .heading { margin:10px 0px 10px 0px; //More code... } body { background-color: #eee; font-family: "Open Sans", sans-serif; } header { background-color: #2cc185; color: #fff; padding: 2em 1em; margin-bottom: 1.5em; } h1 { font-weight: 300; text-align: center; } .container { position: relative; margin: 0 auto; } button { background-color: #2cc185; color: #fff; border: 0; padding: 1em 1.5em; } button:hover { background-color: #239768; color: #fff; } button:focus { background-color: #239768; color: #fff; } .accordion { position: relative; background-color: #fff; display: inline-block; width: 100%; border-top: 1px solid #f1f4f3; border-bottom: 1px solid #f1f4f3; font-weight: 700; color: #74777b; vertical-align: middle; } /*Rotation-------------------------------------*/ .accordion .fa { position: relative; float: right; } .rotate { -moz-transition: all 0.3s linear; -webkit-transition: all 0.3s linear; transition: all 0.3s linear; } .rotate.down { -moz-transform: rotate(90deg); -webkit-transform: rotate(90deg); transform: rotate(90deg); } /*------------------------------------------*/ .link { text-align: right; margin-bottom: 20px; margin-right: 30px; } .accordion h4 { position: relative; /* top: 0.8em; */ margin: 0; font-size: 14px; font-weight: 700; float: left; } .accordion a { position: relative; display: block; color: #74777b; padding: 1em 1em 2.5em 1em; text-decoration: none; } .accordion a:hover { text-decoration: none; color: #2cc185; background-color: #e7ecea; transition: 0.3s; } .accordion-desc { background-color: #f1f4f3; color: #74777b; z-index: 2; padding: 20px 15px; } #media (min-width:480px) { .container { max-width: 80%; } } #media (min-width:768px) { .container { max-width: 1000px; } } .accordion-desc p { word-break: break-all; } .accordion .status { position: relative; float: right; right: 20%; vertical-align: middle; } .btn { margin-top: 10px; } .heading { margin:10px 0px 10px 0px; vertical-align: middle; display: inline-block; position: relative; width: 100%; } .heading h2 { float: left; position: relative; margin:auto; vertical-align: middle; } .heading .searcheBar { float: right; position: relative; margin: auto; vertical-align: middle; } <div class="container"> <div class ="heading"> <h2>All projekt</h2> <input class="searcheBar form-control" type="text"/> </div> <div class="accordion"> <a href="#"> <h4>#item.Title</h4> <h4 class="status">#Resource.AccordionStatus</h4> <i class="fa fa-chevron-right rotate"></i> </a> </div> <div class="accordion-desc"> <h3>#Resource.AccordionProjectLead</h3> <h4>Kay Wiberg</h4> <h3>#Resource.AccordionDescription</h3> <p>#item.Description</p> <div class="link"> #Resource.AccordionGoTo </div> </div>
Option #1 Adjusting margin: .heading {margin: 10px auto;} //Accordion----------------------------------------------- $(document).ready(function() { $(".accordion-desc").fadeOut(0); $(".accordion").click(function() { $(".accordion-desc").not($(this).next()).slideUp('fast'); $(this).next().slideToggle(400); }); }); $(".accordion").click(function() { $(".accordion").not(this).find(".rotate").removeClass("down"); $(this).find(".rotate").toggleClass("down"); }); //----------------------------------------------------------- body { background-color: #eee; font-family: "Open Sans", sans-serif; } header { background-color: #2cc185; color: #fff; padding: 2em 1em; margin-bottom: 1.5em; } h1 { font-weight: 300; text-align: center; } .container { position: relative; margin: 0 auto; } button { background-color: #2cc185; color: #fff; border: 0; padding: 1em 1.5em; } button:hover { background-color: #239768; color: #fff; } button:focus { background-color: #239768; color: #fff; } .accordion { position: relative; background-color: #fff; display: inline-block; width: 100%; border-top: 1px solid #f1f4f3; border-bottom: 1px solid #f1f4f3; font-weight: 700; color: #74777b; vertical-align: middle; } /*Rotation-------------------------------------*/ .accordion .fa { position: relative; float: right; } .rotate { -moz-transition: all 0.3s linear; -webkit-transition: all 0.3s linear; transition: all 0.3s linear; } .rotate.down { -moz-transform: rotate(90deg); -webkit-transform: rotate(90deg); transform: rotate(90deg); } /*------------------------------------------*/ .link { text-align: right; margin-bottom: 20px; margin-right: 30px; } .accordion h4 { position: relative; /* top: 0.8em; */ margin: 0; font-size: 14px; font-weight: 700; float: left; } .accordion a { position: relative; display: block; color: #74777b; padding: 1em 1em 2.5em 1em; text-decoration: none; } .accordion a:hover { text-decoration: none; color: #2cc185; background-color: #e7ecea; transition: 0.3s; } .accordion-desc { background-color: #f1f4f3; color: #74777b; z-index: 2; padding: 20px 15px; } #media (min-width:480px) { .container { max-width: 80%; } } #media (min-width:768px) { .container { max-width: 1000px; } } .accordion-desc p { word-break: break-all; } .accordion .status { position: relative; float: right; right: 20%; vertical-align: middle; } .btn { margin-top: 10px; } .heading { margin: 10px auto; vertical-align: middle; display: inline-block; position: relative; width: 100%; } .heading h2 { float: left; position: relative; margin: auto; vertical-align: middle; } .heading .searcheBar { float: right; position: relative; margin: auto; vertical-align: middle; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> <h1>Adjusting Margin</h1> <div class="container"> <div class="heading"> <h2>All projekt</h2> <input class="searcheBar form-control" type="text" /> </div> <div class="accordion"> <a href="#"> <h4>#item.Title</h4> <h4 class="status">#Resource.AccordionStatus</h4> <i class="fa fa-chevron-right rotate"></i> </a> </div> <div class="accordion-desc"> <h3>#Resource.AccordionProjectLead</h3> <h4>Kay Wiberg</h4> <h3>#Resource.AccordionDescription</h3> <p> #item.Description <p> <div class="link"> #Resource.AccordionGoTo </div> </div> Option #2 Deferring to padding: .heading {padding: 10px; box-sizing: border-box;} //Accordion----------------------------------------------- $(document).ready(function() { $(".accordion-desc").fadeOut(0); $(".accordion").click(function() { $(".accordion-desc").not($(this).next()).slideUp('fast'); $(this).next().slideToggle(400); }); }); $(".accordion").click(function() { $(".accordion").not(this).find(".rotate").removeClass("down"); $(this).find(".rotate").toggleClass("down"); }); //----------------------------------------------------------- body { background-color: #eee; font-family: "Open Sans", sans-serif; } header { background-color: #2cc185; color: #fff; padding: 2em 1em; margin-bottom: 1.5em; } h1 { font-weight: 300; text-align: center; } .container { position: relative; margin: 0 auto; } button { background-color: #2cc185; color: #fff; border: 0; padding: 1em 1.5em; } button:hover { background-color: #239768; color: #fff; } button:focus { background-color: #239768; color: #fff; } .accordion { position: relative; background-color: #fff; display: inline-block; width: 100%; border-top: 1px solid #f1f4f3; border-bottom: 1px solid #f1f4f3; font-weight: 700; color: #74777b; vertical-align: middle; } /*Rotation-------------------------------------*/ .accordion .fa { position: relative; float: right; } .rotate { -moz-transition: all 0.3s linear; -webkit-transition: all 0.3s linear; transition: all 0.3s linear; } .rotate.down { -moz-transform: rotate(90deg); -webkit-transform: rotate(90deg); transform: rotate(90deg); } /*------------------------------------------*/ .link { text-align: right; margin-bottom: 20px; margin-right: 30px; } .accordion h4 { position: relative; /* top: 0.8em; */ margin: 0; font-size: 14px; font-weight: 700; float: left; } .accordion a { position: relative; display: block; color: #74777b; padding: 1em 1em 2.5em 1em; text-decoration: none; } .accordion a:hover { text-decoration: none; color: #2cc185; background-color: #e7ecea; transition: 0.3s; } .accordion-desc { background-color: #f1f4f3; color: #74777b; z-index: 2; padding: 20px 15px; } #media (min-width:480px) { .container { max-width: 80%; } } #media (min-width:768px) { .container { max-width: 1000px; } } .accordion-desc p { word-break: break-all; } .accordion .status { position: relative; float: right; right: 20%; vertical-align: middle; } .btn { margin-top: 10px; } .heading { padding: 10px; box-sizing: border-box; vertical-align: middle; display: inline-block; position: relative; width: 100%; } .heading h2 { float: left; position: relative; margin: auto; vertical-align: middle; } .heading .searcheBar { float: right; position: relative; margin: auto; vertical-align: middle; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> <h1>Deferring to Padding</h1> <div class="container"> <div class="heading"> <h2>All projekt</h2> <input class="searcheBar form-control" type="text" /> </div> <div class="accordion"> <a href="#"> <h4>#item.Title</h4> <h4 class="status">#Resource.AccordionStatus</h4> <i class="fa fa-chevron-right rotate"></i> </a> </div> <div class="accordion-desc"> <h3>#Resource.AccordionProjectLead</h3> <h4>Kay Wiberg</h4> <h3>#Resource.AccordionDescription</h3> <p> #item.Description <p> <div class="link"> #Resource.AccordionGoTo </div> </div>