CSS\HTML Responsive flexbox - html

I have been working on developing my own webpage, and for the home page I wanted a nice looking banner with 3 tiles (1 big one left with 2 smaller ones stacked on top of eachother right).
I could get this all to work fine, but I now noticed that on mobile devices this really gets out of proportion, and I wanted to make the 3 tiles all on top of each other when the width of the screen gets less than let's say 300px.
However, I can not seem to get this to work by looking at other questions on stackoverflow, only tiles start to disappear
Example view of what I wish to accomplish
#media only screen and (min-width: 300px) {
.hero {
height: 400px;
width: 80%;
margin-left: auto;
margin-right: auto;
display: flex;
position: relative;
}
.left {
float: left;
width: 80%
}
.right {
float: left;
width: 80%
}
}
#media only screen and (min-width: 600px) {
.hero {
height: 400px;
width: 90%;
margin-left: auto;
margin-right: auto;
display: flex;
position: relative;
}
}
.left {
background-image: url('http://via.placeholder.com/1600x1200');
background-size: cover;
flex: 1;
}
.left:hover {
opacity: 0.8;
}
.left:hover .btnLeft {
color: white;
background-color: orange;
border: 1px solid orange;
}
.right {
display: flex;
margin-left: 5px;
flex-direction: column;
flex: 0 0 40%;
}
.one {
height: 175px;
background-image: url('http://via.placeholder.com/380x260');
background-size: cover;
flex: 80%;
}
.one:hover {
opacity: 0.8;
}
.one:hover .btnTop {
color: white;
background-color: orange;
border: 1px solid orange;
}
.two {
height: 175px;
margin-top: 5px;
background-image: url('http://via.placeholder.com/380x260');
background-size: cover;
flex: 50%;
}
.two:hover {
opacity: 0.8;
}
.two:hover .btnBot {
color: white;
background-color: orange;
border: 1px solid orange;
}
.btnLeft {
margin-top: 300px;
background-color: white;
color: black;
border: 1px solid black;
border-radius: 2px;
padding: 3px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 30px;
font-family: 'Titillium Web', sans-serif;
font-weight: normal;
text-transform: capitalize;
}
.btnTop {
margin-top: 140px;
background-color: white;
color: black;
border: 1px solid black;
border-radius: 2px;
padding: 2px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 25px;
font-family: 'Titillium Web', sans-serif;
font-weight: normal;
text-transform: capitalize;
}
.btnBot {
margin-top: 140px;
background-color: white;
color: black;
border: 1px solid black;
border-radius: 2px;
padding: 2px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 25px;
font-family: 'Titillium Web', sans-serif;
font-weight: normal;
text-transform: capitalize;
}
<div class="hero">
<a href="http://example.com" class="left" >
<div class="btnLeft">Option 1</div>
</a>
<div class="right">
<a href="http://example.com" class="one" >
<div class="btnTop">Option 2</div>
</a>
<a href="http://example.com" class="two" >
<div class="btnBot">Option 3</div>
</a>
</div>
</div>

This is an easy effect to achieve using flexbox. On your smallest size screens give the .hero container a property of flex-direction:column to have them stack vertically. Once you hit your bigger breakpoint, change this to flex-direction:row.
Also, it's worthwhile to note that you don't need to add a float property to the .left and .right containers as this isn't how flexbox functions.
For a pretty in depth look of how flexbox works check out this link.
#media only screen and (min-width: 300px) {
.hero {
height: 400px;
width: 80%;
margin-left: auto;
margin-right: auto;
display: flex;
position: relative;
flex-direction:column;
}
}
#media only screen and (min-width: 600px) {
.hero {
height: 400px;
width: 90%;
margin-left: auto;
margin-right: auto;
display: flex;
position: relative;
flex-direction:row;
}
}
.left {
background-image: url('http://via.placeholder.com/1600x1200');
background-size: cover;
flex: 1;
}
.left:hover {
opacity: 0.8;
}
.left:hover .btnLeft {
color: white;
background-color: orange;
border: 1px solid orange;
}
.right {
display: flex;
margin-left: 5px;
flex-direction: column;
flex: 0 0 40%;
}
.one {
height: 175px;
background-image: url('http://via.placeholder.com/380x260');
background-size: cover;
flex: 80%;
}
.one:hover {
opacity: 0.8;
}
.one:hover .btnTop {
color: white;
background-color: orange;
border: 1px solid orange;
}
.two {
height: 175px;
margin-top: 5px;
background-image: url('http://via.placeholder.com/380x260');
background-size: cover;
flex: 50%;
}
.two:hover {
opacity: 0.8;
}
.two:hover .btnBot {
color: white;
background-color: orange;
border: 1px solid orange;
}
.btnLeft {
margin-top: 300px;
background-color: white;
color: black;
border: 1px solid black;
border-radius: 2px;
padding: 3px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 30px;
font-family: 'Titillium Web', sans-serif;
font-weight: normal;
text-transform: capitalize;
}
.btnTop {
margin-top: 140px;
background-color: white;
color: black;
border: 1px solid black;
border-radius: 2px;
padding: 2px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 25px;
font-family: 'Titillium Web', sans-serif;
font-weight: normal;
text-transform: capitalize;
}
.btnBot {
margin-top: 140px;
background-color: white;
color: black;
border: 1px solid black;
border-radius: 2px;
padding: 2px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 25px;
font-family: 'Titillium Web', sans-serif;
font-weight: normal;
text-transform: capitalize;
}
<div class="hero">
<a href="http://example.com" class="left" >
<div class="btnLeft">Option 1</div>
</a>
<div class="right">
<a href="http://example.com" class="one" >
<div class="btnTop">Option 2</div>
</a>
<a href="http://example.com" class="two" >
<div class="btnBot">Option 3</div>
</a>
</div>
</div>

Related

Why is the <div> element not filling the rest of the screen wen I use height: 100%;

I am making a sidebar for my site and I want the side bar to fill the rest of the screen but also scroll separate to the right of the screen when it overflows with other elements inside. When I use 100% for the height the element only goes to the height of the last element inside of it.
I am trying to get it to fill the rest of the screen as I stated previously but it only goes to not all the way.
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.main {
margin-left: 345px;
border: 0px solid #ffffff;
padding: 0px 0px;
flex-direction: column;
align-content: center;
text-align: center;
width: 450px;
}
.card {
display: inline-block;
width: 400px;
height: 160px;
background-color: #404040;
border: 1px solid #404040;
border-radius: 4px;
margin: 0px;
margin-top: 20px;
text-decoration: none;
}
.toptext {
display: inline-block;
width: 400px;
height: 45px;
color: #ffffff;
background-color: #ffffff;
border: 1px solid #ffffff;
border-radius: 4px;
margin: 0px;
margin-top: 5px;
text-decoration: none;
text-align: left;
}
.toptext h1 {
font-size: 20px;
margin-left: 0px;
margin-top: 1px;
color: #404040;
}
.toptext p {
font-size: 12px;
margin-left: 0px;
margin-top: -10px;
color: #404040;
}
.flexcolumn {
flex-direction: column;
}
.leftmain {
height: 100%;
width: 325px;
padding: 0px 10px;
flex-direction: column;
align-content: center;
background-color: #333333;
overflow: scroll;
}
.leftmain p {
float: left;
color: #ffffff;
text-align: left;
padding: 0px 10px;
text-decoration: none;
font-size: 12px;
line-height: 25px;
border-radius: 4px;
background-color: #333333;
width: 300px;
}
.leftmain p:hover {
background-color: #404040;
color: #ffffff;
}
.header {
overflow: hidden;
background-color: #404040;
padding: 10px 10px;
height: 36px;
text-align: center;
}
.header-right {
float: right;
padding: 0px 0px;
}
.header a {
float: left;
color: #ffffff;
text-align: center;
padding: 5px 10px;
text-decoration: none;
font-size: 18px;
line-height: 25px;
border-radius: 4px;
align-content: center;
}
.header a:hover {
background-color: #333333;
color: #ffffff;
}
<div class="header">
πŸ“„ My Paper Company
<div class="header-right">
Settings
Contact
Donate
<div class="flexcolumn">
</div>
</div>
</div>
<div id="leftmain" class="leftmain">
<p id="button" div="leftmain" onclick='show("htpmain")'>πŸ“’ How To Play</p>
</div>
<center>
<div id=htpmain class="main">
<div class="toptext">
<h1>
πŸ“’ How To Play
</h1>
<p>This guide will get you start the game and will be helpful to grasp everything you need to do.
</p>
</div>
<div class="card" />
</div>
</center>
Your leftmain IS taking up 100% of the space available to it, leftmain stops when it reaches . You have leftmain set to flex-direction: column;
when only the .main should have it. Also don't use the tag, it is no longer supported in HTML5 and is display: block; when it should be inline-block.
I would change just to and set display to inline-block and set a width so the leftmain has room to go past it.
I hope this solves your problem.
.leftmain {
height: 100%;
width: 325px;
padding: 0px 10px;
align-content: center;
background-color: #333333;
overflow: scroll;
}
#nameOfCenterDiv {
position: absolute;
left: 300px;
display: inline-block;
}
Give to the sidebar a position fixed so it always stays there wherever you scroll and and a margin-left to your content on the right (the width of the margin-left must be the same of sidebar width)
.leftmain{
position: fixed
}
.main{
margin-left: 345px;
width: 450px //remove this so it's 100%
}
You have to wrap the left sidebar and right panel within the same container.
Using the display: flex on the container, you no longer need to specify a 100% height for the left sidebar since it will automatically fill in the remaining space.
You also need to remove the margin-left rule for the right content so that it lays nicely with the sidebar.
You can optionally set a max-height of 100vh to the sidebar so that it scrolls when its content exceeds the viewport height.
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.main {
border: 0px solid #ffffff;
padding: 0px 0px;
flex-direction: column;
align-content: center;
text-align: center;
width: 450px;
}
.card {
display: inline-block;
width: 400px;
height: 160px;
background-color: #404040;
border: 1px solid #404040;
border-radius: 4px;
margin: 0px;
margin-top: 20px;
text-decoration: none;
}
.toptext {
display: inline-block;
width: 400px;
height: 45px;
color: #ffffff;
background-color: #ffffff;
border: 1px solid #ffffff;
border-radius: 4px;
margin: 0px;
margin-top: 5px;
text-decoration: none;
text-align: left;
}
.toptext h1 {
font-size: 20px;
margin-left: 0px;
margin-top: 1px;
color: #404040;
}
.toptext p {
font-size: 12px;
margin-left: 0px;
margin-top: -10px;
color: #404040;
}
.flexcolumn {
flex-direction: column;
}
.container {
display: flex;
}
.leftmain {
width: 325px;
padding: 0px 10px;
flex-direction: column;
align-content: center;
background-color: #333333;
overflow: scroll;
}
.leftmain p {
float: left;
color: #ffffff;
text-align: left;
padding: 0px 10px;
text-decoration: none;
font-size: 12px;
line-height: 25px;
border-radius: 4px;
background-color: #333333;
width: 300px;
}
.leftmain p:hover {
background-color: #404040;
color: #ffffff;
}
.header {
overflow: hidden;
background-color: #404040;
padding: 10px 10px;
height: 36px;
text-align: center;
}
.header-right {
float: right;
padding: 0px 0px;
}
.header a {
float: left;
color: #ffffff;
text-align: center;
padding: 5px 10px;
text-decoration: none;
font-size: 18px;
line-height: 25px;
border-radius: 4px;
align-content: center;
}
.header a:hover {
background-color: #333333;
color: #ffffff;
}
<div class="header">
πŸ“„ My Paper Company
<div class="header-right">
Settings
Contact
Donate
<div class="flexcolumn">
</div>
</div>
</div>
<div class="container">
<div id="leftmain" class="leftmain">
<p id="button" div="leftmain" onclick='show("htpmain")'>πŸ“’ How To Play</p>
</div>
<center>
<div id=htpmain class="main">
<div class="toptext">
<h1>
πŸ“’ How To Play
</h1>
<p>This guide will get you start the game and will be helpful to grasp everything you need to do.
</p>
</div>
<div class="card" />
</div>
</center>
</div>

How to make whole Div hoverable

I am trying to make somethng like that:enter image description here
Image from the left I have done without botton-right cut, I have made border-radius.
Image from the right is what happens when you hover on whole item. AS you can see only middle is highlighted. Any idea how to fix it?
Here is my Code:
HTML:
<div class="pojemnik" onclick="location.href='nitystandardowe.html'" >
<div class="zdjecie"> <img src="img/nitystandardowe.jpg"> </div>
<div class="tekst_"><h5>Nity Standardowe</h5> </div>
</div>
CSS:
.pojemnik{
display: flex;
width: 190px;
height: 170px;
background-color: #f5f7f6;
flex-wrap: wrap;
flex-direction: column;
color: silver;
font-family: sans-serif;
text-decoration: none;
border-bottom-right-radius: 30px;
}
.pojemnik:hover {
text-decoration: none;
cursor: pointer;
width: 190px;
height: 190px;
background-position:bottom;
background-image: url("../images/icons/strzalka-w-praw-tlo.png");
background-repeat: no-repeat;
bottom: 20px;
}
.tekst_ {
border-bottom: solid 2px white;
padding-left: 10px;
}
.tekst_:hover {
border-bottom: solid 2px blue;
background-color:#00a2fa;
border-bottom: solid 1px white;
color: white;
}
.tekst_ h5{
font-family: sans-serif;
font-size: 15px;
margin-top: 5px;
margin-left: 5px;
}
.tekst_ h5:hover{
font-family: sans-serif;
font-size: 15px;
margin-top: 5px;
margin-left: 5px;
color: white;
}
.zdjecie{
align-self: flex-start;
}
.zdjecie img{
position: relative;
width: 190px;
}
You need to specify that you also need to target the .tekst_ class upon hover of .pojemnik like so:
.pojemnik:hover .tekst_ {
border-bottom: solid 2px blue;
background-color:#00a2fa;
border-bottom: solid 1px white;
color: white;
}
.pojemnik{
display: flex;
width: 190px;
height: 170px;
background-color: #f5f7f6;
/* flex-wrap: wrap; */
flex-direction: column;
color: silver;
font-family: sans-serif;
text-decoration: none;
border-bottom-right-radius: 30px;
}
.pojemnik:hover {
text-decoration: none;
cursor: pointer;
width: 190px;
height: 190px;
background-position:bottom;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAUVBMVEX///8AAAD7+/s7OzusrKze3t7Z2dmvr6/b29tVVVUFBQVdXV34+Pjt7e0SEhKUlJRCQkLl5eXy8vJzc3NlZWXLy8tra2u9vb1KSkp5eXmZmZlkbd6rAAACfElEQVR4nO2di27aQBBFbWhSYhzCK03T///QVkhR0mAjEyBrn3vOB6C5mjs7uwvLVJWIiIiIiIiIiIiIiIiIiIjIG+1mWzqEW7LYNfU/9s+lA7kRs9f6jeVj6WBuQTuv31ndlQ7nBqzr/+BJ/FN/4r50RFdmu/qssF6Ujum6/DwSSDPqrkMhK4vLLoWoWnzoVEgy6q9uhSCJTz0KOUa971PIkdi91JCMuulViGkaL/0SKUb9wc/iCYmUWuzanOZkMaAWA4waIDHAqAESA4xq05gMARs4mwaB7FoMMCpFYrZRKU0juxYDsmgtToaApuEGjkB206BIzDYqpWlk12JAFgNqMcCoARIDjBogMcCoNo3JELCBs2kQyK7FAKNSJGYb1abRw2xsXDeLm6f9ej42fvcrPLcW29cTnzVSzsri5vjl3AQ4oxYfm9LBfolm+FvinkdXo+dhqMAT7yBGzgs8hXW9HCawLR3nBbSDFN6VDvMChi2nz6XDvIBh/z7BzyG/DvlraUA/nGwSB+9pAval/LPFNM+H515k0M/4B0pfyxzBv23DXwr3Z7BhZBB/5x1sUbzABm9RxiKTXIOMDCa3CXwG6TUI2arhfyqU3CbwAvEWZSwyyRbFZxBfg3iL0gXyT/R4gXSL8gXiLYpv9HiL4jOIr0G8RekC+Vs1xiKTXIOMDCa3CXwG6TXoly/TILlN4AXiLcpYZJItysggft7TiZldDIvy564t4BZNmH/In2HJn0PKnyXLnwfMn+nMn8vNn61eVWuyRQ+08w/6VkCBVTV7f6m6POMN76RY7A6PqvfD/u1horSbbekQRERERERERERERERERERE5Jv4CxOfKflP0w6QAAAAAElFTkSuQmCC");
background-size: 20px 20px;
background-repeat: no-repeat;
bottom: 20px;
}
.tekst_ {
border-bottom: solid 2px white;
padding-left: 10px;
}
/* .tekst_:hover {
border-bottom: solid 2px blue;
background-color:#00a2fa;
border-bottom: solid 1px white;
color: white;
} */
.pojemnik:hover .tekst_ {
border-bottom: solid 2px blue;
background-color:#00a2fa;
border-bottom: solid 1px white;
color: white;
}
.tekst_ h5{
font-family: sans-serif;
font-size: 15px;
margin-top: 5px;
margin-left: 5px;
}
/* .tekst_ h5:hover{
font-family: sans-serif;
font-size: 15px;
margin-top: 5px;
margin-left: 5px;
color: white;
} */
.zdjecie{
align-self: flex-start;
}
.zdjecie img{
position: relative;
width: 190px;
}
<div class="pojemnik" onclick="location.href='nitystandardowe.html'" >
<div class="zdjecie"> <img src="https://cdn.pixabay.com/photo/2020/11/17/15/44/cup-5752775__340.jpg"> </div>
<div class="tekst_"><h5>Nity Standardowe</h5> </div>
</div>

Making dropdown selection to fill element without gaps

I use menu that was created by other developer in our company. I add to the first item of the menu dropdown selection, but the problem that the dropdown box not fully fill the all the item and I can't make it fill.
Here is HTML:
<div class="main-container-top-menu scroll1" id="main-container-top-menu">
<div class="top-menu-item-container-empty">
<div style="width: 50px"></div>
</div>
<div class="top-menu-item-container">
<div class="inactive-border-bottom">
<p class="control has-icons-left is-expanded">
<span class="select is-fullwidth ">
<select class="full-height">
<option>dropdown</option>
<option>options 1</option>
</select>
</span>
<span class="icon is-small is-left"><i class="far fa-building"></i></span>
</p>
</div>
</div>
<div class="top-menu-item-container" >
<div>
<div class="top-menu-item">2. Lot and Model</div>
</div>
</div>
<div class="top-menu-item-container" >
<div [className]="ishpExpanded?'active-border-bottom':'inactive-border-bottom'">
<div class="top-menu-item">3. Home Plan</div>
</div>
</div>
<div class="top-menu-item-container">
<div [className]="isupgExpanded?'active-border-bottom':'inactive-border-bottom'">
<div class="top-menu-item">4. Upgrades</div>
</div>
</div>
<div class="top-menu-item-container">
<div [className]="isnextExpanded?'active-border-bottom':'inactive-border-bottom'">
<div class="top-menu-item">5. Next Steps</div>
</div>
</div>
<div class="top-menu-icon-container">
<i class="fas fa-print top-menu-icon"></i>
<i class="fas fa-share-alt top-menu-icon"></i>
</div>
</div>
And here is CSS:
.scroll1::-webkit-scrollbar {
width: 0px;
height: 3px;
}
.scroll1::-webkit-scrollbar-track {
background: #eff0f0;
}
.scroll1::-webkit-scrollbar-thumb {
background: #666;
}
.main-container-top-menu {
scrollbar-width: auto;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.top-menu-item-container-empty {
border-bottom: 2px solid #eff0f0;
font-family: "Roboto", sans-serif;
border-right: 2px solid #eff0f0;
box-sizing: border-box;
color: #626262;
font-size: 14px;
font-weight: 350;
user-select: none;
justify-content: space-between;
}
.top-menu-item-container {
border-bottom: 2px solid #eff0f0;
font-family: "Roboto", sans-serif;
border-right: 2px solid #eff0f0;
box-sizing: border-box;
color: #626262;
font-size: 14px;
font-weight: 350;
user-select: none;
flex: 1;
justify-content: space-between;
}
.active-border-bottom {
align-items: center;
display: flex;
padding-left: 20px;
padding-right: 20px;
height: 100%;
border-bottom: 3px solid #eb2028;
box-sizing: border-box;
}
.inactive-border-bottom {
align-items: center;
display: flex;
padding-left: 20px;
padding-right: 20px;
height: 100%;
}
.top-menu-item-active {
cursor: pointer;
font-family: "Roboto", sans-serif;
padding: 5px;
font-family: "Roboto", sans-serif;
box-sizing: border-box;
color: #1d1d1d;
font-size: 14px;
font-weight: 350;
user-select: none;
align-items: center;
justify-content: center;
display: flex;
stroke-width: 0.6px;
-webkit-text-stroke-width: 0.6px;
flex: 1;
}
.top-menu-item {
cursor: pointer;
padding: 10px;
font-family: "Roboto", sans-serif;
box-sizing: border-box;
color: #626262;
font-size: 14px;
user-select: none;
align-items: center;
justify-content: center;
display: flex;
flex: 1;
}
.top-menu-item-first {
cursor: default;
border-right: 2px solid #eff0f0;
font-size: 14px;
padding-right: 20px;
font-weight: 800;
border-bottom: 2px solid #eff0f0;
border-left: none;
text-align: left;
justify-content: left;
flex: 1;
}
.top-right-menu-item {
/* margin-right: 50px; */
border-bottom: 2px solid #eff0f0;
height: 100%;
display: inline-flex;
justify-content: flex-end;
align-items: center;
}
.top-item-logo {
height: 55px;
z-index: 100;
width: 55px;
object-fit: contain;
}
.top-menu-icon-container{
display: flex;
align-items: center;
justify-content: center;
}
.top-menu-icon {
cursor: pointer;
margin-right: 25px;
margin-left: 25px;
cursor: pointer;
width: 14px;
padding-top: 25px;
padding-bottom: 25px;
}
.left-arrow,
.right-arrow {
display: none;
}
#media screen and (max-width: 768px) {
.constructor-top-container {
justify-content: center;
padding-left: 3%;
}
}
#media screen and (max-width: 1088px) {
.top-right-menu-item {
padding-left: 10px;
margin-right: 0px;
border-bottom: 2px solid #eff0f0;
flex: 1;
height: 100%;
display: inline-flex;
justify-content: flex-end;
align-items: center;
}
.main-container-top-menu {
padding-left: 0;
padding-right: 0;
padding-bottom: 3px;
}
}
#media screen and (max-width: 414px) {
.top-menu-icon {
margin-right: 15px;
cursor: pointer;
width: 14px;
padding-top: 12px;
}
.scroll1::-webkit-scrollbar {
width: 0px;
height: 0px;
}
.scroll1::-webkit-scrollbar-track {
background: #eff0f0;
}
.scroll1::-webkit-scrollbar-thumb {
background: #666;
}
.top-menu-item-first {
padding-left: 35px;
}
.main-container-top-menu {
transition: 0.2s all;
min-height: 62px;
}
.top-item-logo {
position: absolute;
top: 0;
right: 0px;
margin: 0;
padding: 0;
z-index: 100;
height: 62px;
width: 62px;
object-fit: contain;
}
.left-arrow {
height: 60px;
padding-left: 5px;
padding-right: 5px;
background: white;
display: flex;
align-items: center;
position: absolute;
cursor: pointer;
color: #d1d1d1;
top: 0px;
font-size: 1.6rem;
left: 0;
z-index: 5;
padding-left: 7px;
}
.right-arrow {
height: 60px;
padding-left: 5px;
padding-right: 5px;
background: white;
display: flex;
align-items: center;
position: absolute;
cursor: pointer;
color: #b1b1b1;
font-size: 1.6rem;
left: calc(100% - 88px);
}
}
#media screen and (max-width: 1088px) {
.main-container-top-menu {
overflow-x: auto;
overflow-y: hidden;
/* display: block; */
width: 100%;
white-space: nowrap !important;
}
}
#media screen and (max-width: 414px) {
.main-container {
padding-left: 0px;
padding-right: 0px;
}
}
.no-suite-title {
text-transform: uppercase;
font-size: 1.3em;
font-weight: 300;
position: absolute;
left: 10%;
top: 50%;
z-index: 1000;
}
Workink jsFiddle!
How can I make dropdown to fill the menuc without gaps?
Update
Text moved to the left:
To get the desired result, you need to do the following:
Remove padding-left: 20px and padding-right: 20px from the .inactive-border-bottom selector;
Add height: 100% to these selectors - .control and .select.is-fullwidth.
Need to register .full-height in your css, and write the rule height: 100%!important in it. !important is necessary because this rule overrides the height: 2.5em rule in the .select select.

A Section in My HTML is having a problem with its position

I have a site and it has 2 sections. the left section is a navigation bar with menus below.
The section next to it is the main section or where the website content must be placed. My problem is the right section is positioned a few pixels from the header. How can i fix this? I provided some image to let you see how the website should look like.
/*WRITTEN USING SASS*/
#side-menu{
margin-top: 25px;
.side-menu-bg {
width: max-content;
h3 {
position: absolute;
color: white;
padding: 0px 18px;
font-size: 27px;
}
img {
display: -webkit-box;
}
}
.side-nav-bar {
width: 210px;
position: unset;
margin-top: -3px;
display: inline-flex;
z-index: 1;
flex-direction: column;
overflow-x: hidden;
background-color: #ffffff;
a {
display: inherit;
color: #707070;
text-decoration: none;
font-size: 15px;
padding: 10px 18px;
position: relative;
border-bottom: 1px solid #e8e8e8;
}
.active-link{
color: #a40022;
border-bottom: 2px solid #8a001c;
}
}
.right-contents {
float: right;
.title h3 {
font-size: 38px;
}
.body-content {
background-color: #d3d3d3;
height: 1094px;
width: 738px;
}
}
}
<div class="wrapper"> <!--to make contents center-->
<div id="side-menu">
<div class="side-menu-bg">
<h3>KU μŠ€νƒ€νŠΈμ—…</h3>
<img src="images/bg/bg_03.png">
</div>
<div class="side-nav-bar">
인사말
μ°½μ—… λΉ„μ „
μ°½μ—… ν”„λ‘œμ„ΈμŠ€
μ°½μ—…λΆ€μ„œμ†Œκ°œ
μ°Ύμ•„μ˜€μ‹œλŠ” κΈΈ
</div>
<div class="right-contents">
<div class="title">
<h3>인사말</h3>
<div class="body-content">
sample text
</div>
</div>
</div>
</div>
</div>
Add margin: 0 to your h3 tag.. h3 has margin-to and margin-bottom by default. thanks
.right-contents {
float: right;
.title h3 {
font-size: 38px;
margin: 0; /*add this*/
}
.body-content {
background-color: #d3d3d3;
height: 1094px;
width: 738px;
}
<style>
/*WRITTEN USING SASS*/
#side-menu{
margin-top: 25px;
.side-menu-bg {
width: max-content;
h3 {
position: absolute;
color: white;
padding: 0px 18px;
font-size: 27px;
}
img {
display: -webkit-box;
}
}
.side-nav-bar {
width: 210px;
position: unset;
margin-top: -3px;
display: inline-flex;
z-index: 1;
flex-direction: column;
overflow-x: hidden;
background-color: #ffffff;
}
a {
display: inherit;
color: #707070;
text-decoration: none;
font-size: 15px;
padding: 10px 18px;
position: relative;
border-bottom: 1px solid #e8e8e8;
}
.active-link{
color: #a40022;
border-bottom: 2px solid #8a001c;
}
}
.right-contents {
width: 65%;
margin-top: -3px;
display: inline-flex;
.title h3 {
font-size: 38px;
}
.body-content {
background-color: #d3d3d3;
height: 1094px;
width: 738px;
}
</style>

Vertical Align images with Text

I would like to know how to align the image next to the text in my code.
Please disregard how messy it is. I was doing a project for school and I didn't know how to fix this issue I'm having.
The project isn't mandatory although it's for a competition to win a raspberry pi that I need for a future project involving bitcoins.
https://jsfiddle.net/kdn1x2hk/3/
<!DOCTYPE! html>
<html>
<head>
<style>
body,
html {
margin-top: -11px;
margin: 0;
height: 100%;
min-width: 1000px;
background-color: red;
}
.bg {
margin-left: 20%;
width: 60%;
background-color: grey;
border-left: thick solid black;
border-right: thick solid black;
}
.background {
background-image: url("images/background.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
min-height: 100%;
}
.banner {
width: 100%;
border-bottom: thick solid black;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
border-bottom: thick solid black;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none!important;
font-family: "Arial Black", Gadget, sans-serif;
}
li a:hover:not(.active) {
background-color: #111;
}
.active {
background-color: #FFD700;
color: black;
}
.header {
font-size: 80pt;
font-family: "Arial Black", Gadget, sans-serif;
color: black;
text-align: center;
min-width: 80pt;
}
.dotted_line {
border-top: 2px dashed black;
width: 70%;
}
.paragraph {
font-size: 15pt;
width: 500px;
margin-left: 0%;
color: black;
}
.sub_header {
text-align: center;
font-size: 50pt;
color: black;
}
.credit {
width: 560;
size: 20pt;
text-align: center;
font-style: italic;
}
.video {
width: 70%;
margin-left: 15%;
border: thick solid black;
}
.credit_link {
text-decoration: none;
}
#image {
width: 45%;
}
#text {
width: 45%;
float: left;
font-size: 15pt;
color: black;
padding-top: 20px;
-webkit-text-size-adjust: none;
-ms-text-size-adjust: none;
-moz-text-size-adjust: none;
text-size-adjust: none;
}
.format {
width: 90%;
margin-left: 10%;
}
</style>
</head>
<body>
</body>
</html>
Changes:
Moved the #text before the #image inside format class container and used display:flex instead of float:left on your #text container to also provide vertical alignment.
Added align-items:center on format class to vertically align both of its contents i.e text and image.
Updated fiddle : https://jsfiddle.net/sbakj4x0/
body,
html {
margin-top: -11px;
margin: 0;
height: 100%;
min-width: 1000px;
background-color: red;
}
.bg {
margin-left: 20%;
width: 60%;
background-color: grey;
border-left: thick solid black;
border-right: thick solid black;
}
.background {
background-image: url("images/background.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
min-height: 100%;
}
.banner {
width: 100%;
border-bottom: thick solid black;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
border-bottom: thick solid black;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none!important;
font-family: "Arial Black", Gadget, sans-serif;
}
li a:hover:not(.active) {
background-color: #111;
}
.active {
background-color: #FFD700;
color: black;
}
.header {
font-size: 80pt;
font-family: "Arial Black", Gadget, sans-serif;
color: black;
text-align: center;
min-width: 80pt;
}
.dotted_line {
border-top: 2px dashed black;
width: 70%;
}
.paragraph {
font-size: 15pt;
width: 500px;
margin-left: 0%;
color: black;
}
.sub_header {
text-align: center;
font-size: 50pt;
color: black;
}
.credit {
width: 560;
size: 20pt;
text-align: center;
font-style: italic;
}
.video {
width: 70%;
margin-left: 15%;
border: thick solid black;
}
.credit_link {
text-decoration: none;
}
#image {
width: 45%;
}
#text {
width: 45%;
font-size: 15pt;
color: black;
padding-top: 20px;
-webkit-text-size-adjust: none;
-ms-text-size-adjust: none;
-moz-text-size-adjust: none;
text-size-adjust: none;
}
.format {
width: 90%;
margin-left: 10%;
overflow: hidden;
align-items: center;
display: flex;
align-items: center;
}
<!DOCTYPE html>
<body>
<div class="background">
<div class="bg">
<img src="https://i.imgur.com/gsceMM5.png" class="banner">
<ul>
<li><a class="active" href="index.html">Home</a></li>
<li>Stats</li>
<li>History</li>
<li>Info</li>
<li>Contact</li>
</ul>
<p class="header"> WELCOME</p>
<hr class="dotted_line" />
<p class="sub_header">What is Bitcoin?</p>
<video class="video" poster="images/thumbnail.jpg" controls>
<source src="videos/info.mp4" type="video/mp4">
</video>
<p class="credit">
(Credit to <a class="credit_link" href="https://www.youtube.com/user/weusecoins">WeUseCoins</a> on youtube.com)
</p>
<div class="format">
<p id="text">
Bitcoin is a new currency that was created in 2009 by an unknown person using the alias Satoshi Nakamoto. Transactions are made with no middle men – meaning, no banks! Bitcoin can be used to book hotels on Expedia, shop for furniture on Overstock and
buy Xbox games. But much of the hype is about getting rich by trading it. The price of bitcoin skyrocketed into the thousands in 2017.
</p>
<img src="https://i.imgur.com/BGsKZms.png" id="image" />
</div>
</div>
</div>
</body>