Im making a responive website and the mobile design is fine but when I expand to desktop size I can't scroll? Does it have to do with anything in my universal selector (*)? Do I need to add media queries? Does it have to do with specificity Can you find any errors in my CSS?:
* {
margin: 0;
padding: 0;
list-style-type: none;
}
html,
body {
background-color: black;
width: 100%;
height: 100%;
max-width: 100%;
overflow-x: hidden;
text-decoration: none;
}
/*Fonts*/
#font-face {
src: url(../fonts/Montserrat-Regular.ttf);
font-family: mos;
}
#font-face {
src: url(../fonts/Montserrat-Bold.ttf);
font-family: mosbo;
}
#font-face {
src: url(../fonts/Montserrat-Italic.ttf);
font-family: mosit;
}
/*button that the user clicks to open navigation*/
#white-elip {
position: absolute;
width: 70px;
height: 70px;
left: 10px;
}
/*header*/
#picofme {
width: 220px;
height: 220px;
position: absolute;
left: 30px;
}
h1 {
color: white;
font-family: mosbo;
font-size: 1.6rem;
position: absolute;
top: 110px;
left: 35px;
}
.caption {
color: white;
font-family: mos;
font-size: 0.9rem;
width: 200px;
position: absolute;
top: 150px;
left: 20px;
}
Related
Can someone explain to me why in Chrome responsive mode my web page looks good, and on the mobile it looks differently that I don't like.
And yes I used:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
in my HTML.
[Chrome responsive mode:] (https://i.stack.imgur.com/PIkBo.png)
Phone responsive mode:
This my CSS that im using to make my website responsive:
#media screen and (min-width: 320px) and (max-width: 480px){
html,
body {
overflow-x: hidden !important;
}
body {
position: relative;
background-color: rgb(100, 100, 195);
background-size: cover;
background-repeat: no-repeat;
z-index: 1;
}
#video-background {
display: none;
z-index: -1;
}
.message-top {
font-size: 1.2em;
top: 15vh;
font-family: 'San Francisco';
font-weight: bolder;
left: 22vh;
}
.coming_soon {
top: 25vh;
}
.message-bottom {
display: none;
}
#analog-clock {
position: absolute;
top: 50vh;
left: 47%;
transform: translate(-50%, -50%);
width: 90vw;
height: 90vw;
opacity: initial;
}
#clock-dial {
width: 70vw;
height: 70vw;
}
#hour-hand {
width: 0.18vh;
height: 20%;
top: 28%;
left: 49.5%;
}
#sec-hand {
width: 0.5%;
height: 30%;
top: 16.5%;
left: 49%;
}
.logo-bg {
position: absolute;
width: 50%;
top: -5%;
left: -5%;
}
.logo-bg img {
position: absolute;
width: 20vh;
top: -3%;
left: -3%;
}
#social-sidebar {
visibility: hidden;
}
.scroll-button {
top: 80%;
max-width: min-content;
}
.bg-below-video {
position: relative;
top: auto;
left: auto;
width: 100%;
height: auto;
min-width: auto;
min-height: auto;
z-index: 1;
}
#home-button {
top: -45vh !important;
position: relative;
right: -24vh;
font-size: 0.8em;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
bottom: 500%;
font-size: 0.8em;
color: black;
}
#subscribe-button-x {
top: -45vh !important;
position: relative;
right: -24vh;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
bottom: 500%;
font-size: 0.8em;
color: black;
}
#subscribe-button-x {
padding: initial;
background-color: initial;
text-decoration: initial;
z-index: 1;
transition: initial;
}
#home-button:hover,
#subscribe-button-x:hover {
pointer-events: none;
transform: none;
}
}
This question already has an answer here:
Why do I have scroll bars on my website when there shouldn't be?
(1 answer)
Closed 1 year ago.
I'm making a discord server website for people to find discord servers to join and make
friends but, I dont know why my web page has a horizontal scroll bar. It also had a vertical scroll
bar but I got rid of that,
anyway here is my HTML and CSS
html {
font-family: Arial, Helvetica, sans-serif;
background-color: #414141;
text-decoration: none;
}
body {
background-color: #414141;
}
:root {
--navbar-height: 4rem;
--header-height: 14rem;
--main-min-height: 240rem;
}
body {
height: 100vh;
min-width: 480;
margin: 0;
padding: 0;
font-family: Helvetica;
display: grid;
grid-template-rows: minmax(var(--navbar-height), auto) minmax(var(--main-min-height) 1fr) auto;
}
.topnav {
overflow: hidden;
padding: 0px 15px;
height: var(--navbar-height);
color: white;
}
.topnav a {
font-size: 20;
float: left;
color: #f2f2f2;
text-align: center;
padding: 22px 16px;
text-decoration: none;
font-size: 17px;
}
.topnav a:hover {
background-color: #ddd;
color: black;
}
.topnav a.active {
color: #788ce2;
}
.topnav-right {
float: right;
}
.row::after {
clear: both;
display: table;
}
.copyright {
position: absolute;
bottom: 1%;
right: 1%;
font-size: 15px;
}
.copyright-text {
color: white;
}
.footer-links {
position: absolute;
bottom: 5%;
}
.link-text {
position: absolute;
bottom: 10%;
color: white;
text-decoration: none;
}
.container {
padding: 0;
margin: 0;
}
li {
position: relative;
left: 100%;
}
footer {
position: absolute;
bottom: 0%;
height: 300px;
width: 100%;
color: #fff;
background: #2c2c2c;
}
.welcome {
margin-top: -2.5rem;
width: 100%;
height: 35.5rem;
line-height: 1.8em;
margin-bottom: .4em;
padding: 0;
font-family: Helvetica;
font-weight: 600;
font-size: 1.5em;
color: #ffff;
text-transform: uppercase;
}
.centered-text {
position: relative;
margin-left: 25%;
display: flex;
align-items: center;
padding: 0 1.5rem;
}
.discord-logo {
border: 0;
font: 0/0 a;
text-shadow: none;
color: transparent;
display: inline-block;
padding: .6em 0;
background: url(images/Discord-Wordmark-White.png) center no-repeat;
background-size: contain;
font-size: 1em;
}
.head {
margin-bottom: .4em;
padding: 0;
line-height: 1.4;
font-weight: 600;
font-size: 2em;
}
.body {
position: relative;
margin-left: 24.5%;
margin: 0 auto 1em;
text-transform: inherit;
opacity: 85%;
}
.search-box {
position: absolute;
top: 90%;
left: 18%;
background: #2c2c2c;
height: 40px;
border-radius: 40px;
padding: 10px;
}
.search-box:hover>.search-txt {
width: 260px;
padding: 0 6px;
}
.search-btn {
color: white;
float: right;
width: 40px;
height: 40px;
border-radius: 100%;
background: black;
display: flex;
justify-content: center;
align-items: center;
text-decoration: none;
}
.search-box:hover>.search-btn {
background: white;
color: black;
}
.search-txt {
border: none;
background: none;
outline: none;
float: left;
padding: 0;
color: white;
font-size: 16px;
transition: 0.4s;
line-height: 40px;
width: 0px;
}
.navbar-servers {
color: white;
float: right;
}
.title-right {
position: absolute;
right: 25%;
}
body {
color: #e6e6e6;
font-size: 1em;
font-weight: 400;
line-height: 1.5;
}
h1 {
position: absolute;
left: 42%;
top: 10%;
}
.last-modified {
position: absolute;
left: 40.6%;
top: 17%;
}
.terms-of-service-align {
position: absolute;
left: 1%;
top: 25%;
}
.site-footer .site-footer--container,
.site-footer .site-footer--extra {
max-width: 1264px;
width: 100%;
margin: 0 auto;
padding: 32px 12px 12px 12px;
display: flex;
flex-flow: row wrap;
}
.site-footer--container,
.site-footer--extra {
max-width: 1264px;
}
.site-footer,
.site-footer *,
.site-footer *:before,
.site-footer *:after {
box-sizing: border-box;
}
h5,
h6 {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
}
.site-footer {
background-color: #242729;
background-image: none;
background-position: top left;
background-repeat: no-repeat;
border-top: 0;
background-size: auto;
color: #6a737c;
padding-top: 0;
padding-bottom: 0;
}
.discord {
color: #788ce2;
font-weight: 800;
}
.guidelines {
color: #788ce2;
font-weight: 800;
}
.hidden {
position: absolute;
top: 520%;
height: 0px;
opacity: 0%;
}
.main-header {
position: absolute;
left: 41%;
}
.all {
position: relative;
top: 10%;
left: 28%;
}
<nav class="topnav">
<div>
<h2 class="title-right">
OnTop Servers
</h2>
</div>
</nav>
<div class="main-container">
<h1 class="main-header">
Guidelines</h1>
<p class="last-modified">
Last Modified: 2020-11-22
</p>
<div class="all">
In order to keep a safe community, there are some guidelines which need to be followed by you<br> By using DISBOARD, you agree to the following guidelines:<br><br> The use of swear words, dirty words or NSFW (sexual content) to our discretion in a
server's meta (title,<br> description and picture), review or other content that may be seen by other users in DISBOARD is not<br> allowed. This will lead to the removal of the content, however, you'll be able to repost the content with a<br> proper
language.<br>
<Br> You may not violate any laws or regulations in your country of residence or promote the violation of them.<br><br> Servers violating <a class="discord" href="https://discord.com/guidelines">Discord Community Guidelines</a> are not allowed.<br><br> The use of bots or other scripts to automatically do actions in DISBOARD such as bumping a server ("auto-<br> bump") is not allowed. Bumping, creating reviews and etc. must be done manually.<br><br> You may not list servers which serve for the sole
purpose of redirecting or advertising other servers or have<br> no content (To our discretion).<br><br> You may not reward or force users to do actions in DISBOARD. For instance, you may not reward your users<br> for posting a nice review on a server
or force them to bump a server.<br><br> You may not create multiple Discord accounts to submit multiple reviews. Please just post 1 review per<br> person.
<br><br> All servers which are mainly based on NSFW (sexual content to our discretion) must be marked as "NSFW"<br> in DISBOARD.<br><br>
<div class="TOS">
See also our <a class="discord" href="termsofservice.html">Term of Services</a>
</div>
</div>
How do I fix, please help me with this...
I dont know what to do, I gone through almost everything on the page, I don know.
position: relative; left:28% pushes the element beyond the window width creating an overflow to the right.
.all {
position: relative;
top: 10%;
left: 28%;
}
you can try using padding or margin instead
Instead of putting left: 28% for your div, use padding-left: 28%. It should be a little fix.
So I just started making the site and there is a lot of white space at the bottom of my site...
I've been removing div but than on Inspect Element shows that the white space is because of <ul></ul> when I removed that tag it showed it is because of <body>
They say add margin: 0; padding:0 html,body { height:100%;} but nothing worked.
#font-face {
font-family: 'RobotoR';
src: url("/Roboto-Regular.ttf");
}
#font-face {
font-family: 'RobotoM';
src: url("/Roboto-Medium.ttf");
}
#font-face {
font-family: 'RobotoB';
src: url("/Roboto-Bold.ttf");
}
#font-face {
font-family: 'RobotoLi';
src: url("/Roboto-LightItalic.ttf");
}
html,body {height:100%;}
body{
overflow-x: hidden;
min-height: 100vh;
margin:0;
}
.navigacija a{
font-size: 21px;
font-family: 'RobotoR', sans-serif;
text-decoration: none;
z-index: 1;
}
nav ul li a {
color: black;
background-color: inherit;
padding: 0.5em 0.5em;
}
.navigacija a:hover {
color:#202020;
font-weight: bold;
}
.navigacija a:visited{
color: #202020;
font-weight: bold;
}
nav ul {
position: relative;
width: auto;
background: none;
height: auto;
bottom: 10em;
right: 5em;
display: flex;
float: right;
list-style-type: none;
z-index: 1;
}
.logo{
position: relative;
width: 20%;
left: 5.1em;
top: -2.5em;
}
.kontakttelmail {
position: relative;
top: -11.5em;
left: 83.9em;
font-family: 'RobotoLi', sans-serif;
word-spacing: 1em;
font-size: 15px;
opacity: 0.5;
}
.button {
background-color: white;
border: none;
color: #00A651;
padding: 20px 30px;
position: relative;
bottom: 85em;
left: 57.5em;
text-align: center;
border-radius: 35px;
text-decoration: none;
display: inline-block;
font-size: 21px;
font-family: 'RobotoB', sans-serif;
}
.zelenakrivina{
position: relative;
width: 90%;
right: -15em;
bottom: 8em;
padding: 0%;
margin: 0%;
}
.auto{
position: relative;
width: 49%;
right: -24.5em;
bottom: 44em;
padding: 0%;
margin: 0%;
}
.zelenisvg ul li{
position: relative;
bottom: 95em;
left: 80em;
text-decoration: none;
list-style-type: none;
}
.zelenisvg {
}
.Renault{
position: relative;
top: -0em;
right: 0.1em;
color: white;
font-size: 30px;
font-family: 'RobotoM', sans-serif;
padding: 0%;
margin: 0%;
}
.Megane{
position: relative;
top: -1.3em;
right: 1.1em;
color: white;
font-size: 40px;
font-family: 'RobotoB', sans-serif;
}
.lajna{
position: relative;
bottom: 124em;
left: 63.7em;
width: 11%;
}
.a30e{
position: relative;
top: -1.58em;
right: 0.7em;
color: white;
font-size: 100px;
font-family: 'RobotoB', sans-serif;
}
.nadan{
position: relative;
top: -11em;
right: -0.6em;
color: white;
font-size: 25px;
font-family: 'RobotoR', sans-serif;
}
.sivitext{
position: relative;
bottom: 22em;
font-family: 'RobotoB', sans-serif;
font-size: 60px;
left: 2.5em;
color: #212121;
}
.zelenitext{
position: relative;
bottom: 23.2em;
font-family: 'RobotoB', sans-serif;
font-size: 60px;
left: 2.5em;
color: #00A651;
}
.ispodnaslova{
position: relative;
bottom: 61.2em;
font-family: 'RobotoR', sans-serif;
font-size: 23.8px;
left: 6.3em;
color: #585858;
}
.scroll{
position: relative;
bottom: 110.9em;
/* left: 15em; */
width: 8%;
display: block;
margin-left: auto;
margin-right: auto;
}
.strelica{
position: relative;
bottom: 115.9em;
/* left: 15em; */
width: 4.2%;
display: block;
margin-left: auto;
margin-right: auto;
}
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>S T A R T - Rent-a-Car</title>
<link rel = "stylesheet"
type = "text/css"
href = "style.css" />
</head>
<header>
<img src="images/logo.png" alt="logo" class="logo">
<nav>
<ul class="navigacija" id="nav">
<li>Početna</li>
<li>Sva vozila</li>
<li>O nama</li>
<li>Kontkat</li>
</ul>
</nav>
<p class="kontakttelmail">email#gmail.com +382-68-222-333</p>
</header>
<body>
<div class="zelenisvg">
<img src="images/Path 1.svg" alt="zelenakrivina" class="zelenakrivina">
<img src="images/renault-migan-e1541771231987.svg" alt="renault" class="auto">
<p class="sivitext">Uz naša vozila ste</p>
<p class="zelenitext"> korak bliže cilju!</p>
<p class="ispodnaslova">Na vaš poziv dovodimo željeno<br>
vozilo na vašu adresu!</p>
<ul>
<li><p class="Renault">Renault</p></li>
<li><p class="Megane">Megane</p></li>
<li><p class="a30e">30€</p></li>
<li><p class="nadan">/na dan</p></li>
</ul>
<button onclick="location.href= 'Svavozila.html'" class="button">Rezervisi odmah!</button>
<img src="/images/Line 1.png" alt="linija" class="lajna">
<img src="images/Path 9.svg" alt="scroll" class="scroll">
<img src="/images/Path 2.png" alt="strelica" class="strelica">
</div>
</body>
<footer>
</footer>
Just like someone said in the comments section:
</body>
<footer>
</footer>
You can't have the footer outside the body element.
Take a look at this link:
https://css-tricks.com/snippets/html/html5-page-structure/
You'll understand how the HTML markup should look like :)
EDIT:
Your HTML seems to look better now but your CSS is breaking everything up. Why do you apply the position: relative to every single CSS rule you create ? Look https://jsfiddle.net/t23mkxz4/
I've removed position: relative and everything looks much better. Please - do some research on how to use the position: relative property :)
take a look at this link -> https://developer.mozilla.org/en-US/docs/Web/CSS/position
it's a great source of knowledge and examples. Good luch mate !
I have a media query to change the look of a footer when the site goes mobile, but, for some reason, it doesn't seem to want to take the media query styles over the original base style. The specific CSS code is as follows
.footy {
background-repeat: no-repeat;
background-image: url('../Images/LandingBottomRightCorner_FullSpan.png');
background-position-x: right;
min-height: 338px;
position: relative;
left: 0;
bottom: 0;
width: 100%;
overflow: hidden;
}
.footytext {
position: absolute;
bottom: 0;
right: 0;
text-align: center;
margin: 13px;
}
.footytextelement {
color: white;
font-size: 18pt;
font-family: Arial;
font-weight: bold;
}
.joinnow {
border: 3px solid white;
border-radius: 12px;
font-style: italic;
margin: 10px;
}
.footytext a:hover {
text-decoration: none;
}
#media (max-width: 1279px) {
/*FOOTER APPEARANCE MOBILE*/
.footy {
background-repeat: repeat-x;
background-image: url('../Images/MBLLandingFooterGradient_ForRepeat.png');
height: 338px;
position: relative;
width: 100%;
overflow: hidden;
}
.footytext {
position: center;
text-align: center;
margin: 13px;
}
.footytextelement {
color: white;
font-size: 16pt;
font-family: Arial;
font-weight: bold;
}
.joinnow {
border: 3px solid white;
border-radius: 12px;
font-style: italic;
margin: 10px;
}
.footytext a:hover {
text-decoration: none;
}
}
The HTML being manipulated is:
<div class="footy">
<div class="footytext">
<div class="footytextelement">Make a plan.</div>
<div class="footytextelement">Get medications.</div>
<div class="footytextelement">Quit.</div>
<div class="footytextelement joinnow">Join Now!</div>
</div>
</div>
.footy {
background-color:red;
background-position-x: right;
min-height: 338px;
position: relative;
left: 0;
bottom: 0;
width: 100%;
overflow: hidden;
}
.footytext {
position: absolute;
bottom: 0;
right: 0;
text-align: center;
margin: 13px;
}
.footytextelement {
color: white;
font-size: 18pt;
font-family: Arial;
font-weight: bold;
}
.joinnow {
border: 3px solid white;
border-radius: 12px;
font-style: italic;
margin: 10px;
}
.footytext a:hover {
text-decoration: none;
}
#media (max-width: 1279px) {
/*FOOTER APPEARANCE MOBILE*/
.footy {
background-color:green;
background-position-x: right;
background-position-y:bottom;
height: 338px;
position: relative;
left: 0;
bottom: 0;
width: 100%;
overflow: hidden;
}
.footytext {
position: center;
bottom: 0;
right: 0;
text-align: center;
margin: 13px;
}
.footytextelement {
color: white;
font-size: 18pt;
font-family: Arial;
font-weight: bold;
}
.joinnow {
border: 3px solid white;
border-radius: 12px;
font-style: italic;
margin: 10px;
}
.footytext a:hover {
text-decoration: none;
}
}
<div class="footy">
<div class="footytext">
<div class="footytextelement">Make a plan.</div>
<div class="footytextelement">Get medications.</div>
<div class="footytextelement">Quit.</div>
</div>
</div>
Your max-width in media query should be 768px as standard.
You have given 1279px which means no matter whether you are in mobile device or desktop, media query css will apply everywhere.
With that media's condition you are saying: apply these styles above 1279px.
Use min-width and max-width to get more control.
example:
#media (max-width: 719px) {...}
#media (max-width: 1023px) {...}
More information: MDN LINK
When resizing my window to check the responsiveness of a Wordpress site that I'm working on I noticed that when moving up to a larger window size, all of a sudden my slider in the header overlaps on top of the content below it. Once you resize the window to a smaller size it corrects itself. What's the deal?
Here's my code for the slider and the content below it:
#slideshow_cont { width: 646px; float: left; margin-right: 0px; margin-bottom: 10px; position: relative; }
#slideshow { width: 646px; min-height: 280px; }
.slide_box { display: none; position: absolute; top: 0; left: 0; }
.slide_box_first { display: block; width: 646px; height: 280px;}
.slide_box img { display: block; width: 646px; height: 280px; }
.slide_box iframe { display: block; width: 646px; height: 280px; }
.slide_box_title { padding: 8px 10px; font-size: 20px; font-family: 'Open Sans Condensed', sans-serif; font-weight: 300; text-transform: uppercase; background-color: #fff; height: 23px; }
.slide_box_title a { color: #222; text-decoration: none; }
.slide_prev { position: absolute; top: 132px; left: 0; cursor: pointer; z-index: 30; }
.slide_next { position: absolute; top: 132px; right: 0; cursor: pointer; z-index: 30; }
.home_box { float: left; width: 313px; background-color: #fff; margin-bottom: 0px; margin-right: 0px; }
.home_box img,
.home_box iframe { width: 313px; height: 196px; }
.home_box_last { margin-right: 0; }
.home_box_cont { padding: 5px 5px; text-align: center; }
.home_box_cont h3 { font-size: 20px; margin: 0px 0 10px; font-family: 'Open Sans Condensed', sans-serif; font-weight: 300; text-transform: uppercase; }
.home_box_cont h3 a { color: #222; text-decoration: none; }
.home_box_cont h3 a:hover { text-decoration: none; color: #f2664f; }
.home_box_text .home_box_cont { text-align: center; font-size: 18px; font-family: 'Open Sans Condensed', sans-serif; font-weight: 300; background-color: transparent;}
.archive_title { background-color: #F5F5F5; padding: 10px 8px; margin-bottom: 20px; font-size: 16px; }