Create img with vertical align middle in column of row in Bootstrap - html

body {
font-family: 'Ubuntu', sans-serif;
background: #0d0d0d;
}
body a {
color: #fff;
}
body a:hover {
color: #fff;
}
#media (min-width: 1500px) {
.container{
width: 1470px !important;
}
}
nav {
background: #1c1c1c !important;
margin-bottom: 50px;
}
.toper {
padding: 100px;
background: #071931;
color: #fff;
}
.main {
background: #121212;
border-radius: 2px;
margin-top: -60px;
color: #fff;
padding: 15px 15px;
}
.container-first {
background: #2a2a2a;
margin: 0px 0px 15px 0px;
padding: 5px;
}
.breadcrumb {
margin: 0px;
background: #2a2a2a;
}
.container-first-right {
padding-top: 2px;
}
#media screen and (max-width: 768px)
{
.container-first-right {
float: none !important;
}
}
.welcome {
background: #444;
border-radius: 3px;
padding: 0px !important;
margin-bottom: 15px;
}
.welcome-header
{
padding: 15px 20px 15px 20px;
background: #2d2d2d;
border-radius: 3px;
margin: 10px;
box-shadow: inset 0px 0px 15px 0px #000;
}
.welcome-text
{
padding: 10px;
margin: 10px;
color: #ccc;
}
.welcome-action {
padding: 15px 0px 15px 20px;
background: #4d4d4d;
color: #ccc;
letter-spacing: 5px;
border-radius: 3px;
}
.bluer {
padding: 15px;
background: #046092;
border-radius: 3px;
font-weight: 500;
}
.section-bluer
{
padding: 0px;
margin-top: 15px;
}
.section-first
{
background: #1c1c1c;
margin: 0px;
padding: 10px;
}
.section-picture
{
padding: 5px;
height: 100%;
text-align: center;
}
.section-picture > img
{
border: 1px solid #016d9b;
vertical-align: middle;
}
.section-this p
{
color: #ccc;
font-size: 12px;
}
.section-this h4 a
{
color: #87b8d7;
font-weight: 500;
}
<!DOCTYPE html>
<html lang="pl">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8"><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Ubuntu:400,500" rel="stylesheet">
</head>
<body>
<main class="container main">
<div class="container-fluid bluer">
Najnowszy news: #98 Tygodnik MPC News - O grach MMORPG słów kilka!
</div>
<div clas="container-fluid row">
<div class="col-sm-8 section-bluer">
<div class="bluer">
Projekty MPCforum.pl
</div>
<div class="row section-first">
<div class="col-sm-1 section-picture">
<img src="fb.png" />
</div>
<div class="col-sm-8 section-this">
<h4>League of Legends</h4>
<p>Ćwicz swój refleks, opanuj percepcję i zostań przywódcą grupy! Stań się prawdziwym bohaterem świata League of Legends i doskonal swoje umiejętności taktyczne.</p>
<hr>
Metin2 - Publikacje Serwerów, Metin2 - Publikacje Serwerów, Metin2 - Publikacje Serwerów,
</div>
<div class="col-sm-3 section-last-post">
asdasd
</div>
</div>
</div>
<div class="col-sm-4">
</div>
</div>
</div>
</main>
</body>
</html>
It is something like this:
And as you can see I want this image to have vertical align middle.
I tried to add it with css, tried setting this column height not 100% but 100px or more. Make this img display inline-block etc....
And nothing works good. And have no Idea what to do now with it and make this works.

If you want to keep your current HTML structure you could add the image as a pseudoelement and center it vertically. It's not a pretty solution, and you'll need to use media queries to undo this. Best to view the snippet full screen.
body {
font-family: 'Ubuntu', sans-serif;
background: #0d0d0d;
}
body a {
color: #fff;
}
body a:hover {
color: #fff;
}
#media (min-width: 1500px) {
.container {
width: 1470px !important;
}
}
nav {
background: #1c1c1c !important;
margin-bottom: 50px;
}
.toper {
padding: 100px;
background: #071931;
color: #fff;
}
.main {
background: #121212;
border-radius: 2px;
margin-top: -60px;
color: #fff;
padding: 15px 15px;
}
.container-first {
background: #2a2a2a;
margin: 0px 0px 15px 0px;
padding: 5px;
}
.breadcrumb {
margin: 0px;
background: #2a2a2a;
}
.container-first-right {
padding-top: 2px;
}
#media screen and (max-width: 768px) {
.container-first-right {
float: none !important;
}
}
.welcome {
background: #444;
border-radius: 3px;
padding: 0px !important;
margin-bottom: 15px;
}
.welcome-header {
padding: 15px 20px 15px 20px;
background: #2d2d2d;
border-radius: 3px;
margin: 10px;
box-shadow: inset 0px 0px 15px 0px #000;
}
.welcome-text {
padding: 10px;
margin: 10px;
color: #ccc;
}
.welcome-action {
padding: 15px 0px 15px 20px;
background: #4d4d4d;
color: #ccc;
letter-spacing: 5px;
border-radius: 3px;
}
.bluer {
padding: 15px;
background: #046092;
border-radius: 3px;
font-weight: 500;
}
.section-bluer {
padding: 0px;
margin-top: 15px;
}
.section-first {
background: #1c1c1c;
margin: 0px;
padding: 10px;
}
.section-picture {
padding: 5px;
height: 100%;
text-align: center;
}
.section-picture>img {
border: 1px solid #016d9b;
vertical-align: middle;
}
.section-this p {
color: #ccc;
font-size: 12px;
}
.section-this h4 a {
color: #87b8d7;
font-weight: 500;
}
.section-first {
position: relative;
}
.section-first::before {
position: absolute;
display: block !important;
width: 40px;
height: 40px;
content: url(https://placehold.it/40x40) !important;
top: 50%;
transform: translateY(-50%);
}
<!DOCTYPE html>
<html lang="pl">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Ubuntu:400,500" rel="stylesheet">
</head>
<body>
<main class="container main">
<div class="container-fluid bluer">
Najnowszy news: #98 Tygodnik MPC News - O grach MMORPG słów kilka!
</div>
<div clas="container-fluid row">
<div class="col-sm-8 section-bluer">
<div class="bluer">
Projekty MPCforum.pl
</div>
<div class="row section-first">
<div class="col-sm-1 section-picture">
</div>
<div class="col-sm-8 section-this">
<h4>League of Legends</h4>
<p>Ćwicz swój refleks, opanuj percepcję i zostań przywódcą grupy! Stań się prawdziwym bohaterem świata League of Legends i doskonal swoje umiejętności taktyczne.</p>
<hr>
Metin2 - Publikacje Serwerów, Metin2 - Publikacje Serwerów, Metin2 - Publikacje Serwerów,
</div>
<div class="col-sm-3 section-last-post">
asdasd
</div>
</div>
</div>
<div class="col-sm-4">
</div>
</div>
</div>
</main>
</body>
</html>

The column/div containing the image is currently only the height of the image because the div is floated, as ovokuro mentioned. To make it match the height of your other columns, you can first adjust the height of the column/div (col-sm-1) then manipulate the image's positioning inside it.
If a simple situation where all your rows will have a fixed height, you could try setting col-sm-1 to the needed row height (e.g. 100px) and then adjusting the image's position with margin/padding/etc. as needed.
If your rows will vary in height, here are a few approaches that have worked well:
HTML/CSS: Making two floating divs the same height
https://css-tricks.com/fluid-width-equal-height-columns/
Hope one of these works out!

Related

Website looks off when working on a smaller screen

I need my work done soon, but I don't have access to my bigger monitor. I assume the teacher also has a big monitor where he'll look at my work, so it shouldn't be a problem.
But my site only looks normal on 70% and I'm having a big headache trying to make it work so I have to work on 70%.
* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
}
header {
display: flex;
width: 50%;
height: 8vh;
margin: auto;
align-items: center;
}
.nav-links,
.search-container {
display: flex;
}
nav {
position: relative;
flex: 1;
}
.nav-links {
justify-content: space-evenly;
max-width: 300px;
list-style: none;
}
.nav-link {
color: #ffffff;
font-size: 18px;
text-decoration: none;
}
.search-container {
flex: 1;
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 0;
}
#justdance {
display: flex;
width: 50%;
margin: auto;
align-items: top;
}
.about {
background-color: #c4c4c4;
display: flex;
width: 50%;
height: 30vh;
margin: auto;
flex-direction: column;
align-items: flex-start;
}
.quote {
text-align: center;
display: block;
border-radius: 10px;
border-style: solid;
box-shadow: rgba(0, 0, 0, 0.42) 0px 2px 2px 0px;
width: 500px;
height: 30px;
margin: 20px auto 0 auto;
}
.description {
margin: 30px auto 0 auto;
text-align: justify;
width: 70%;
font-size: 13px;
}
.sideimage {
position: absolute;
right: 640px;
top: 390px;
}
.polygon {
position: absolute;
right: 960px;
bottom: 260px;
width: 0;
height: 0;
border-top-width: 82px;
border-top-style: solid;
border-top-color: transparent;
border-right-width: 90px;
border-right-style: solid;
border-right-color: #c4c4c4;
transform: rotate(-180deg);
}
.piirkonnad {
background-color: #222222;
display: flex;
width: 50%;
height: 29vh;
margin: auto;
flex-direction: column;
align-items: flex-start;
}
.piirkonnad p {
position: absolute;
left: 554px;
bottom: 270px;
font-family: Roboto;
font-style: italic;
font-weight: 300;
font-size: 20px;
line-height: 23px;
color: #FFFFFF;
}
.copyright p {
position: absolute;
right: 803px;
bottom: 24px;
font-family: Roboto;
font-style: normal;
font-weight: normal;
font-size: 13px;
line-height: 12px;
color: #FFFFFF;
}
.social {
position: absolute;
right: 550px;
bottom: -2px;
}
.fa {
padding: 15px;
font-size: 30px;
width: 50px;
text-align: center;
text-decoration: none;
margin: 5px 2px;
border-radius: 50%;
}
.fa-instagram {
background: #c4c4c4;
color: black;
}
.fa-twitter {
background: #c4c4c4;
color: black;
}
.fa-facebook {
background: #c4c4c4;
color: black;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
<title>Just Dance</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<style>
body {
background-color: #000000;
}
</style>
<body>
<header>
<nav>
<ul class="nav-links">
<li><a class="nav-link" href="#">Avaleht</a></li>
<li><a class="nav-link" href="#">Meist</a></li>
<li><a class="nav-link" href="#">Login</a></li>
</ul>
<div class="search-container">
<input type="text" placeholder="Otsing" name="search">
</div>
</nav>
</header>
<main>
<img src="header.jpg" alt="Just Dance" id="justdance" ;>
<div class="about">
<div class="quote">“Dance is the hidden language of the soul” - Marta Graham</div>
<div class="description">
<div class="text">
<p>Kunagi pole liiga hilja alustada. Just Dance veebilehelt leiad<br>
tantsukursusi üle Eesti.</p>
<br>
<p>Sulle sobiva kursuse leidmine on imelihtne - vali piirkond või<br>
tantsustiil ning sulle avaneb loetelu kursustest.</p>
<br>
<p>Ka tantsukaaslaste leidmine on imelihtne. Kirjuta sulle sobiva<br>
kursuse kommentaaridesse oma kaaslaseotsingust ning jää<br>
ootama vastust. Ehk leiad juba homme oma unelmate partneri?<br>
Kursuste kommenteerimiseks registreeru "Just Dance" kasutajaks.</p>
</div>
<div class="sideimage">
<img src="dancers.png" alt="Dancers" id="dancer" ;>
</div>
<div class="polygon"></div>
</div>
</main>
<section>
<div class="piirkonnad">
<p>Piirkonnad</p>
</div>
<div class="row1">
<img src="1.jpg" alt="Harjumaa" width="170" height="100">
</div>
</section>
<footer>
<div class="copyright">
<p>Just Dance © Noor Meister Kõik õigused kaitstud</p>
</div>
<div class="social">
</div>
</footer>
</body>
</html>
I've heard about responsive design already, but I can't figure it out. I'm not the greatest at coding and it was hard to achieve what I have so help is appreciated a ton.
Your code has some mistakes on it, you have ; on your img element and your style element should be in the head tag, and the reason why your website is not responsive is because you are using position:absolute, keep your website simple, or if you really want to still use position:absolute, then that div should be contained on another div but set it it to position:relative.
Anyways, I fixed it and now totally responsive, here it is:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
padding-top:20px;
}
header{
display:flex;
justify-content:space-evenly;
width: 50%;
margin: auto;
flex-wrap:wrap;
}
.nav-links{
display: flex;
}
.nav-links{
justify-content: space-evenly;
max-width: 300px;
list-style: none;
}
.nav-link{
color: #ffffff;
font-size: 18px;
padding:10px;
text-decoration: none;
}
#justdance {
display: flex;
width: 50%;
margin: auto;
align-items: top;
}
.about {
padding:10px;
background-color: #c4c4c4;
width: 50%;
margin: auto;
}
.search-container{
min-width:30px
}
.quote {
text-align: center;
display: block;
border-radius: 10px;
border-style: solid;
box-shadow: rgba(0, 0, 0, 0.42) 0px 2px 2px 0px;
padding:5px;
margin: 10px auto 0 auto;
}
.description {
margin: 30px auto 0 auto;
width: 70%;
font-size: 13px;
}
.polygon {
height: 0;
border-top-width: 82px;
border-top-style: solid;
border-top-color: transparent;
border-right-width: 90px;
border-right-style: solid;
border-right-color: #c4c4c4;
transform: rotate(-180deg);
}
.piirkonnad {
position:relative;
display:flex;
background-color: #222222;
display: flex;
width: 50%;
padding-top:30px;
height: 29vh;
margin: auto;
justify-content:space-evenly;
}
.piirkonnad p {
text-align:center;
font-family: Roboto;
font-style: italic;
font-weight: 300;
font-size: 20px;
line-height: 23px;
color: #FFFFFF;
}
footer{
margin-top:1em;
}
.copyright p {
text-align:center;
font-family: Roboto;
font-style: normal;
font-weight: normal;
font-size: 13px;
line-height: 12px;
color: #FFFFFF;
}
.social {
display:flex;
justify-content:center;
}
.fa {
padding: 15px;
font-size: 30px;
width: 50px;
text-align: center;
text-decoration: none;
margin: 5px 2px;
border-radius: 50%;
}
.fa-instagram {
background: #c4c4c4;
color: black;
}
.fa-twitter {
background: #c4c4c4;
color: black;
}
.fa-facebook {
background: #c4c4c4;
color: black;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
<title>Just Dance</title>
<link rel="stylesheet" href="./style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
background-color: #000000;
}
</style>
</head>
<body>
<header>
<nav>
<ul class="nav-links">
<li><a class="nav-link" href="#">Avaleht</a></li>
<li><a class="nav-link" href="#">Meist</a></li>
<li><a class="nav-link" href="#">Login</a></li>
</ul>
</nav>
<div class="search-container">
<input type="text" placeholder="Otsing" name="search">
</div>
</header>
<main>
<img src="header.jpg" alt="Just Dance" id="justdance">
<div class="about">
<div class="quote">“Dance is the hidden language of the soul” - Marta Graham</div>
<div class="description">
<div class="text">
<p>Kunagi pole liiga hilja alustada. Just Dance veebilehelt leiad<br>
tantsukursusi üle Eesti.</p>
<br>
<p>Sulle sobiva kursuse leidmine on imelihtne - vali piirkond või<br>
tantsustiil ning sulle avaneb loetelu kursustest.</p>
<br>
<p>Ka tantsukaaslaste leidmine on imelihtne. Kirjuta sulle sobiva<br>
kursuse kommentaaridesse oma kaaslaseotsingust ning jää<br>
ootama vastust. Ehk leiad juba homme oma unelmate partneri?<br>
Kursuste kommenteerimiseks registreeru "Just Dance" kasutajaks.</p>
</div>
</div>
</div>
<section>
<div class="piirkonnad">
<div class="polygon"></div>
<p>Piirkonnad</p>
<div class="sideimage">
<img src="dancers.png" alt="Dancers" id="dancer">
</div>
</div>
<div class="row1">
<img src="1.jpg" alt="Harjumaa" width="170" height="100">
</div>
</section>
</main>
<footer>
<div class="copyright">
<p>Just Dance © Noor Meister Kõik õigused kaitstud</p>
</div>
<div class="social">
</div>
</footer>
</body>
</html>
For make a website responsive you need to avoid px and use %, vw (viewport width) or vh (viewport height).
After in your css you need to declare #media only screen and (max-width: screenSizepx) and inside make the responsive layout for each screen.
Usually i make this with:
#media only screen and (max-width: 1000)
#media only screen and (max-width: 550px)
#media only screen and (max-width: 400px)

Why is there white space at the bottom of my web page when run in the browser?

When I run my code in the browser, I have this little line of white space at the bottom of the page. I’ve been trying different solutions but can’t seem to find one that works. Below is the home.html page. Maybe someone here can shed some light into the problem.
<html>
<head>
<meta charset="utf-8">
<meta name="keywords" content="cooper, scooper, dog, pop, pick, up>
<meta name="author" content="primarysnail">
<meta name="viewport" content="width=device-width">
<meta name="description" content="connecting clients in need of dog pick pick up srvice with scoopers who will come to the client and scoop the poop">
<title>CoopersScoopers || Home</title>
<link rel="stylesheet" type="text/css" href="../CSS/style.css">
</head>
<body>
<header> <!-- company name top left; nav bar top right -->
<div class="container">
<div class="branding">
<h1><span>cooper</span>Scoopers</h1>
</div>
<nav>
<ul>
<li class="current">Home</li>
<li>Contact Us</li>
<li>Find a Scooper</li>
</ul>
</nav>
</div>
</header>
<section class="showcase"> <!-- showcase section; button to find scooper (./find.html) -->
<div class="container">
<h1>Leave the</h1>
<br>
<h1>Poo to the</h1>
<br>
<h1>Professionals.</h1>
<button type="button">Connect With a Scooper Today</button>
</div>
</section>
<section class="info-bar"> <!-- info bar; shows scooper process in 3 sections -->
<div class="container">
<div class="box">
<img src="../images/poop.jpg">
<h3>Connect With a Local Scooper</h3>
</div>
<div class="box">
<img src="../images/location.jpg">
<h3>Mark Your Poo</h3>
</div>
<div class="box">
<img src="../images/calendar.jpg">
<h3>Schedule Future Scoops</h3>
</div>
</div>
</section>
<section class="testimonials">
<div class="container">
<h1>Come Experience the Joy of a Poop-Free Life.</h1>
</section>
</body>
<footer>
<p>Copyright © primarySnail//</p>
</footer>
</html>
Here is the linked style.css file:
body {
font-family: Tahoma, Verdana, Segoe;
font-size: 15px;
line-height: 1.5;
padding: 0;
margin: 0;
background-color: #ffffff;
}
/* global */
.container {
margin: auto;
width: 80%;
overflow: hidden;
}
ul {
margin: 0;
padding: 0;
}
button {
height: 50px;
background-color: #ffff00;
opacity: 0.8;
border: none;
padding-right: 30px;
padding-left: 30px;
float: left;
margin-top: -20px;
float: right;
}
button a {
text-decoration: none;
color: #4b0082;
font-weight: bold;
font-size: 25px;
}
/* header */
header {
padding-top: 30px;
min-height: 70px;
border-bottom: 4px solid #f0e68c;
background-color: #ffffff;
color: #8a2be2;
font-size: 10px;
}
header a {
text-decoration: none;
}
nav a {
color: #8a2be2;
text-decoration: none;
text-transform: uppercase;
font-size: 10px;
}
header span {
font-size: 15px;
}
header li {
float: left;
display: inline;
padding: 0px 10px 0px 10px;
}
.branding {
float: left;
}
.branding h1 {
margin: 0;
padding: 0px 10px 0px 10px;
border: 4px solid #8a2be2;
}
header nav {
float: right;
margin-top: 10px;
}
header .current {
border: 1px solid #999;
background-color: #8a2be2;
border-collapse: collapse;
}
header .current a {
color: #ffffff;
font-weight: bold;
}
/* showcase */
.showcase {
background-color: #8a2be2;
color: #ffffff;
text-align: left;
min-height: 200px;
border-bottom: 4px solid #f0e68c;
}
.showcase h1 {
font-size: 55px;
margin-top: 0;
margin-bottom: 0;
padding: 0px;
display: inline-block;
}
/* info bar*/
.info-bar {
margin-top: 20px;
border-bottom: 4px solid #f0e68c;
}
.info-bar .box {
float: left;
width: 30%;
padding: 10px;
text-align: center;
}
.info-bar .box img {
width: 90px;
height: 90px;
}
/* testimonials */
.testimonials {
background-color: #8a2be2;
color: #ffffff;
}
.testimonials h1 {
text-align: center;
}
/* footer */
footer {
background-color: #f0e68c;
margin-top: 0px;
padding: 5px;
text-align: center;
color: black;
opacity: 0.6;
}
I cannot for the life of me figure out why that little line of white space is in there at the very bottom. screenshot
Yes, I have observed white space showing in the bottom. It is because the elements inside body tag is not occupying the full available body size.
elemets heights are as
body- 722
header- 104
.showcase- 251enter code here
.info-bar- 201
.testimonials- ~71
footer- ~62
the white space in the botom is remaining area of viewport. If you make the browser smaller the white space will go away.
To fix this proble you can use below css to the body.
body {
font-family: Tahoma, Verdana, Segoe;
font-size: 15px;
line-height: 1.5;
padding: 0;
margin: 0;
background-color: #ffffff;
/* Add below lines*/
display: flex;
flex-direction: column;
align-items: stretch;
}

Button in the footer is a different size on different page lengths

I am creating a footer used in a layout on every page. The footer has two div tags that look like buttons. The problem i am running into is the button are smaller on some screens and larger on others. It looks like if the content of the page does not take the full height of the screen, the footer buttons are the correct size. If the content of the page is over the full height of the screen the buttons are smaller. I believe they should stay the same height.
Here is some screenshots:
.footer {
bottom: 0;
background-color: #EEEEEE;
width: 100%;
height: 100%;
}
.footer-container {
margin: 0 auto;
max-width: 1200px;
padding-bottom: 15px;
border-bottom: 1px solid #cccccc;
}
.footer-list {
display: flex;
list-style-type: none;
justify-content: flex-end;
margin: 0;
padding-top: 15px;
color: #444444;
}
.footer-left {
margin-right: auto;
padding-top: 15px;
padding-left: 10px;
}
.footer-item {
font-size: .9rem;
margin-right: 1rem;
padding-top: 9px;
}
.footer-button {
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 0.9rem;
margin: 2px 2px;
cursor: pointer;
border-radius: 4px;
}
.footer-help-center {
background-color: #0B5C8E;
border: 2px solid #0B5C8E;
color: white;
padding: 5px 30px 5px 30px;
}
<div class="footer">
<div class="footer-container">
<div class="footer-list">
<li class="footer-left">
<img src="~/content/images/logo-icon.png">
</li>
<li class="footer-item">
<div class="footer-button footer-help-center">Help Center</div>
</li>
<li class="footer-item">
<a href="#Url.RouteUrl(" ContactUs ")">
<div class="footer-button footer-contact-us">Contact Us</div>
</a>
</li>
</div>
</div>
</div>
Relative length units specify a length relative to another length property. Relative length units scales better between different rendering mediums.
rem: Relative to font-size of the root element
CSS Units
From this I can say when you are using rem which could be depended on root element font size or browser font size. That will make your website renders bit different between browsers.
For one you are missing the element <ul> wrapping your <li>. After that I would suggest to clean up elements that don't need to be there, take a look at my example. Like you don't need to have a div inside the <a> element.
.footer {
bottom: 0;
background-color: #EEEEEE;
width: 100%;
height: 100%;
}
.footer-container {
margin: 0 auto;
max-width: 1200px;
padding-bottom: 15px;
border-bottom: 1px solid #cccccc;
}
.footer-list {
display: flex;
list-style-type: none;
justify-content: flex-end;
margin: 0;
padding-top: 15px;
color: #444444;
}
.footer-left {
margin-right: auto;
padding-top: 15px;
padding-left: 10px;
}
.footer-item {
font-size: .9rem;
margin-right: 1rem;
padding-top: 9px;
}
.footer-button {
text-align: center;
text-decoration: none;
font-size: 0.9rem;
margin: 2px 2px;
cursor: pointer;
border-radius: 4px;
}
.footer-help-center {
background-color: #0B5C8E;
border: 2px solid #0B5C8E;
color: white;
padding: 5px 30px 5px 30px;
}
.footer-contact-us {
background-color: deepskyblue;
border: 2px solid #0B5C8E;
color: white;
padding: 5px 30px 5px 30px;
}
<div class="footer">
<div class="footer-container">
<ul class="footer-list">
<li class="footer-left">
<img src="~/content/images/logo-icon.png">
</li>
<li class="footer-item">
<a class="footer-button footer-help-center">Help Center</a>
</li>
<li class="footer-item">
<a href="#Url.RouteUrl(" ContactUs ")" class="footer-button footer-contact-us">
Contact Us
</a>
</li>
</ul>
</div>
</div>
I tried playing around a bit but can't seem to replicate exactly what you are seeing other than the text wrapping when the window gets narrow. The css for footer-contact-us is missing but I assume it's about the same as footer-help-center.
If you want the buttons to always be the same height, why not just tell them to be?
.footer-button {
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 0.9rem;
margin: 2px 2px;
cursor: pointer;
border-radius: 4px;
height:20px;
line-height:20px;
}
You can use this code
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Hello, world!</title>
<style type="text/css">
body {
margin: 0;
}
.footer {
bottom: 0;
background-color: #EEEEEE;
width: 100%;
height: 100%;
}
.footer-container {
margin: 0 auto;
max-width: 1200px;
padding-bottom: 15px;
border-bottom: 1px solid #cccccc;
}
.footer-list {
display: flex;
list-style-type: none;
justify-content: flex-end;
margin: 0;
padding-top: 15px;
color: #444444;
}
.footer-left {
margin-right: auto;
padding-top: 5px;
padding-left: 10px;
}
.footer-item {
margin-right: 1rem;
}
.footer-button {
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 0.9rem;
margin: 2px 2px;
cursor: pointer;
border-radius: 4px;
}
.footer-help-center.success {
background-color: #0B5C8E;
border: 2px solid #0B5C8E;
color: white !important;
padding: 5px 30px 5px 30px;
font-size: 14px;
cursor: pointer;
}
.footer-contact-us.info {
background-color: #33691e;
border: 2px solid #33691e;
color: white !important;
padding: 5px 30px 5px 30px;
font-size: 14px;
cursor: pointer;
outline: none;
box-shadow: none;
text-decoration: none;
}
</style>
</head>
<body>
<div class="footer">
<div class="footer-container">
<div class="footer-list">
<li class="footer-left">
<img src="~/content/images/logo-icon.png">
</li>
<li class="footer-item">
<a class="btn success footer-button footer-help-center">Help Center</a>
</li>
<li class="footer-item">
<a class="btn info footer-button footer-contact-us" href="#Url.RouteUrl(" ContactUs ")">Contact Us</a>
</li>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>

align content to right in css inside div?

How do I align <span id="milliseconds">00</span> to right?
Please see working code below:
#font-face {
font-family: "Digi";
src: url("fonts/ds-digib.ttf");
}
body {
font-family: Arial;
font-size: 80px;
font-weight: bold;
padding: 40px 0;
}
#container {
display: flex;
flex-direction: row;
justify-content: space-around;
}
#splits {
font-size: 40px;
padding: 0px;
font-weight: normal;
}
#clock {
border: 2px solid #000;
border-radius: 20px;
box-sizing: border-box;
height: 250px;
margin: 0 auto;
padding: 18px 0;
width: 245px;
}
#sphere {
border: 2px solid #000;
border-radius: 20px;
box-sizing: border-box;
font-family: "Digi";
font-size: 80px;
height: 210px;
margin: 0 auto;
padding: 35px 0 0 5px;
position: relative;
width: 220px;
}
#digits {
display: flex;
flex-direction: column;
}
#digits-milliseconds {
font-size: 35px;
}
.leash {
background: rgb(204, 84, 87);
border: 2px solid rgb(134, 59, 61);
height: 50px;
margin: 0 auto;
width: 120px;
}
.leash-top {
border-bottom: 0;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.leash-bottom {
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
border-top: 0;
height: 270px;
padding-top: 50px;
}
.hole {
background: #fff;
border: 2px solid rgb(134, 59, 61);
border-radius: 100%;
height: 20px;
margin: 0 auto 50px;
width: 20px;
}
.number {
display: inline-block;
width: 16px;
margin-right: 8px;
}
.btn {
border: 0;
border-radius: 100%;
bottom: 10px;
color: #fff;
cursor: pointer;
height: 50px;
outline: 0;
position: absolute;
width: 50px;
}
.btn.start,
.btn.stop {
left: 10px;
}
.btn.reset,
.btn.split {
right: 10px;
}
.btn.start {
background: #5fca5f;
}
.btn.stop {
background: #f14949;
}
.btn.reset {
background: #908e8e;
}
.btn.split {
background: #0851ab;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Chronometer</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div id="container">
<div id="splits">
<strong>Splits</strong>
<ol id="split-times">
</ol>
</div>
<div class="watch">
<div class="leash leash-top"></div>
<section id="clock">
<div id="sphere">
<div id="digits">
<div>
<span id="minDec" class="number">0</span>
<span id="minCen" class="number">0</span>
<span>:</span>
<span id="secDec" class="number">0</span>
<span id="secCen" class="number">0</span>
</div>
<div id="digits-milliseconds">
<span id="milliseconds">00</span>
</div>
</div>
<button id="btnLeft" class="btn start">START</button>
<button id="btnRight" class="btn reset">RESET</button>
</div>
</section>
<div class="leash leash-bottom">
<div class="hole"></div>
<div class="hole"></div>
<div class="hole"></div>
</div>
</div>
</div>
<script src="chronometer.js" type="text/javascript"></script>
<script src="main.js" type="text/javascript"></script>
</body>
</html>
#milliseconds{
display: block;
text-align: right;
}
<span> in inline element and it's not supposed to be aligned.
Just align parent div.
I can't see the wider picture, but why not to place span with miliseconds along with other spans? What is the purpose of the stracture you wrote? Is it only about font-size? And why miliseconds are not supposed to be in flex?
Just do this :
#digits-milliseconds {
text-align: right;
}

Bootstrap - row in row that goes beyond it a bit

body {
font-family: 'Ubuntu', sans-serif;
background: #0d0d0d;
}
body a {
color: #fff;
}
body a:hover {
color: #fff;
}
#media (min-width: 1500px) {
.container {
width: 1470px !important;
}
}
nav {
background: #1c1c1c !important;
margin-bottom: 50px;
}
.toper {
padding: 100px;
background: #071931;
color: #fff;
}
.main {
background: #121212;
border-radius: 2px;
margin-top: -60px;
color: #fff;
padding: 15px 15px;
}
.container-first {
background: #2a2a2a;
margin: 0px 0px 15px 0px;
padding: 5px;
}
.breadcrumb {
margin: 0px;
background: #2a2a2a;
}
.container-first-right {
padding-top: 2px;
}
#media screen and (max-width: 768px) {
.container-first-right {
float: none !important;
}
}
.welcome {
background: #444;
border-radius: 3px;
padding: 0px !important;
margin-bottom: 15px;
}
.welcome-header {
padding: 15px 20px 15px 20px;
background: #2d2d2d;
border-radius: 3px;
margin: 10px;
box-shadow: inset 0px 0px 15px 0px #000;
}
.welcome-text {
padding: 10px;
margin: 10px;
color: #ccc;
}
.welcome-action {
padding: 15px 0px 15px 20px;
background: #4d4d4d;
color: #ccc;
letter-spacing: 5px;
border-radius: 3px;
}
.bluer {
padding: 15px;
background: #046092;
border-radius: 3px;
font-weight: 500;
}
.section-bluer {
padding: 0px;
margin-top: 15px;
}
.section-first {
background: #1c1c1c;
}
.section-picture {
vertical-align: middle;
padding: 5px;
}
.section-picture>img {
border: 1px solid #016d9b;
}
<!DOCTYPE html>
<html lang="pl">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Ubuntu:400,500" rel="stylesheet">
</head>
<body>
<main class="container main">
<div class="container-fluid bluer">
Najnowszy news: #98 Tygodnik MPC News - O grach MMORPG słów kilka!
</div>
<div clas="container-fluid row">
<div class="col-sm-8 section-bluer">
<div class="bluer">
Projekty Firaszka
</div>
<div class="row section-first">
<div class="col-sm-1 section-picture">
<img src="fb.png" />
</div>
<div class="col-sm-8 section-this">
asdasdas
</div>
<div class="col-sm-3 section-last-post">
asdasd
</div>
</div>
</div>
<div class="col-sm-4">
</div>
</div>
</main>
</body>
</html>
As you can see
This is the problem.
Row in row and row section-first" goes a little bit beyong previous row
Tried many things but completly no Idea how to fix it.
It's problem with the width of this rows that doesn't fit previous row.
Bootstrap class .row has margin-left & margin-right of -15px.
You need to compensate this by removing margin-left & margin-right. Like this:
.section-first {
margin: 0;
}
or
.section-first {
margin-left: 0;
margin-right: 0;
}
Plz correct your bootstrap html structure like :
container > row > col--
or
container-fluid > row-fluid > col--
you put "row" with "container" its not correct format you must create like given structure :-
<div class="container">
<div class="row">
<div class="col-md-5"></div>
</div>
</div>
your html code is here
enter link description here
Set .section-first margin to 0......simple :)
.section-first {
margin: 0;
}