profile icon dropdown tolltip with arrow - css

This has been really frustrating. I'm trying to add a dropdown tooltip at the bottom of my profile avatar. Unfortunately that does not seem to work properly. The tooltip seems to be partly hidden. How can i keep the specific design of the tooltip and make it display directly at the bottom of the icon with the arrow pointing in the middle of the icon?
body {
background-color: #36a4b0;
}
#shell-header {
display: flex;
height: 46px;
overflow: hidden;
z-index: 3;
opacity: 1;
white-space: nowrap;
}
.logo-wrapper {
padding-left: 56px;
}
#media (max-width: 480px) {
.logo-wrapper {
padding-left: 1rem;
}
}
.title-wrapper {
left: 0;
right: 0;
text-align: right;
flex-grow: 1;
}
.avatar-wrapper {
padding-right: 56px;
position: relative;
}
#media (max-width: 480px) {
.avatar-wrapper {
padding-right: 1rem;
}
}
.logo {
height: 30px;
line-height: 40px;
max-width: 96px;
margin-top: 0.35rem;
}
.log-shellHeaderTitle {
font-size: 20px;
line-height: 36px;
color: #fff;
text-overflow: ellipsis;
text-align: center;
display: block;
white-space: nowrap;
overflow: hidden;
font-weight: inherit;
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.log-langButton {
padding-right: 40px;
}
#media only screen and (max-width: 480px) {
.log-langButton {
padding-right: 10px;
}
}
#log-LangButtSwitch {
background: transparent;
cursor: pointer;
display: block;
position: relative;
float: left;
width: 40px;
padding: 2px;
margin-top: 0.25rem;
border: 2px solid #fff;
border-radius: 28px;
}
.log-switchHandle {
display: block;
background: #fff;
height: 20px;
width: 20px;
z-index: 9999;
border-radius: 20px;
}
.log-switchLabels {
position: absolute;
top: 5px;
z-index: -1;
width: 100%;
font-family: Helvetica, sans-serif;
font-weight: bold;
color: #fff;
text-transform: uppercase;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.log-switchLabels:before {
content: "EN";
position: absolute;
left: 21px;
font-size: 12px;
}
.log-switchLabels:after {
content: "DE";
position: absolute;
right: 26px;
font-size: 12px;
}
.fa-user-o:before {
font-size: 1.375rem;
color: #fff;
}
.avatar {
text-align: center;
margin-top: 0.35rem;
width: 25px;
}
.log-popover {
visibility: visible;
z-index: 460;
display: block;
overflow: visible;
top: 121px;
left: 375.063px;
bottom: 10px;
transition: opacity 0.2s linear;
color: #333333;
min-width: 100px;
box-sizing: border-box;
outline: none;
max-width: 100%;
max-height: 84px;
min-height: 2rem;
overflow: hidden;
background: #ffffff;
border: none;
box-shadow: 0 0.625rem 1.875rem 0 rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
}
.log-popover a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.log-popover a:hover {
background-color: #f0f0f0;
}
.log-popover a:active,
.log-popover a:focus {
background: #e8eff6;
outline: 1px dotted #000000;
outline-offset: -2px;
}
.log-popover:after,
.log-popover:before {
bottom: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.log-popover:after {
border-color: rgba(255, 255, 255, 0);
border-bottom-color: #fff;
border-width: 10px;
margin-left: -10px;
}
.log-popover:before {
border-color: rgba(51, 51, 51, 0);
border-bottom-color: #333333;
border-width: 11px;
margin-left: -11px;
}
.log-toolContainer {
position: absolute;
height: 100%;
width: 100%;
}
<div class="log-container">
<div id="shell-header">
<div class="logo-wrapper">
<img src="https://s-media-cache-ak0.pinimg.com/236x/f7/0a/f6/f70af6169bbe3f8346e64a25d54bafea.jpg" class="logo">
</div>
<div class="title-wrapper">
<div class="log-shellHeaderTitle">Dashboard</div>
</div>
<div class="log-langButton">
<div id="log-LangButtSwitch">
<span class="log-switchHandle"></span>
<span class="log-switchLabels"></span>
</div>
</div>
<div class="avatar-wrapper">
<img class="avatar" src="https://www.talentenportaalhellendoorn.nl/thumbnails/man.png">
<div class="log-toolContainer">
<div class="log-popover">
Profile
Log out
</div>
</div>
</div>
</div>
</div>

remove overflow: hidden; from #shell-header so the menu isn't cut off, then use positioning to put the container for the menu in the bottom/left of the parent, and use translateX() to offset it 50% of it's own width + 50% of the avatar width to center it under the icon.
body {
background-color: #36a4b0;
}
#shell-header {
display: flex;
height: 46px;
z-index: 3;
opacity: 1;
white-space: nowrap;
}
.logo-wrapper {
padding-left: 56px;
}
#media (max-width: 480px) {
.logo-wrapper {
padding-left: 1rem;
}
}
.title-wrapper {
left: 0;
right: 0;
text-align: right;
flex-grow: 1;
}
.avatar-wrapper {
padding-right: 56px;
position: relative;
}
#media (max-width: 480px) {
.avatar-wrapper {
padding-right: 1rem;
}
}
.logo {
height: 30px;
line-height: 40px;
max-width: 96px;
margin-top: 0.35rem;
}
.log-shellHeaderTitle {
font-size: 20px;
line-height: 36px;
color: #fff;
text-overflow: ellipsis;
text-align: center;
display: block;
white-space: nowrap;
overflow: hidden;
font-weight: inherit;
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.log-langButton {
padding-right: 40px;
}
#media only screen and (max-width: 480px) {
.log-langButton {
padding-right: 10px;
}
}
#log-LangButtSwitch {
background: transparent;
cursor: pointer;
display: block;
position: relative;
float: left;
width: 40px;
padding: 2px;
margin-top: 0.25rem;
border: 2px solid #fff;
border-radius: 28px;
}
.log-switchHandle {
display: block;
background: #fff;
height: 20px;
width: 20px;
z-index: 9999;
border-radius: 20px;
}
.log-switchLabels {
position: absolute;
top: 5px;
z-index: -1;
width: 100%;
font-family: Helvetica, sans-serif;
font-weight: bold;
color: #fff;
text-transform: uppercase;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.log-switchLabels:before {
content: "EN";
position: absolute;
left: 21px;
font-size: 12px;
}
.log-switchLabels:after {
content: "DE";
position: absolute;
right: 26px;
font-size: 12px;
}
.fa-user-o:before {
font-size: 1.375rem;
color: #fff;
}
.avatar {
text-align: center;
margin-top: 0.35rem;
width: 25px;
}
.log-popover {
visibility: visible;
z-index: 460;
display: block;
overflow: visible;
top: 121px;
left: 375.063px;
bottom: 10px;
transition: opacity 0.2s linear;
color: #333333;
min-width: 100px;
box-sizing: border-box;
outline: none;
max-width: 100%;
max-height: 84px;
min-height: 2rem;
overflow: hidden;
background: #ffffff;
border: none;
box-shadow: 0 0.625rem 1.875rem 0 rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
}
.log-popover a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.log-popover a:hover {
background-color: #f0f0f0;
}
.log-popover a:active,
.log-popover a:focus {
background: #e8eff6;
outline: 1px dotted #000000;
outline-offset: -2px;
}
.log-popover:after,
.log-popover:before {
bottom: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.log-popover:after {
border-color: rgba(255, 255, 255, 0);
border-bottom-color: #fff;
border-width: 10px;
margin-left: -10px;
}
.log-popover:before {
border-color: rgba(51, 51, 51, 0);
border-bottom-color: #333333;
border-width: 11px;
margin-left: -11px;
}
.log-toolContainer {
position: absolute;
height: 100%;
width: 100%;
top: 100%;
left: 0;
transform: translateX(calc(-50% + 12.5px));
}
<div class="log-container">
<div id="shell-header">
<div class="logo-wrapper">
<img src="https://s-media-cache-ak0.pinimg.com/236x/f7/0a/f6/f70af6169bbe3f8346e64a25d54bafea.jpg" class="logo">
</div>
<div class="title-wrapper">
<div class="log-shellHeaderTitle">Dashboard</div>
</div>
<div class="log-langButton">
<div id="log-LangButtSwitch">
<span class="log-switchHandle"></span>
<span class="log-switchLabels"></span>
</div>
</div>
<div class="avatar-wrapper">
<img class="avatar" src="https://www.talentenportaalhellendoorn.nl/thumbnails/man.png">
<div class="log-toolContainer">
<div class="log-popover">
Profile
Log out
</div>
</div>
</div>
</div>
</div>

Remove overflow hidden from #shell-header...
body {
background-color: #36a4b0;
}
#shell-header {
display: flex;
height: 46px;
overflow: visible;
z-index: 3;
opacity: 1;
white-space: nowrap;
}
.logo-wrapper {
padding-left: 56px;
}
#media (max-width: 480px) {
.logo-wrapper {
padding-left: 1rem;
}
}
.title-wrapper {
left: 0;
right: 0;
text-align: right;
flex-grow: 1;
}
.avatar-wrapper {
padding-right: 56px;
position: relative;
}
#media (max-width: 480px) {
.avatar-wrapper {
padding-right: 1rem;
}
}
.logo {
height: 30px;
line-height: 40px;
max-width: 96px;
margin-top: 0.35rem;
}
.log-shellHeaderTitle {
font-size: 20px;
line-height: 36px;
color: #fff;
text-overflow: ellipsis;
text-align: center;
display: block;
white-space: nowrap;
overflow: hidden;
font-weight: inherit;
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.log-langButton {
padding-right: 40px;
}
#media only screen and (max-width: 480px) {
.log-langButton {
padding-right: 10px;
}
}
#log-LangButtSwitch {
background: transparent;
cursor: pointer;
display: block;
position: relative;
float: left;
width: 40px;
padding: 2px;
margin-top: 0.25rem;
border: 2px solid #fff;
border-radius: 28px;
}
.log-switchHandle {
display: block;
background: #fff;
height: 20px;
width: 20px;
z-index: 9999;
border-radius: 20px;
}
.log-switchLabels {
position: absolute;
top: 5px;
z-index: -1;
width: 100%;
font-family: Helvetica, sans-serif;
font-weight: bold;
color: #fff;
text-transform: uppercase;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.log-switchLabels:before {
content: "EN";
position: absolute;
left: 21px;
font-size: 12px;
}
.log-switchLabels:after {
content: "DE";
position: absolute;
right: 26px;
font-size: 12px;
}
.fa-user-o:before {
font-size: 1.375rem;
color: #fff;
}
.avatar {
text-align: center;
margin-top: 0.35rem;
width: 25px;
}
.log-popover {
visibility: visible;
z-index: 460;
display: block;
overflow: visible;
top: 121px;
left: 375.063px;
bottom: 10px;
transition: opacity 0.2s linear;
color: #333333;
min-width: 100px;
box-sizing: border-box;
outline: none;
max-width: 100%;
max-height: 84px;
min-height: 2rem;
overflow: hidden;
background: #ffffff;
border: none;
box-shadow: 0 0.625rem 1.875rem 0 rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
}
.log-popover a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.log-popover a:hover {
background-color: #f0f0f0;
}
.log-popover a:active,
.log-popover a:focus {
background: #e8eff6;
outline: 1px dotted #000000;
outline-offset: -2px;
}
.log-popover:after,
.log-popover:before {
bottom: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.log-popover:after {
border-color: rgba(255, 255, 255, 0);
border-bottom-color: #fff;
border-width: 10px;
margin-left: -10px;
}
.log-popover:before {
border-color: rgba(51, 51, 51, 0);
border-bottom-color: #333333;
border-width: 11px;
margin-left: -11px;
}
.log-toolContainer {
position: absolute;
height: 100%;
width: 100%;
}
<div class="log-container">
<div id="shell-header">
<div class="logo-wrapper">
<img src="https://s-media-cache-ak0.pinimg.com/236x/f7/0a/f6/f70af6169bbe3f8346e64a25d54bafea.jpg" class="logo">
</div>
<div class="title-wrapper">
<div class="log-shellHeaderTitle">Dashboard</div>
</div>
<div class="log-langButton">
<div id="log-LangButtSwitch">
<span class="log-switchHandle"></span>
<span class="log-switchLabels"></span>
</div>
</div>
<div class="avatar-wrapper">
<img class="avatar" src="https://www.talentenportaalhellendoorn.nl/thumbnails/man.png">
<div class="log-toolContainer">
<div class="log-popover">
Profile
Log out
</div>
</div>
</div>
</div>
</div>

Related

Overflowing text even though I assign width to <div> [duplicate]

This question already has answers here:
Break long word with CSS
(6 answers)
Closed last year.
In the example code - I have given box 3 and box 4 widths of 200px I don't actually care for using these widths, but I have given them colours so you can see my problem better visually.
The problem is my text is not being contained by the parent <div> with a set (hardcoded) pixel width in box 3 especially it runs waaay out to the right in 1 line instead of wrapping inside the <div>. For box 4, I can understand it's trying to stretch to the end, but if it were any longer it would again just run outside of the grid anyways. So theres something I'm missing to help wrap content. How do I solve this problem?
* {
margin:0;
padding:0;
}
html {
box-sizing: border-box;
font-size: 30px;
font-family: 'Bitter', serif;
}
body{
background: rgb(7, 7, 7);
color: #fff;
}
.imgContainer{
width: 100%;
height: fit-content;
background-color: black;
pointer-events: none;
user-select: none;
}
.mySlides {
opacity: 0.5;
overflow: hidden;
background-position: center;
width: 100%;
height: 650px;
max-height: 75vh;
pointer-events: none;
user-select: none;
}
.bodyC {
padding-top: 75px;
max-width: 360px;
font-weight: 200;
font-size: 0.8rem;
}
.bodyC2 {
padding-left: 180px;
padding-top: 250px;
max-width: 450px;
font-weight: 200;
font-size: 0.8rem;
}
.bodyContainer {
display: flex;
width: 100%;
padding-right: 80px;
padding-bottom: 80px;
justify-content: center;
min-height: 50vh;
}
h3 {
font-size: 36px;
margin-bottom:10px;
font-weight: 700;
}
h4 {
text-transform: uppercase;
font-weight: 700;
font-size: 27px;
margin-bottom:10px;
}
.logobutton {
padding-right: 45px;
user-select: none;
}
.homenugget{
height:70px;
width:50px;
position:fixed;
top: 5px;
left: 32px;
opacity:0;
user-select: none;
}
.smallu {
height: 50px;
width:50px;
user-select: none;
}
.container {
margin: 0 auto;
display:flex;
align-items: center;
justify-content: space-between;
}
nav {
position:relative;
top: 0;
left: 0;
right: 0;
z-index: 99;
background-color: #212121;
padding: 16px 32px;
border-bottom: 3px solid rgb(37, 164, 173);
}
h1 {
color: #ffffff ;
font-size: 28px;
font-weight: 900;
letter-spacing: 1px;
text-transform: uppercase;
}
.hamburger {
display: block;
position: relative;
z-index: 1;
user-select: none;
appearance: none;
border: none;
outline: none;
background: none;
cursor: pointer;
}
.hamburger span {
display: block;
width: 33px;
height: 4px;
margin-bottom: 5px;
position: relative;
background-color: #eeeeee;
border-radius: 6px;
z-index: 1;
transform-origin: 0 0;
transition: 0.4s;
}
.hamburger:hover span:nth-child(2) {
transform: translateX(10px);
background-color: rgb(37, 164, 173);
}
.hamburger.is-active span:nth-child(1) {
transform: translate(0px, -2px) rotate(45deg);
background-color: rgb(37, 164, 173);
}
.hamburger.is-active span:nth-child(2) {
opacity: 0;
transform: translateX(15px);
}
.hamburger.is-active span:nth-child(3) {
transform: translate(-3px, 3px) rotate(-45deg);
background-color:rgb(37, 164, 173);
}
.hamburger.is-active:hover span {
background-color: rgb(75, 243, 255);
filter: blur(0.5px);
box-shadow: 1px -1px rgb(75, 243, 255);
}
.menu {
display:none;
flex: 1 1 0%;
justify-content: center;
margin: 0 -16;
letter-spacing: 2px;
}
.menu a{
color: ivory;
margin: 0 16;
font-weight: 700;
text-decoration: none;
transition: 0.4s;
padding: 5px 16px;
border-radius: 50px;
}
.menu a.is-active, .menu a:hover{
background-color: rgba(88, 223, 233, 0.295);
color: rgb(75, 243, 255);
}
.dropdown {
position: relative;
}
.dropdownMenu {
position: absolute;
width: 300px;
z-index: 100;
right: -60px;
top: calc(100% + 32px);
border-top: 1px solid rgb(75, 243, 255);
border-bottom: 3px solid rgb(75, 243, 255);
border-left: 3px solid rgb(55, 225, 240);
background-color: #212121;
border-radius: 0 0 15px 15px;
opacity: 0;
}
.link{
display: block;
text-align: left;
margin: 10px;
font-size: 30px;
color: ivory;
text-decoration: none;
opacity: 1;
}
.dropdownMenu a:hover {
background-color: rgba(88, 223, 233, 0.295);
border-radius: 5px;
color: rgb(75, 243, 255);
text-decoration: none;
opacity: 1;
}
.wth{
padding-bottom: 1000px;
}
.footer {
position: relative;
width: 100%;
bottom: 0 ;
text-align: left;
background-color: #212121;
padding:50px 0 50px 0;
}
.footer-container {
margin-left: 1em;
}
.footer h5 {
color: #fff;
}
.footer h5 {
margin-bottom: 20px;
}
.footer p {
color: rgba(255, 255, 255, 0.25);
font-size:16px;
line-height:22px;
}
.hearted {
color:red;
font-size: 12px;
}
.opacityStyle{
opacity: 1;
}
.subscribe {
width: 100%;
background-color: rgb(92, 89, 89);
background-image: url('../images/backgrounds/parallax-bg.jpg');
background-attachment: fixed;
background-repeat: no-repeat;
background-position: 50% 0;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
position: relative;
}
.subscribe >.sub-container {
padding-top: 80px;
padding-bottom: 80px;
}
.subscribe-title h2 {
font-weight: 600;
font-size: 23px;
color: #fff;
letter-spacing:3px;
margin:0 3%;
line-height:70px;
text-transform:uppercase;
}
.subscribe-form {
margin-top: 6px;
}
.subscribe-form input[type=text] {
width: 65%;
height: 60px;
display: block;
padding: 0 20px;
background-color: #fff;
border: 1px solid #fff;
border-radius: 10px;
-webkit-border-top-left-radius: 10px;
-webkit-border-bottom-left-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-bottomleft: 10px;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
line-height: 60px;
letter-spacing:1px;
font-size:15px;
font-weight:300;
float: left;
}
.subscribe-form input:focus {
outline: 0;
}
.subscribe-form input[type=submit] {
width: 35%;
height: 62px;
display: flex;
position: absolute;
right: 5px;
justify-content: center;
background-color: rgb(35, 142, 151);
border: 1px solid rgb(35, 142, 151);
color: #fff;
-webkit-border-top-right-radius: 10px;
-webkit-border-bottom-right-radius: 10px;
-moz-border-radius-topright: 10px;
-moz-border-radius-bottomright: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
font-weight: 700;
font-size: 33px;
transition: all 0.125s ease-in-out 0s;
-moz-transition: all 0.125s ease-in-out 0s;
-webkit-transition: all 0.125s ease-in-out 0s;
-o-transition: all 0.125s ease-in-out 0s;
-ms-transition: all 0.125s ease-in-out 0s;
}
.subscribe-form input[type=submit]:hover {
background-color: rgb(23, 90, 95);
border: 1px solid rgb(23, 90, 95);
color:rgb(75, 243, 255);
}
.error_message {
color:#fc6e51;
padding-bottom:15px;
font-size:13px;
line-height:30px;
}
#success_page {
color:#9ce726;
padding-bottom:10px;
font-size:12px;
}
#success_page h3 {
font-size:17px;
font-weight:400px;
color:#4ab217;
}
#success_page p {
font-size:12px;
font-weight:400px;
color:#b3b3b3;
}
.box1 {
grid-column: 1/4;
text-align: center;
background: chartreuse;
}
.box2 {
grid-column: 1 / 2;
grid-row: 2/2;
width:300px;
height: 300px;
background:blueviolet
}
.box3 {
width: 200px;
grid-column: 2/3 ;
grid-row:2/3;
background: blue;
}
.box4 {
width: 200px;
grid-column: 1/4;
grid-row:4/4;
background: #fc6e51;
}
.wrapper{
display: grid;
grid-template-columns: repeat(3, auto);
grid-template-rows: repeat(1, 1fr);
gap:10px;
max-height: 55vh;
background: #212121;
}
.megawrap{
display: grid;
grid-auto-flow: column;
height: 350px;
width: 200px;
gap: 20px;
}
#media (min-width: 1080px){
.bodyC2{
max-width: 360px;
padding-left: 150px;
}
.bodyC2{
flex-direction: column;
padding-top: 200px;
padding:50px;
padding-left: 200px;
margin-left: 100px;
}
.bodyC {
padding:50px;
margin-left: 25px;
}
}
#media (max-width: 1175px){
.bodyC2{
max-width: 360px;
padding-left: 75px;
}
.bodyC2{
flex-direction: column;
padding-top: 200px;
padding:50px;
padding-left: 0px;
margin-left: 50px;
}
.bodyC {
padding:50px;
margin-left: 25px;
}
}
#media (max-width: 1400px){
.bodyC2{
max-width: 360px;
padding-left: 75px;
}
.bodyC2{
flex-direction: column;
padding-top: 200px;
padding:50px;
padding-left: 0px;
margin-left: 100px;
}
.bodyC {
padding:50px;
margin-left: 25px;
}
}
#media (min-width: 975px) {
.hamburger{
display: none;
}
.dropdown {
display: none;
}
.menu{
display:flex;
}
.bodyContainer{
flex-direction: row;
}
.bodyC2{
flex-direction: column;
padding-top: 100px;
}
}
#media (max-width: 975px){
.bodyContainer{
flex-direction: column;
}
.bodyC2{
flex-direction: column;
padding-top: 50px;
font-size: .8em;
margin-left: 150px;
}
.bodyC {
font-size: .8em;
margin-left: 50px;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>III</title>
<link rel="stylesheet" href="main.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Dosis:wght#200;300;400;500;600;700;800&family=Roboto+Mono:ital,wght#0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,200;1,300;1,400;1,500;1,600;1,700&family=Rock+3D&display=swap" rel="stylesheet">
</head>
<body>
<nav>
<div class="container">
<div class="logobutton">
<img class="smallu" src="images/ulogo-white.jpg">
<a class="homenugget" href="home.html"></a>
</div>
<h1>Ideas Imprint</h1>
<div class="menu">
Events
About
Login
Dashboard
</div>
<div class="dropdown">
<button class="hamburger">
<span> </span>
<span></span>
<span></span>
</button>
<div class="dropdownMenu">
Events
About
Login
Dashboard
</div>
</div>
</div>
< /nav>
<div class="megawrap">
<div class="wrapper">
<div class="box1">Hello I'm a Head</div>
<img class="box2" src="images/7.jpg" alt="">
<div class= "box3">
box3box3box3box3box3box3box3box3box3box3box3box3
</div>
<div class= "box4">
box4box4box4box4box4box4box4box4box4box4box4
</div>
</div>
<div class="wrapper">
<div class="box1">Hello I'm a Head</div>
<img class="box2" src="images/7.jpg" alt="">
<div class= "box3">
box3box3box3box3box3box3box3box3box3box3box3
</div>
<div class= "box4">
box4box4box4box4box4box4box4box
</div>
</div>
<div class="wrapper">
<div class="box1">Hello I'm a Head</div>
<img class="box2" src="images/7.jpg" alt="">
<div class= "box3">
box3box3box3box3box3box3box3box3box3box3box3box3
</div>
<div class= "box4">
box4box4box4box4box4box4box4box4box
</div>
</div>
</div>
<div class="wth"></div>
<!-- Footer section -->
<footer class="footer">
<div class="footer-container">
<div class="footer-row">
<div class="Footer-text-left">
<p>Copyright © 2022 Ideas Imprint Inc. All Rights Reserved.</p>
<p> Made with <span class="hearted"> ❤</span></p>
</div>
</div>
</div>
<!-- footer top -->
</footer>
<!-- Footer section -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="main.js"></script>
</body>
</html>
Make use of word-wrap property. Add word-wrap: break-word; on your .box3 and .box4 classes. More on it here.
* {
margin: 0;
padding: 0;
}
html {
box-sizing: border-box;
font-size: 30px;
font-family: 'Bitter', serif;
}
body {
background: rgb(7, 7, 7);
color: #fff;
}
.imgContainer {
width: 100%;
height: fit-content;
background-color: black;
pointer-events: none;
user-select: none;
}
.mySlides {
opacity: 0.5;
overflow: hidden;
background-position: center;
width: 100%;
height: 650px;
max-height: 75vh;
pointer-events: none;
user-select: none;
}
.bodyC {
padding-top: 75px;
max-width: 360px;
font-weight: 200;
font-size: 0.8rem;
}
.bodyC2 {
padding-left: 180px;
padding-top: 250px;
max-width: 450px;
font-weight: 200;
font-size: 0.8rem;
}
.bodyContainer {
display: flex;
width: 100%;
padding-right: 80px;
padding-bottom: 80px;
justify-content: center;
min-height: 50vh;
}
h3 {
font-size: 36px;
margin-bottom: 10px;
font-weight: 700;
}
h4 {
text-transform: uppercase;
font-weight: 700;
font-size: 27px;
margin-bottom: 10px;
}
.logobutton {
padding-right: 45px;
user-select: none;
}
.homenugget {
height: 70px;
width: 50px;
position: fixed;
top: 5px;
left: 32px;
opacity: 0;
user-select: none;
}
.smallu {
height: 50px;
width: 50px;
user-select: none;
}
.container {
margin: 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
}
nav {
position: relative;
top: 0;
left: 0;
right: 0;
z-index: 99;
background-color: #212121;
padding: 16px 32px;
border-bottom: 3px solid rgb(37, 164, 173);
}
h1 {
color: #ffffff;
font-size: 28px;
font-weight: 900;
letter-spacing: 1px;
text-transform: uppercase;
}
.hamburger {
display: block;
position: relative;
z-index: 1;
user-select: none;
appearance: none;
border: none;
outline: none;
background: none;
cursor: pointer;
}
.hamburger span {
display: block;
width: 33px;
height: 4px;
margin-bottom: 5px;
position: relative;
background-color: #eeeeee;
border-radius: 6px;
z-index: 1;
transform-origin: 0 0;
transition: 0.4s;
}
.hamburger:hover span:nth-child(2) {
transform: translateX(10px);
background-color: rgb(37, 164, 173);
}
.hamburger.is-active span:nth-child(1) {
transform: translate(0px, -2px) rotate(45deg);
background-color: rgb(37, 164, 173);
}
.hamburger.is-active span:nth-child(2) {
opacity: 0;
transform: translateX(15px);
}
.hamburger.is-active span:nth-child(3) {
transform: translate(-3px, 3px) rotate(-45deg);
background-color: rgb(37, 164, 173);
}
.hamburger.is-active:hover span {
background-color: rgb(75, 243, 255);
filter: blur(0.5px);
box-shadow: 1px -1px rgb(75, 243, 255);
}
.menu {
display: none;
flex: 1 1 0%;
justify-content: center;
margin: 0 -16;
letter-spacing: 2px;
}
.menu a {
color: ivory;
margin: 0 16;
font-weight: 700;
text-decoration: none;
transition: 0.4s;
padding: 5px 16px;
border-radius: 50px;
}
.menu a.is-active,
.menu a:hover {
background-color: rgba(88, 223, 233, 0.295);
color: rgb(75, 243, 255);
}
.dropdown {
position: relative;
}
.dropdownMenu {
position: absolute;
width: 300px;
z-index: 100;
right: -60px;
top: calc(100% + 32px);
border-top: 1px solid rgb(75, 243, 255);
border-bottom: 3px solid rgb(75, 243, 255);
border-left: 3px solid rgb(55, 225, 240);
background-color: #212121;
border-radius: 0 0 15px 15px;
opacity: 0;
}
.link {
display: block;
text-align: left;
margin: 10px;
font-size: 30px;
color: ivory;
text-decoration: none;
opacity: 1;
}
.dropdownMenu a:hover {
background-color: rgba(88, 223, 233, 0.295);
border-radius: 5px;
color: rgb(75, 243, 255);
text-decoration: none;
opacity: 1;
}
.wth {
padding-bottom: 1000px;
}
.footer {
position: relative;
width: 100%;
bottom: 0;
text-align: left;
background-color: #212121;
padding: 50px 0 50px 0;
}
.footer-container {
margin-left: 1em;
}
.footer h5 {
color: #fff;
}
.footer h5 {
margin-bottom: 20px;
}
.footer p {
color: rgba(255, 255, 255, 0.25);
font-size: 16px;
line-height: 22px;
}
.hearted {
color: red;
font-size: 12px;
}
.opacityStyle {
opacity: 1;
}
.subscribe {
width: 100%;
background-color: rgb(92, 89, 89);
background-image: url('../images/backgrounds/parallax-bg.jpg');
background-attachment: fixed;
background-repeat: no-repeat;
background-position: 50% 0;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
position: relative;
}
.subscribe>.sub-container {
padding-top: 80px;
padding-bottom: 80px;
}
.subscribe-title h2 {
font-weight: 600;
font-size: 23px;
color: #fff;
letter-spacing: 3px;
margin: 0 3%;
line-height: 70px;
text-transform: uppercase;
}
.subscribe-form {
margin-top: 6px;
}
.subscribe-form input[type=text] {
width: 65%;
height: 60px;
display: block;
padding: 0 20px;
background-color: #fff;
border: 1px solid #fff;
border-radius: 10px;
-webkit-border-top-left-radius: 10px;
-webkit-border-bottom-left-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-bottomleft: 10px;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
line-height: 60px;
letter-spacing: 1px;
font-size: 15px;
font-weight: 300;
float: left;
}
.subscribe-form input:focus {
outline: 0;
}
.subscribe-form input[type=submit] {
width: 35%;
height: 62px;
display: flex;
position: absolute;
right: 5px;
justify-content: center;
background-color: rgb(35, 142, 151);
border: 1px solid rgb(35, 142, 151);
color: #fff;
-webkit-border-top-right-radius: 10px;
-webkit-border-bottom-right-radius: 10px;
-moz-border-radius-topright: 10px;
-moz-border-radius-bottomright: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
font-weight: 700;
font-size: 33px;
transition: all 0.125s ease-in-out 0s;
-moz-transition: all 0.125s ease-in-out 0s;
-webkit-transition: all 0.125s ease-in-out 0s;
-o-transition: all 0.125s ease-in-out 0s;
-ms-transition: all 0.125s ease-in-out 0s;
}
.subscribe-form input[type=submit]:hover {
background-color: rgb(23, 90, 95);
border: 1px solid rgb(23, 90, 95);
color: rgb(75, 243, 255);
}
.error_message {
color: #fc6e51;
padding-bottom: 15px;
font-size: 13px;
line-height: 30px;
}
#success_page {
color: #9ce726;
padding-bottom: 10px;
font-size: 12px;
}
#success_page h3 {
font-size: 17px;
font-weight: 400px;
color: #4ab217;
}
#success_page p {
font-size: 12px;
font-weight: 400px;
color: #b3b3b3;
}
/* ------------------------------------------------------------------------------
THE IMPORTANT PART
-------------------------------------------------------------------------------*/
.box1 {
grid-column: 1/4;
text-align: center;
background: chartreuse;
}
.box2 {
grid-column: 1 / 2;
grid-row: 2/2;
width: 300px;
height: 300px;
background: blueviolet
}
.box3 {
width: 200px;
grid-column: 2/3;
grid-row: 2/3;
background: blue;
word-wrap: break-word;
}
.box4 {
width: 200px;
grid-column: 1/4;
grid-row: 4/4;
background: #fc6e51;
word-wrap: break-word;
}
.wrapper {
display: grid;
grid-template-columns: repeat(3, auto);
grid-template-rows: repeat(1, 1fr);
gap: 10px;
max-height: 55vh;
background: #212121;
}
.megawrap {
display: grid;
grid-auto-flow: column;
height: 350px;
width: 200px;
gap: 20px;
}
/* ------------------------------------------------------------------------------
THE IMPORTANT PART END
-------------------------------------------------------------------------------*/
#media (min-width: 1080px) {
.bodyC2 {
max-width: 360px;
padding-left: 150px;
}
.bodyC2 {
flex-direction: column;
padding-top: 200px;
padding: 50px;
padding-left: 200px;
margin-left: 100px;
}
.bodyC {
padding: 50px;
margin-left: 25px;
}
}
#media (max-width: 1175px) {
.bodyC2 {
max-width: 360px;
padding-left: 75px;
}
.bodyC2 {
flex-direction: column;
padding-top: 200px;
padding: 50px;
padding-left: 0px;
margin-left: 50px;
}
.bodyC {
padding: 50px;
margin-left: 25px;
}
}
#media (max-width: 1400px) {
.bodyC2 {
max-width: 360px;
padding-left: 75px;
}
.bodyC2 {
flex-direction: column;
padding-top: 200px;
padding: 50px;
padding-left: 0px;
margin-left: 100px;
}
.bodyC {
padding: 50px;
margin-left: 25px;
}
}
#media (min-width: 975px) {
.hamburger {
display: none;
}
.dropdown {
display: none;
}
.menu {
display: flex;
}
.bodyContainer {
flex-direction: row;
}
.bodyC2 {
flex-direction: column;
padding-top: 100px;
}
}
/* Once completely tiny shrink text to columns */
#media (max-width: 975px) {
.bodyContainer {
flex-direction: column;
}
.bodyC2 {
flex-direction: column;
padding-top: 50px;
font-size: .8em;
margin-left: 150px;
}
.bodyC {
font-size: .8em;
margin-left: 50px;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>III</title>
<link rel="stylesheet" href="main.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Dosis:wght#200;300;400;500;600;700;800&family=Roboto+Mono:ital,wght#0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,200;1,300;1,400;1,500;1,600;1,700&family=Rock+3D&display=swap" rel="stylesheet">
</head>
<body>
<nav>
<div class="container">
<div class="logobutton">
<img class="smallu" src="images/ulogo-white.jpg">
<a class="homenugget" href="home.html"></a>
</div>
<h1>Ideas Imprint</h1>
<div class="menu">
Events
About
Login
Dashboard
</div>
<div class="dropdown">
<button class="hamburger">
<span> </span>
<span></span>
<span></span>
</button>
<div class="dropdownMenu">
Events
About
Login
Dashboard
</div>
</div>
</div>
< /nav>
<div class="megawrap">
<div class="wrapper">
<div class="box1">Hello I'm a Head</div>
<img class="box2" src="images/7.jpg" alt="">
<div class="box3">
box3box3box3box3box3box3box3box3box3box3box3box3
</div>
<div class="box4">
box4box4box4box4box4box4box4box4box4box4box4
</div>
</div>
<div class="wrapper">
<div class="box1">Hello I'm a Head</div>
<img class="box2" src="images/7.jpg" alt="">
<div class="box3">
box3box3box3box3box3box3box3box3box3box3box3
</div>
<div class="box4">
box4box4box4box4box4box4box4box
</div>
</div>
<div class="wrapper">
<div class="box1">Hello I'm a Head</div>
<img class="box2" src="images/7.jpg" alt="">
<div class="box3">
box3box3box3box3box3box3box3box3box3box3box3box3
</div>
<div class="box4">
box4box4box4box4box4box4box4box4box
</div>
</div>
</div>
<div class="wth"></div>
<!-- Footer section -->
<footer class="footer">
<div class="footer-container">
<div class="footer-row">
<div class="Footer-text-left">
<p>Copyright © 2022 Ideas Imprint Inc. All Rights Reserved.</p>
<p> Made with <span class="hearted"> ❤</span></p>
</div>
</div>
</div>
<!-- footer top -->
</footer>
<!-- Footer section -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="main.js"></script>
</body>
</html>

How to make top-bar like sublime top-bar using real CSS?

I want to make like this but my top bar is to different i dont know how to make like this
.top-bar {
width: 100%;
height: 40px;
border: solid 1px white;
}
Please try following example. I think you can use or customize some value.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Lato', sans-serif;
font-size: 14px;
padding: 70px;
background: #f69ec4;
}
.tabs {
margin-bottom: 30px;
}
nav,
.content {
min-width: 600px;
}
.content {
max-width: 600px;
display: block;
margin-bottom: 1em;
background: #32557f;
padding: 2em 3em;
border-radius: .15em;
border: .2em solid #fff;
color: #fff;
}
nav {
position: relative;
z-index: 1;
}
nav > a {
position: relative;
width: 10em;
display: inline-block;
padding: .7em 2em .5em;
color: #fff;
text-decoration: none;
margin: 0 -.3em;
}
nav > a::before {
border: .2em solid #fff;
}
nav a::before {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
border-bottom: none;
border-radius: 1em 1em 0 0;
background: #7eb4e2;
transform: scale(1.2, 1.3) perspective(0.5em) rotateX(5deg);
}
nav a.active {
z-index: 2;
}
nav a.active::before {
background-color: #32557f;
margin-bottom: -.08em;
}
.tab-left-right nav {
padding-left: 1.3em;
}
.tab-left-right nav a::before {
transform-origin: bottom;
}
<div class="tabs tab-left-right">
<nav>
Tab1
Tab2
Tab3
</nav>
<div class="content" id="content1">Content</div>
</div>
I use ul list
.open-file-list {
position: absolute;
top: 45px;
top: var(--header-height);
height: 30px;
width: 100%;
background-color: var(--primary-color);
overflow-x: auto !important;
overflow-y: hidden !important;
display: flex;
flex-direction: row !important;
color: white;
color: var(--text-main-color)
}
.open-file-list li.tile {
min-width: -webkit-min-content;
min-width: -moz-min-content;
min-width: min-content;
height: 30px;
position: relative;
overflow: hidden;
font-size: 0.8em;
align-items: center;
margin: 0;
padding: 0;
color: inherit
}
.open-file-list li.tile::before{
position: absolute;
content: '';
background-color: black;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
border-bottom: none;
border-radius: 1em 1em 0 0;
background: #7eb4e2;
transform: scale(1.2, 1.3) perspective(0.5em) rotateX(5deg);
height: 30px;
}
.open-file-list li.tile.text{
display: inline-block;
white-space: nowrap;
max-width: 180px;
overflow: hidden;
text-overflow: ellipsis;
margin: 0;
padding-right: 10px;
color: inherit
}
.open-file-list li.tile.select {
position: absolute;
left: 0;
top: 0
}
.open-file-list li.tile.notice::before {
content: '♥';
color: #00ff00;
font-size: 1em;
margin-left: 2.5px
}
.open-file-list li.tile.active {
border-top: solid 2px #00ee00;
background-color: rgba(0,0,0,0.2)
}
.open-file-list li.tile .file,.open-file-list li.tile .icon {
height: 20px;
width: 20px;
font-size: 1em;
background-size: 14px;
background-position: center;
color: inherit
}

Algolia autocomplete not visible with material input field

I am using material web components in my project, as well as an algolia autocomplete.js. I have made a search input field where I would like to show the results in an autocomplete dropdown menu. This is the html:
<form action="/search" method="get">
<div class="mdc-text-field mdc-text-field--box mdc-text-field--with-leading-icon">
<i class="material-icons mdc-text-field__icon" tabindex="0">search</i>
<input name="q"
type="text"
class="mdc-text-field__input search-input-js aa-input-search"
placeholder="Search for players and videos ..."
aria-label="Full-Width Text Field">
</div>
</form>
And this is the css:
.algolia-autocomplete {
display: flex!important;
flex: auto!important;
height: 100%;
}
.aa-dropdown-menu {
position: relative;
top: -6px;
border-radius: 3px;
margin: 6px 0 0;
padding: 0;
text-align: left;
height: auto;
position: relative;
background: $white;
border: 1px solid #ccc;
width: 100%;
left: 0 !important;
box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.2), 0 2px 3px 0 rgba(0, 0, 0, 0.1);
}
.aa-dropdown-menu:before {
position: absolute;
content: '';
width: 14px;
height: 14px;
background: #fff;
z-index: 0;
top: -7px;
border-top: 1px solid #D9D9D9;
border-right: 1px solid #D9D9D9;
transform: rotate(-45deg);
border-radius: 2px;
z-index: 999;
display: block;
left: 24px;
}
.aa-dropdown-menu .aa-suggestions {
position: relative;
z-index: 1000;
}
.aa-dropdown-menu [class^="aa-dataset-"] {
position: relative;
border: 0;
border-radius: 3px;
overflow: auto;
padding: 8px 8px 8px;
color: #3c3e42;
font-weight: 500;
}
.aa-dropdown-menu * {
box-sizing: border-box;
}
.aa-suggestion {
padding: 0 4px 0;
display: block;
width: 100%;
height: 38px;
clear: both;
}
.aa-suggestion span {
white-space: nowrap !important;
text-overflow: ellipsis;
overflow: hidden;
display: block;
float: left;
line-height: 1em;
width: calc(100% - 30px);
}
.aa-suggestion.aa-cursor {
background-color: transparent;
}
.aa-suggestion em {
color: #00bcd4;
font-weight: 700;
}
.aa-suggestion img {
float: left;
height: 44px;
width: 44px;
margin-right: 6px;
}
.aa-suggestion a {
color: #3c3e42;
}
.aa-suggestions-category {
font-weight: 700;
color: #3c3e42;
border-bottom: 1px solid rgba(102, 105, 105, 0.17);
}
.powered-by-algolia {
padding-left: 15px;
border-top: 1px solid rgba(102, 105, 105, 0.17);
display: flex;
align-items: center;
height: 30px;
}
.aa-input-container {
display: inline-block;
position: relative; }
.aa-input-search {
width: 100%;
height: 30px;
padding: 12px 28px 12px 12px;
box-sizing: border-box;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none; }
.aa-input-search::-webkit-search-decoration, .aa-input-search::-webkit-search-cancel-button, .aa-input-search::-webkit-search-results-button, .aa-input-search::-webkit-search-results-decoration {
display: none;
}
.media {
margin: 10px 0;
}
.media-body {
p {
margin: 0;
}
}
The problem I have is that the dropdown menu is not visible with the mdc-text-field--box if I am not using the box field and I am instead using the normal field then the dropdown menu is visible. How can I fix this so that the dropdown menu is also visible with the mdc-text-field--box?
You should update the CSS in order to override the overflow on .mdc-text-field--box and update the pseudo elements.
.mdc-text-field--box {
overflow: visible;
}
.mdc-text-field--box:after,
.mdc-text-field--box:before {
top: 0;
left: 0;
width: 100%;
height: 100%;
}
You can find an example on the jsFiddle also.

Why is my image stretching at the media query with display flex

I have an image with a class of author-pic, its working how I want it to, except on the second to last media query it's stretching horizontally, when display flex is set. I know you're not supposed to use % with children of display flex, however author-pic is not an immediate child, does this mean you cant use % on any children when using display flex? If so how can I fix this because flex-basis doesnt seem to work either, I'm assuming because author-pic isnt an immediate child.
https://jsfiddle.net/svb0gxgg/2/
#media screen and (min-width: 400px){
.author-pic{
min-width: 300px;
width: 25%;
height: 25%;
float: left;
margin: 0 .5em;
}
section h2{
font-size: 1.5em;
}
section h3{
font-size: 1.3em;
}
/***home page***/
.home-page-greeting{
font-size: 1.8rem;
}
.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book{
width: 113px;
height: 180px;
}
.front-of-book-front:before{
width: 133px;
height: 17px;
transform: translate(8px,105px) rotate(90deg);
-moz-transform: translate(8px,105px) rotate(90deg);
}
.front-of-book-front:after{
width: 83px;
height: 14px;
transform: translate(0,21px);
-moz-transform: translate(0,21px);
}
.bar{
width: 95px;
height: 10px;
background-color: rgba(0,0,0,.8);
font-size: .3em;
color: white;
text-align: right;
transform: rotate(90deg) translate(42px,-45px);
-moz-transform: rotate(90deg) translate(42px,-45px);
}
.book-back p{
font-size: .4rem;
margin: 2.9em 1.9em;
}
.book-side{
width: 176px;
height: 10px;
top:-3px;
}
header{
height: 130px;
display: flex;
justify-content: center;
}
header h1{
font-size: 2em;
align-self: flex-start;
white-space: nowrap;
border: 8px solid black;
}
header nav{
display: block;
align-self: flex-end;
position: initial;
width: initial;
}
.main-nav{
display: flex;
justify-content: flex-end;
width:initial;
}
.main-nav li{
border-radius: 8px;
padding: 5px;
font-size: 1.3rem;
background-color: transparent;
margin: 0 4px;
width:initial;
}
.drop-menu{
top: 34px;
}
.drop-menu li{
margin: 0;
border-radius: 0;
}
/***charactor page*****/
.character-pic{
width: 25%;
height: 25%;
}
}
#media screen and (min-width:860px){
body{
background-position: center;
}
header{
height: 120px;
justify-content: space-between;
}
header h1{
margin: 0 0 0 20px;
}
.main-nav li{
font-size: 1.5rem;
}
header nav{
margin: 0 40px 0 0;
width: initial;
}
.drop-menu{
top: 38px;
}
section h2{
font-size: 1.8em;
}
/***home page***/
.amazonBookLabel{
font-size: 1.5em;
}
/**home page book**/
.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book{
width: 200px;
height: 320px;
}
.front-of-book-front{
perspective: 200px;
}
.front-of-book-front:before{
width: 234px;
height: 37px;
transform: translate(11px,185px) rotate(90deg);
font-size: 1em;
line-height: 37px;
}
.front-of-book-front:after{
width: 146px;
height: 26px;
transform: translate(0,32px);
}
.bar{
width: 172px;
height: 23px;
background-color: rgba(0,0,0,.8);
font-size: .3em;
color: white;
text-align: right;
transform: rotate(90deg) translate(74px,-82px);
font-size: .7em;
}
.bar p{
display: block;
padding: 12px 5px 0 0;
}
.book-side{
width: 312px;
height: 10px;
top:-1px;
left: -5px;
}
.book-back p{
font-size: .7em;
margin: 3.3em 2.3;
}
/*****author page******/
.authorWrapper{
display: flex;
margin: auto;
}
.authorWrapper :nth-child(1){
flex-basis: 75%;
}
.authorWrapper :nth-child(2){
flex-basis: 25%;
}
}
If you want an image to scale properly you need only use width or only use height. Your image looks weird because you have the height set at 25%. Remove that and it should work. If you need to use both make sure you have the ratio correct, eg 4:3
use align-items. The default value is stretch, which is being applied here. Looks like you want to use flex-start instead.
/*************general*********************/
html,
body {
min-height: 100vh;
}
body {
margin: 0px;
// background-image: linear-gradient( 0, rgba(0,0,0,.8) 30%, rgba(0,150,255,.8) 100%), url("images/mainCover.jpg");
-moz-background-image: linear-gradient( 0, rgba(0, 0, 0, .8) 30%, rgba(0, 150, 255, .8) 100%), url("images/mainCover.jpg");
background-position: 40%;
background-repeat: no-repeat;
background-size: cover;
}
img {
max-width: 100%;
}
h1,
h2,
h3 {
font-family: arial;
text-align: center;
margin: 20px auto;
}
ul {
list-style: none;
text-align: center;
padding: 0;
}
a:visited,
a {
color: black;
}
section {
margin: 1%;
color: white;
}
section > article {
padding: 1em;
background-color: rgba(0, 0, 0, .5);
border-radius: 15px;
margin: 10px;
}
section h2,
section h3 {
text-align: center;
}
section h2 {
font-size: 1.3em;
text-shadow: 3px 3px 3px rgba(0, 0, 0, .5);
}
section h3 {
font-size: 1.1em;
}
article:after {
content: "";
display: block;
clear: both;
}
/*nav and header*/
header {
background-color: rgba(255, 165, 0, .8);
display: flex;
flex-flow: row wrap;
justify-content: center;
border-bottom: 8px solid black;
}
header h1 {
text-align: center;
margin: 0;
padding: 15px;
font-size: 1.5em;
text-shadow: 5px 5px 5px rgba(0, 0, 0, .3);
}
header h1,
nav a {
font-weight: 700;
font-family: arial;
}
header nav {
position: fixed;
bottom: 0;
width: 100%;
z-index: 1;
// background-color: rgba(255,165,0,.8);
}
.main-nav {
margin: 0;
width: 100%;
color: white;
font-family: arial;
font-weight: 600;
}
nav ul li {
text-align: center;
border: 1px solid white;
border-radius: 15px;
font-size: 1.2rem;
background-color: rgba(255, 165, 0, .8);
width: 100%;
}
.drop-menu-back {
display: none;
width: 100%;
}
a {
text-decoration: none;
}
nav a:visited,
nav a,
h1 {
color: white;
}
.main-nav .current-page {
background-color: rgba(0, 0, 0, .5);
}
/****drop down menu****/
.characters:hover {
position: relative;
border-radius: 8px 8px 0 0;
}
.drop-menu {
position: absolute;
visibility: hidden;
display: block;
top: 38px;
white-space: nowrap;
left: -2px;
background-color: rgba(255, 165, 0, .8);
border: 1px solid rgba(0, 0, 0, .02);
box-shadow: 5px 5px 5px 2px rgba(0, 0, 0, .3);
opacity: 0;
transition: opacity 300ms ease-in-out 0s;
z-index: 1;
}
.characters:hover .drop-menu {
visibility: visible;
opacity: 1;
}
/*******************home page*********************/
.home-page-greeting {
color: white;
text-align: center;
text-shadow: 3px 3px 5px rgba(0, 0, 0, 1);
}
.bookWrapper {
width: 25%;
margin: auto;
}
.bookLink {
display: block;
margin: auto;
}
.bookImage {
margin: 35px auto;
display: block;
//max-height: 300px;
}
.amazonBookLabel {
background-color: rgba(0, 0, 0, .5);
color: white;
padding: 10px;
font-weight: 600;
border-radius: 20px;
margin: 30px auto;
text-align: center;
position: relative;
max-width: 200px;
}
.amazonBookLabel:after {
content: "";
width: 30px;
height: 5px;
background-color: rgba(0, 0, 0, .5);
position: absolute;
bottom: -5px;
left: calc(50% - 17px);
}
.amazonBookLabel:before {
content: "";
width: 0;
height: 0;
border-left: 40px solid rgba(0, 0, 0, .5);
border-top: 40px solid transparent;
position: absolute;
bottom: -45px;
transform: rotate(-45deg);
transform-origin: top left;
left: calc(50% - 30px);
}
/***home page book***/
.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book {
width: 100px;
height: 160px;
position: relative;
perspective: 800px;
}
.book {
margin: 52px auto;
transition: transform 1s ease-in-out 0s;
-moz-transition: transform 1s ease-in-out 0s;
}
.book-front {
position: relative;
transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-origin: left;
-moz-transform-origin: left;
transition: transform 1s ease-in-out 0s;
-moz-transition: transform 1s ease-in-out 0s;
box-shadow: 0px 3px 5px 2px rgba(0, 0, 0, .5);
perspective: 400px;
perspective-origin: -200px;
}
.front-of-book-front {
background-image: url("images/mainCover.jpg");
background-repeat: no-repeat;
background-size: cover;
background-position: 47%;
backface-visibility: hidden;
}
.front-of-book-front:before {
content: "Seraph Chronicles: Evangelion";
text-shadow: 2px 2px 1px rgba(0, 0, 0, .5);
font-size: .5em;
line-height: 15px;
color: white;
width: 119px;
height: 15px;
background-color: rgba(255, 165, 0, .5);
position: absolute;
text-align: center;
transform: translate(8px, 93px) rotate(90deg);
-moz-transform: translate(8px, 93px) rotate(90deg);
}
.front-of-book-front:after {
content: "";
width: 75px;
height: 12px;
background-color: rgba(255, 165, 0, .5);
position: absolute;
transform: translate(0px, 19px);
-moz-transform: translate(0px, 19px);
}
.bar {
width: 80px;
height: 8px;
background-color: rgba(0, 0, 0, .8);
font-size: .3em;
color: white;
text-align: right;
transform: rotate(90deg) translate(36px, -45px);
-moz-transform: rotate(90deg) translate(36px, -45px);
}
.bar p {
padding: 2px 3px 0 0;
display: block;
}
.back-of-book-front {
backface-visibility: hidden;
background-color: rgb(240, 234, 214);
transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
position: absolute;
top: 0;
}
.book-front:hover {
transform: rotatey(-180deg);
}
.book:hover {
transform: rotate(10deg);
}
.book-back {
position: absolute;
top: 0;
background-color: rgb(240, 234, 214);
z-index: -1;
box-shadow: 3px 3px 5px 0 rgba(0, 0, 0, .5);
text-align: justify;
}
.book-back p {
font-size: .3rem;
margin: 2.9em 1.9em;
}
/**********author page********/
.author-pic {
display: block;
margin: auto;
width: 200px;
;
}
section article {
padding: 1em;
background-color: rgba(0, 0, 0, .5);
border-radius: 15px;
margin: 10px;
clear: both;
}
address {
margin: 15px auto;
width: 125px;
font-family: arial;
}
.email {
background-image: url("images/mail-icon.png");
background-repeat: no-repeat;
background-size: contain;
background-position: 0 50%;
}
.email a,
.facebook a,
.email:visited,
.facebook:visited {
color: white;
font-style: normal;
font-weight: 500;
}
address a {
display: block;
line-height: 19px;
}
.facebook {
background-image: url("images/facebook-icon.png");
background-size: contain;
background-repeat: no-repeat;
background-position: 0 50%;
}
/*******characters page********/
.charater-pic {
width: 100%;
}
/***responsive***/
#media screen and (max-width: 400px) {
.drop-menu {
top: -97px;
width: 100%;
}
.drop-menu-back {
display: block;
width: 100%;
position: relative;
line-height: 22px;
}
.characters:hover {
border-radius: 15px;
}
.drop-menu-back span {
padding: 0;
font-size: .8em;
margin: 0 .5em 0 0;
}
.drop-menu {
background-color: transparent;
}
footer {
height: 100px;
}
}
#media screen and (min-width: 400px) {
.author-pic {
min-width: 300px;
width: 25%;
height: 25%;
float: left;
margin: 0 .5em;
}
section h2 {
font-size: 1.5em;
}
section h3 {
font-size: 1.3em;
}
/***home page***/
.home-page-greeting {
font-size: 1.8rem;
}
.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book {
width: 113px;
height: 180px;
}
.front-of-book-front:before {
width: 133px;
height: 17px;
transform: translate(8px, 105px) rotate(90deg);
-moz-transform: translate(8px, 105px) rotate(90deg);
}
.front-of-book-front:after {
width: 83px;
height: 14px;
transform: translate(0, 21px);
-moz-transform: translate(0, 21px);
}
.bar {
width: 95px;
height: 10px;
background-color: rgba(0, 0, 0, .8);
font-size: .3em;
color: white;
text-align: right;
transform: rotate(90deg) translate(42px, -45px);
-moz-transform: rotate(90deg) translate(42px, -45px);
}
.book-back p {
font-size: .4rem;
margin: 2.9em 1.9em;
}
.book-side {
width: 176px;
height: 10px;
top: -3px;
}
header {
height: 130px;
display: flex;
justify-content: center;
}
header h1 {
font-size: 2em;
align-self: flex-start;
white-space: nowrap;
border: 8px solid black;
}
header nav {
display: block;
align-self: flex-end;
position: initial;
width: initial;
}
.main-nav {
display: flex;
justify-content: flex-end;
width: initial;
}
.main-nav li {
border-radius: 8px;
padding: 5px;
font-size: 1.3rem;
background-color: transparent;
margin: 0 4px;
width: initial;
}
.drop-menu {
top: 34px;
}
.drop-menu li {
margin: 0;
border-radius: 0;
}
/***charactor page*****/
.character-pic {
width: 25%;
height: 25%;
}
}
#media screen and (min-width:860px) {
body {
background-position: center;
}
header {
height: 120px;
justify-content: space-between;
}
header h1 {
margin: 0 0 0 20px;
}
.main-nav li {
font-size: 1.5rem;
}
header nav {
margin: 0 40px 0 0;
width: initial;
}
.drop-menu {
top: 38px;
}
section h2 {
font-size: 1.8em;
}
/***home page***/
.amazonBookLabel {
font-size: 1.5em;
}
/**home page book**/
.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book {
width: 200px;
height: 320px;
}
.front-of-book-front {
perspective: 200px;
}
.front-of-book-front:before {
width: 234px;
height: 37px;
transform: translate(11px, 185px) rotate(90deg);
font-size: 1em;
line-height: 37px;
}
.front-of-book-front:after {
width: 146px;
height: 26px;
transform: translate(0, 32px);
}
.bar {
width: 172px;
height: 23px;
background-color: rgba(0, 0, 0, .8);
font-size: .3em;
color: white;
text-align: right;
transform: rotate(90deg) translate(74px, -82px);
font-size: .7em;
}
.bar p {
display: block;
padding: 12px 5px 0 0;
}
.book-side {
width: 312px;
height: 10px;
top: -1px;
left: -5px;
}
.book-back p {
font-size: .7em;
margin: 3.3em 2.3;
}
/*****author page******/
.authorWrapper {
display: flex;
margin: auto;
align-items: flex-start;
}
.authorWrapper:nth-child(1) {
flex-basis: 75%;
}
.authorWrapper:nth-child(2) {
flex-basis: 25%;
}
}
#media screen and (min-width: 1109px) {
header h1 {
font-size: 3em;
margin: 0 0 0 80px;
}
.main-nav > li {
margin: 0 8px;
}
header nav {
margin: 0 80px 0 0;
}
/***home page***/
.home-page-greeting {
font-size: 2.5rem;
}
}
<header>
<h1>Seraph Chronicles</h1>
<nav>
<ul class="main-nav">
<li class="main-nav-item">Home</li>
<li class="main-nav-item">About</li>
<li class="main-nav-item characters">
Characters
<ul class="drop-menu">
<li class="drop-menu-back"><span class="material-icons">arrow_back</span>Back</li>
<li>Ethan Clarke</li>
<li>Serena Kiriaga</li>
<li>Marcus Flynn</li>
<li>Emily Ashdown</li>
<li>Director Miles West</li>
</ul>
</li>
<li class="main-nav-item current-page">Author</li>
</ul>
</nav>
</header>
<main>
<section>
<div class="authorWrapper">
<article class="aboutAuthor">
<h2>About the Author</h2>
<img src="http://www.jqueryscript.net/images/Simplest-Responsive-jQuery-Image-Lightbox-Plugin-simple-lightbox.jpg" alt="picture of author, Kyle Feller" class="author-pic">
<p>sd t yghjiu hgfdwert yuikjn dnmkjhjh jhbnjhn jhnjhnmkjn mkjhnjhn mkjhnmkjn mkjn mkwjnedkj njhbnkjnmkj nmkjnm kjnmkjnmkj hnmkjnmk jnmjhbcnk jcbnjkj bnkjnbnk jnkjnnk jnkj nkj nknk jn nkjn bnkjnbnkm nnmknmkmn kjnkmnkjnmkj nmjnjnmk jnmjnmkjnb jxncbcjbnkj
nbnjkjhb njhnbkj njnbnkjnk jnmjhnmjn mkjnmjnm jnjnbnmjnj njhnmkjh nbnjnbnk jnbnjkjnj kjnkjnkjn kjnbnkjnbn kjnbnkj nbnkjn nknbnjnb nkjnbnmnn kjnnmmn kjnkmnkj mnkjnkjn nkjmnkjm nkjmnkm jcncc ncncncncnc ncnc ncnncnc ncncnc
</p>
</article>
<article>
<h2>Contact Me</h2>
<ul>
<li><address class="email">Email Me</address></li>
<li><address class="facebook"> Follow Me</address></li>
</ul>
</article>
</div>
</section>
</main>
<footer>
</footer>

How to vertically align HTML elements with CSS

Please refer to this image as a visual aid for my question.
I want the text input with "Sindre", the other input, and the buttons, to be placed higher, so they vertically align with the Icehotel logo. How can I do this?
Here's my code...
HTML
<div id="header-content">
<br>
<a href="/index">
<img draggable="false" src="{url}/app/tpl/skins/{skin}/images/logo.gif" style="position:relative; margin-left: 20px; <div align=; color: #FA0000;margin-top: 15px;margin-left: 180px">
</a>
<input id="username" name="log_username" placeholder="Username" style="position:relative; margin-left: 20px;padding:5px;box-shadow:3px 3px 5px black;border: 0;width:250px;background: #3b8ba4;border-radius: 6px;color: #baedf5;" type="text">
<input id="password" name="log_password" placeholder="Password" style="position:relative;margin-left: 1px;padding:5px;box-shadow:3px 3px 5px black;border: 0;width:250px;background: #3b8ba4;border-radius: 6px;color: #baedf5;" type="password">
<a href="{url}/api.php">
<button class="login green" name="login" style="height:34px;" type="submit">Let's go!</button>
</a>
<a>
<button class="login red" style="height:34px; margin-left: 4px" type="sumbit">Forgot your password?</button>
</a>
</div>
CSS
pre, blockquote {
border: 1px solid #999;
page-break-inside: avoid
}
thead {
display: table-header-group
}
tr, img {
page-break-inside: avoid
}
img {
max-width: 100%!important
}
#page {
margin: .5cm
}
p, h2, h3 {
orphans: 3;
widows: 3
}
h2, h3 {
page-break-after: avoid
}
}
html {
height: 100%
}
body {
height: 100%;
margin: 0;
padding: 0;
color: #e0eff5;
background-attachment: fixed;
background-color: #013448;
background-image: url('http://localhost/app/tpl/skins/aura/habboweb/planet.png');
background-image: url('http://localhost/app/tpl/skins/aura/habboweb/planet.png'), -webkit-radial-gradient(190px 190px, circle farthest-side, #0297c8 0, #013448 480px);
background-image: url('http://localhost/app/tpl/skins/aura/habboweb/planet.png'), -moz-radial-gradient(190px 190px, circle farthest-side, #0297c8 0, #2D3877 480px);
, -ms-radial-gradient(190px 190px, circle farthest-side, #0297c8 0, #013448 480px);
, radial-gradient(circle farthest-side at 190px 190px, #0297c8 0, #013448 480px);
min-height: 755px
}
i, cite, em, var, address, dfn {
font-style: italic;
}
body {
font-family: "Ubuntu Condensed", Arial, serif;
font-weight: normal;
min-height: 0;
}
#footer a {
color: #a1b5c8;
text-decoration: none;
font-size: 13px;
}
body {
font-size: 1em;
line-height: 1.4;
}
.form__input, .form__select {
box-shadow: inset 0 2px 0 0 #9ebecc;
line-height: 1.2;
padding: 5px 12px;
width: 100%;
font-size: 16px;
}
.button b, .new-button i {
position: absolute;
display: block;
left: 2px;
top: 3px;
right: 2px;
height: 9px;
background-color: #4a9fb4;
z-index: 0
}
.button:hover, .new-button:hover {
background-color: #418491
}
.button:hover b, .new-button:hover i {
background-color: #46a9bf
}
.button span, .new-button b {
position: relative;
z-index: 100
}
.button:active, .button-active, .new-button:active {
left: 1px;
top: 1px;
box-shadow: 2px 2px rgba(0, 0, 0, 0.4)
}
.button.dimmed {
-ms-filter: "alpha(opacity=50)";
filter: alpha(opacity=50);
-moz-opacity: .5;
opacity: .50
}
.button.large {
height: 100px;
background-color: #c78800;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
border: 1px solid #5f4416
}
.button.large:hover {
background-color: #d99b00
}
.button.large:hover b {
background-color: #f7ce00
}
.button.large b {
left: 4px;
top: 4px;
right: 4px;
height: 48px;
background-color: #f0bb00;
-webkit-border-radius: 2px 2px 0 0;
-moz-border-radius: 2px 2px 0 0;
border-radius: 2px 2px 0 0
}
.button.large span {
display: block;
font-size: 27px;
font-weight: bold;
text-transform: uppercase;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
line-height: 54px
}
.button.large span.sub {
display: block;
font-size: 17px;
font-weight: bold;
line-height: 42px;
text-transform: none
}
.button.large.not-so-large {
height: 48px
}
.button.large.not-so-large b {
height: 20px
}
.button.large.not-so-large span {
text-transform: none;
font-size: 22px;
line-height: 46px
}
header, footer {
width: 100%;
background: #101016;
background: rgba(16, 16, 22, 0.85);
position: fixed;
z-index: 999
}
#login-errors {
width: 100%;
height: 35px;
background-color: #c00;
color: #fff;
font-size: 17px;
font-weight: bold;
text-align: center;
line-height: 35px
}
#login-errors a {
color: #000
}
#footer-content {
float: left;
margin-left: 50px
}
#footer-content.partner-logo-present {
margin-left: 20px
}
#footer {
width: 100%;
min-width: 780px;
margin-top: 19px
}
header {
top: 0;
min-height: 99px
}
header #border-left {
position: absolute;
width: 500px;
height: 1px;
left: 0;
bottom: 0;
border-bottom: 1px solid #7aa3b9
}
header #border-right {
position: absolute;
width: 100%;
height: 1px;
left: 220px;
bottom: 0;
border-bottom: 1px solid #7aa3b9
}
footer {
height: 69px;
bottom: 0;
border-top: 1px solid #7aa3b9
}
#top-bar-triangle, #top-bar-triangle-border {
position: absolute;
left: 163px;
bottom: -29px
}
#top-bar-triangle {
font-size: 0;
height: 0;
line-height: 0;
border-style: solid;
float: left;
margin: 0;
border-color: #101016 transparent;
border-color: rgba(16, 16, 22, 0.85) transparent;
border-width: 29px 29px 0 29px
}
#top-bar-triangle-border {
background-image: url('http://localhost/images/new_index/images/v3/top_bar_arrow_border.out.png');
width: 58px;
height: 29px
}
header #habbo-logo {
position: absolute;
width: 190px;
height: 52px;
background-image: url('http://localhost/app/tpl/skins/aura/images/logo.png');
left: 32px;
top: 27px
}
#login-form-container {
position: relative
}
header form {
position: relative;
left: 239px;
top: 0;
width: 740px;
height: 99px
}
#login-columns {
position: relative
}
header form.captcha {
height: 200px
}
header form.captcha #login-recaptcha {
height: 103px;
margin-top: 8px
}
#login-recaptcha .field-error, #login-recaptcha #captcha-overlay {
display: none
}
#login-column-1 {
position: absolute;
left: 0;
top: 11px;
width: 205px;
height: 70px
}
#login-column-2 {
position: absolute;
left: 214px;
top: 11px;
width: 134px;
height: 70px
}
#login-column-3 {
position: absolute;
left: 358px;
top: 32px;
width: 205px;
height: 55px
}
Set vertical-align: middle; on the inputs and remove the margin-top from the inline styles in the logo <img> tag.
While I'm at this, though...General cleanup of this code is probably a good idea. I would like to caution you to avoid mixing inline styles and CSS. Also, the <br> tag should probably be replaced with padding - that line break and the inline styles are there only for design purposes and design is handled in CSS. Keeping as much design out of the HTML will help you (or someone else) easily make changes to this site later, if needed. The <img> tag's styles also include two margin-left values. I would remove one to avoid confusion. Lastly, I think you will want to remove <div align=; from the <img> tag's styles. As far as I know, this doesn't accomplish anything.
Hope that helps!

Resources