:root colors throwing errors in css - html

I have this CSS which reads and renders fine in VS Code's preview, but when I add it to Hostinger (where I'm hosting the site), I get a plethora of errors and it defaults back to my sites old CSS.
The errors all relate to the colors defined at root, which look correct to me so I'm not sure where I went wrong.
Some of the errors were:
:root Rule is empty
--background-color: rgb(13, 1, 14); Expected RBRACE at line 3, col 5
Any idea why it works in VS Code Preview, but not on my public site?
:root
{
--background-color: rgb(13, 1, 14);
--border-color: rgba(255, 255, 255, 0.13);
}
body {
background-color: var(--background-color);
display: flex;
flex-wrap: wrap;
height: 100vh;
margin: 0px;
overflow: hidden;
}
main {
flex-grow: 1;
}
main > article {
display: grid;
height: 100vh;
grid-template-columns: 2fr 1fr;
grid-template-rows: 2fr 1fr;
}
main > article > .article-section {
display: flex;
flex-direction: column;
justify-content: center;
align-items: stretch;
padding: 3rem 2rem;
}
.article-image-section {
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
.article-image-section img {
flex-shrink: 0;
min-width: 100%;
min-height: 100%;
}
main > article > .article-description-section,
main > article > .article-nav-section {
border-left: 1px solid var(--border-color);
}
main > article > .article-title-section,
main > article > .article-nav-section {
border-top: 1px solid var(--border-color);
}
nav {
display: flex;
width: 100%;
height: 15%;
border-bottom: 1px solid var(--border-color);
}
nav > .nav-section {
padding: 3rem 2rem;
display: flex;
gap: 1rem;
border-left: 1px solid var(--border-color);
align-items: center;
justify-content: center;
}
#nav-logo-section {
justify-content: flex-start;
flex-basis: calc(100% / 3);
}
#nav-logo-section > a > i {
font-size: 2.5rem;
}
#nav-link-section {
flex-basis: calc(100% / 3);
gap: 6rem;
}
#nav-social-section {
flex-basis: 1;
gap: 3rem;
}
#nav-contact-section {
flex-basis: 1;
}
* {
box-sizing: border-box;
}
h1, h2, h3, a, p, span {
font-family: "Rubik", sans-serif;
font-weight: 400;
color: white;
}
a {
text-decoration: none;
}

Related

React application shrinking on iPhone

So when testing in Chrome, I used a Window Resizer to check the viewport sizes and everything looked amazing. After deployment, I ended up getting this:
The application is ReactJS and is hosted using Nginx on an Ubuntu server (not that that should matter).
styles.css
.header-text {
font-size: 212px !important;
color: white;
line-height: 0.8 !important;
}
.subheader-text {
line-height: 1;
font-size: 44px !important;
}
.content-boxes {
display: flex;
flex-direction: column;
position: relative;
}
.content-box {
align-self: center;
width: 400px;
height: 400px;
border-radius: 32px;
background-color: #27285C;
display: flex;
flex-direction: column;
justify-content: center;
margin-bottom: 50px;
}
.content-box-header {
font-size: 72px !important;
text-align: center;
}
.content-box-container {
grid-area: content-box-container;
width: 400px;
height: 400px;
border-radius: 32px;
background-color: #27285C;
display: flex;
flex-direction: column;
justify-content: center;
margin-bottom: 50px;
margin-left: 250px;
justify-self: center;
}
.content-box-description {
grid-area: content-box-description;
justify-self: left;
}
.fullscreen-content {
display: flex;
flex-direction: column;
}
#media(max-width: 1200px) {
.header-text {
font-size: 144px !important;
}
.subheader-text {
font-size: 44px !important;
}
.fullscreen-content {
margin-top: -20px !important;
}
.content-box {
width: 200px;
height: 200px;
}
.content-boxes-container {
display: flex !important;
flex-direction: column !important;
justify-content: center;
padding: 15px;
margin-bottom: 15px;
}
.content-box-container {
align-self: center;
margin-left: 0px;
}
.content-box-description {
max-width: 80%;
color: #27285C;
align-self: center;
justify-self: left;
margin-top: -15px;
}
.cards-container {
display: flex;
justify-content: center;
flex-direction: column !important;
margin: 0px !important;
z-index: 1;
}
.image-card {
margin-right: 0px !important;
}
}
#media(min-width: 1201px) {
.header-text {
font-size: 212px !important;
}
.fullscreen-content {
margin-top: -350px !important;
overflow-y: hidden;
}
.content-boxes-container {
display: grid;
grid-template-columns: 0.9fr 0.3fr 1.8fr;
grid-template-rows: 1fr;
gap: 0px 0px;
grid-auto-flow: row;
grid-template-areas:
"content-box-container content-box-container content-box-description"
"content-box-container content-box-container content-box-description";
align-items: center;
margin-left: 200px;
}
.content-box-description {
max-width:60%;
color: #27285C;
margin-top: -50px !important;
}
.about-section {
width: 60% !important;
text-indent: 64px;
}
}
.cards-container {
display: flex;
justify-content: center;
flex-direction: row;
margin: 15px;
z-index: 1;
}
.image-card {
align-self: center;
width: 532px;
height: 832px;
background-color: white;
border-radius: 32px;
margin-bottom: 15px;
margin-right: 45px;
}
.cards-container .picture-card {
align-self: center;
}
.about-section {
width: 90%;
display: flex;
flex-direction: column;
align-self: center;
margin: 45px;
}
#font-face {
font-family: 'JockeyOne-Regular';
src: local('JockeyOne-Regular'), url('../layouts/fonts/JockeyOne-Regular.ttf') format('truetype');
/* other formats include: 'woff2', 'truetype, 'opentype',
'embedded-opentype', and 'svg' */
}
Any help would be appreciated! Thanks.

Alignment of text in CSS

I am trying to make a list with perfect alignment.
I have entered three items in the list but my list of with grey back ground is not appearing as same alignment as in the below picture.
My box width is changing according to the size of the font. I am providing both image in perfect same alignment and my image with two list item with not same width of grey background.
Below is the my css code:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 22px;
}
body {
min-height: 100vh;
font-family: 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.App {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
width: 100%;
max-width: 500px;
border: 1px solid mediumblue;
margin: auto;
}
header {
width: 100%;
padding: 0 0.25em;
background-color: mediumblue;
color: aliceblue;
display: flex;
justify-content: space-between;
align-items: center;
}
main {
width: 100%;
display: flex;
flex-direction: column;
flex-grow: 1;
justify-content: center;
align-items: center;
overflow-y: auto;
}
footer {
width: 100%;
padding: 0.25em;
background-color: mediumblue;
color: aliceblue;
display: grid;
place-content: center;
}
ul {
width: 100%;
list-style: none;
padding: 0 0.25rem 0.25rem;
}
ul li::before {
content: "\200B";
}
.item {
display: flex;
justify-content: flex-start;
align-items: center;
padding: 0.5rem 0 0.5rem 0.5rem;
margin: 0.25rem 0;
background-color: #eee;
}
.item: first-child {
margin: 0;
}
.item input[type="checkbox"] {
text-align: center;
width: 2.5rem;
width: 48px;
min-width: 48px;
height: 2.5rem;
height: 48px;
min-height: 48px;
cursor: pointer;
margin-right: 0.5rem;
}
.item input[type="checkbox"]:focus + label {
text-decoration: underline;
}
.item > label {
font-size: 0.75rem;
flex-grow: 1;
}
.item svg {
width: 48px;
min-width: 48px;
height: 36px;
font-size: 1rem;
color: steelblue;
cursor: pointer;
}
.item svg:focus,
.item svg:hover {
color: red;
outline: none;
}
Please guide me where I am doing mistake and why my grey background boxes are not same width as the below image.

how to adjust padding in html/css?

I want to give padding on image to close to the remaining section but nothing works for me.
I am trying:
float-right or padding-right:250px; // but nothing happent and also it will spoil my mobile view also.
Kindly check what I am doing:
.fontProfile {
font-family: "Open Sans", Arial, sans-serif;
/* min-height: 100vh;
background-color: #fafafa;
color: #262626;
padding-bottom: 3rem; */
}
.imgProfile {
display: block;
}
.containerProfile {
max-width: 93.5rem;
margin: 0 auto;
padding: 0 2rem;
}
.btnProfileIn {
display: inline-block;
font: inherit;
background: none;
border: none;
color: inherit;
padding: 0;
cursor: pointer;
}
.btnProfileIn:focus {
outline: 0.5rem auto #4d90fe;
}
/* Profile Section */
.profile {
padding: 5rem 0;
}
.profile::after {
content: "";
display: block;
clear: both;
}
.profile-image {
float: left;
width: calc(33.333% - 1rem);
display: flex;
justify-content: center;
align-items: center;
margin-right: 3rem;
}
.imgProfile {
border-radius: 50%;
}
.profile-user-settings,
.profile-stats,
.profile-bio {
float: left;
width: calc(66.666% - 2rem);
}
.profile-user-settings {
margin-top: 1.1rem;
}
.profile-user-name {
display: inline-block;
font-size: 3.2rem;
font-weight: 300;
}
.profile-edit-btn {
font-size: 1.4rem;
line-height: 1.8;
border: 0.1rem solid #dbdbdb;
border-radius: 0.3rem;
padding: 0 2.4rem;
margin-left: 2rem;
}
.profile-settings-btn {
font-size: 2rem;
margin-left: 1rem;
}
.profile-stats {
margin-top: 2.3rem;
}
.profile-stats li {
display: inline-block;
font-size: 1.6rem;
line-height: 1.5;
margin-right: 4rem;
cursor: pointer;
}
.profile-stats li:last-of-type {
margin-right: 0;
}
.profile-bio {
font-size: 1.6rem;
font-weight: 400;
line-height: 1.5;
margin-top: 2.3rem;
}
.profile-real-name,
.profile-stat-count,
.profile-edit-btn {
font-weight: 600;
}
/* Media Query */
#media screen and (max-width: 40rem) {
.profile {
display: flex;
flex-wrap: wrap;
padding: 4rem 0;
}
.profile::after {
display: none;
}
.profile-image,
.profile-user-settings,
.profile-bio,
.profile-stats {
float: none;
width: auto;
}
.profile-image {
width: 3.7rem;
}
.profile-user-settings {
flex-basis: calc(100% - 10.7rem);
display: flex;
flex-wrap: wrap;
margin-top: 1rem;
}
.profile-user-name {
font-size: 2.2rem;
}
.profile-edit-btn {
order: 1;
padding: 0;
text-align: center;
margin-top: 1rem;
}
.profile-edit-btn {
margin-left: 0;
}
.profile-bio {
font-size: 1.4rem;
margin-top: 1.5rem;
}
.profile-edit-btn,
.profile-bio,
.profile-stats {
flex-basis: 100%;
}
.profile-stats {
order: 1;
margin-top: 1.5rem;
}
.profile-stats ul {
display: flex;
text-align: center;
padding: 1.2rem 0;
border-top: 0.1rem solid #dadada;
border-bottom: 0.1rem solid #dadada;
}
.profile-stats li {
font-size: 1.4rem;
flex: 1;
margin: 0;
}
.profile-stat-count {
display: block;
}
}
#supports (display: grid) {
.profile {
display: grid;
grid-template-columns: 1fr 2fr;
grid-template-rows: repeat(3, auto);
grid-column-gap: 3rem;
align-items: center;
}
.profile-image {
grid-row: 1 / -1;
}
.profile-image,
.profile-user-settings,
.profile-stats,
.profile-bio {
width: auto;
margin: 0;
}
#media (max-width: 40rem) {
.profile {
grid-template-columns: auto 1fr;
grid-row-gap: 1.5rem;
}
.profile-image {
grid-row: 1 / 2;
}
.profile-user-settings {
display: grid;
grid-template-columns: auto 1fr;
grid-gap: 1rem;
}
.profile-edit-btn,
.profile-stats,
.profile-bio {
grid-column: 1 / -1;
}
.profile-user-settings,
.profile-edit-btn,
.profile-settings-btn,
.profile-bio,
.profile-stats {
margin: 0;
}
}
}
<header>
<div class="container containerProfile">
<div class="profile">
<div class="profile-image">
<img class="imgProfile" src="https://images.unsplash.com/photo-1513721032312-6a18a42c8763?w=152&h=152&fit=crop&crop=faces" alt="">
</div>
<div class="profile-user-settings">
<h1 class="profile-user-name fontProfile">janedoe_</h1>
<button class="btnProfileIn profile-edit-btn">Edit Profile</button>
<button class="btnProfileIn profile-settings-btn" aria-label="profile settings"><i class="fa fa-cog" aria-hidden="true"></i></button>
</div>
<div class="profile-stats">
<ul>
<li><span class="profile-stat-count">164</span> posts</li>
<li><span class="profile-stat-count">188</span> followers</li>
<li><span class="profile-stat-count">206</span> following</li>
</ul>
</div>
<div class="profile-bio">
<!-- <p><span class="profile-real-name">Jane Doe</span></p> -->
</div>
</div>
<!-- End of profile section -->
</div>
<!-- End of container -->
</header>
I am having so much gap between Image and name. I want that div come close to the remaining part.
This is the problem - The gap
Any idea or suggestions would be welcome.
try on your css part
.imgProfile {
padding-right:250px }
Instead of adding padding to the profile-image what you can do is to try to make the remaining part come close to the image div and for this you can do this:
.profile-user-settings {
width: auto;
margin: 0px;
margin-right: -35px;
}
You can use flex for the image div and justify the content to the end.
.imgProfile {
display: flex;
justify-content: flex-end;
}
If you include margin-left:200px(or whatever you want), you can close the pic to the remaining section.Like this:
.imgProfile { display: block; margin-left: 200px; }
in this part of the
css
`#supports (display: grid){ .profile {
display: grid;
grid-template-columns: auto 1fr;
grid-template-rows: repeat(3, auto);
grid-column-gap: 3rem;
align-items: center;}`
change like i did grid-template-columns:1fr 2fr; to auto 1fr ; and you can remove grid-column-gap

How do I fix my CSS which works fine on Edge but doesn't on IE

I'm currently working on a small webpage with a bunch of buttons with links attached to them. The webpage displays perfectly fine on Edge but I'm not sure how to fix it to make it display fine on IE. Currently the buttons and the navbar are way too big and overlapping each other.
.header img {
float: left;
width: 100px;
height: 100px;
}
.header h1 {
position: relative;
top: 18px;
left: 10px;
font-size: 300%;
}
body {
background-color: lightblue;
}
.container {
display: grid;
}
.nav-bar {
display: grid;
grid-template-columns: 16.6% 16.6% 16.6% 16.6% 16.6% 16.6%;
justify-content: space-around;
color: white;
background-color: black;
height: 40px;
align-items: center;
font-size: 20px;
}
.nav-item {
text-align: center;
}
.buttons {
display: grid;
grid-template-columns: 16.6% 16.6% 16.6% 16.6% 16.6% 16.6%;
justify-content: space-around;
}
.button-group {
display: flex;
flex-direction: column;
}
button {
border-radius: 12px;
background-color: gray;
color: white;
border: none;
margin: 5px;
height: 50px;
font-size: 20px;
cursor: pointer;
}
button:hover{
background-color: #4CAF50;
color: white;
}
.generaldocs{
margin-left: 50px;
margin-top: 10px;
}
.technews{
margin-left: 90px;
margin-top: 10px;
}
.nav-item a{
color: white;
text-decoration: none;
}
.header a{
text-decoration: none;
color: black;
}
Try this code, IE and a few old browsers required prefixes to run code correctly.
.header img {
float: left;
width: 100px;
height: 100px;
}
.header h1 {
position: relative;
top: 18px;
left: 10px;
font-size: 300%;
}
body {
background-color: lightblue;
}
.container {
display: grid;
}
.nav-bar {
display: grid;
grid-template-columns: 16.6% 16.6% 16.6% 16.6% 16.6% 16.6%;
-ms-flex-pack: distribute;
justify-content: space-around;
color: white;
background-color: black;
height: 40px;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
font-size: 20px;
}
.nav-item {
text-align: center;
}
.buttons {
display: grid;
grid-template-columns: 16.6% 16.6% 16.6% 16.6% 16.6% 16.6%;
-ms-flex-pack: distribute;
justify-content: space-around;
}
.button-group {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
}
button {
border-radius: 12px;
background-color: gray;
color: white;
border: none;
margin: 5px;
height: 50px;
font-size: 20px;
cursor: pointer;
}
button:hover{
background-color: #4CAF50;
color: white;
}
.generaldocs{
margin-left: 50px;
margin-top: 10px;
}
.technews{
margin-left: 90px;
margin-top: 10px;
}
.nav-item a{
color: white;
text-decoration: none;
}
.header a{
text-decoration: none;
color: black;
}

Altering a flexbox layout to display block format

I have a section in which is displaying via a flex box. This works great, but when the viewport gets to a 640px or less size, I want to be able to make all three section be shown in a display: block fashion with a width of 100%. I tried changing the #contact-section to display: block, but it went completely out of the format I have with flex.
I am wanting it to appear like this under 640px's.
Does anyone know how I can do it without losing the flex format, or at least making it work in this viewport?
Here is a fiddle which will allow the sections to be seen in a 640 or less viewport.
#contact-section {
display: flex;
justify-content: space-around;
align-items: center;
color: #FFF;
background: #00a16d;
padding: 1em;
}
#contact-section:before {
content: "";
flex: 0 0 1px;
height: 3em;
background: #FFF;
order: 2;
}
#contact-section-left {
font-size: 1.5em;
order: 1;
font-style: italic;
}
#contact-section-right {
background: url("../icons/envelope.png") center / contain no-repeat;
font-size: 2em;
order: 3;
padding: 1em 0;
}
#contact-section-right a {
color: #FFF;
text-decoration: none;
}
/*--------------------------MEDIA QUERY 640------------------------------------*/
#media screen and (max-width:640px) {
#contact-section {
display: flex;
justify-content: space-around;
align-items: center;
padding: 1em 2em;
}
#contact-section:before {
flex: 0 0 1px;
height: 3em;
order: 2;
display: block;
width: 100%;
}
#contact-section-left {
font-size: 1.5em;
order: 1;
display: block;
width: 100%;
}
#contact-section-right {
font-size: 2em;
order: 3;
padding: 1em 0;
display: block;
width: 100%;
}
}
<div id="contact-section">
<div id="contact-section-left">Tell us more about your digital marketing project.</div>
<div id="contact-section-right">Contact us</div>
</div>
I have changed the direction to column, seems that now it works
#contact-section {
display: flex;
justify-content: space-around;
align-items: center;
color: #FFF;
background: #00a16d;
padding: 1em;
}
#contact-section:before {
content: "";
flex: 0 0 1px;
height: 3em;
background: #FFF;
order: 2;
}
#contact-section-left {
font-size: 1.5em;
order: 1;
font-style: italic;
}
#contact-section-right {
background: url("../icons/envelope.png") center / contain no-repeat;
font-size: 2em;
order: 3;
padding: 1em 0;
}
#contact-section-right a {
color: #FFF;
text-decoration: none;
}
/*--------------------------MEDIA QUERY 640------------------------------------*/
#media screen and (max-width: 640px) {
#contact-section {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
padding: 1em 2em;
}
#contact-section:before {
flex: 0 0 10px;
order: 2;
display: block;
width: 100%;
background-color: red;
}
#contact-section-left {
font-size: 1.5em;
order: 1;
display: block;
width: 100%;
}
#contact-section-right {
font-size: 2em;
order: 3;
padding: 1em 0;
display: block;
width: 100%;
text-align: center;
}
}
<div id="contact-section">
<div id="contact-section-left">Tell us more about your digital marketing project.</div>
<div id="contact-section-right">Contact us
</div>
</div>
You could use min-width instead mediaqueries and flex-wrap:wrap and eventually border(s) on the first element to drop the pseudo ::before. See Fiddle test 1 & Fiddle test 2 .
#contact-section {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
align-items: center;
color: #FFF;
background: #00a16d;
}
#contact-section:before {} #contact-section-left {
font-size: 1.5em;
font-style: italic;
min-width: 320px;
border-top: 1em solid transparent;
border-bottom: 1em solid transparent;
border-right: 1px solid white;
padding: 1em;
flex: 1;
}
#contact-section-right {
background: url("../icons/envelope.png") center / contain no-repeat;
font-size: 2em;
padding: 1em;
flex: 1;
min-width: 320px;
}
#contact-section-right a {
color: #FFF;
text-decoration: none;
}
<div id="contact-section">
<div id="contact-section-left">Tell us more about your digital marketing project.</div>
<div id="contact-section-right">Contact us
</div>
</div>
edit
if you still want to use a pseudo of 3em height, then you can draw it from the first box https://jsfiddle.net/mq41hgkp/3/