HTML5/CSS3 - Can't change font-size on #media - html
The code is kind big but considering I don't know where the problem is I'll paste all my HTML5 file and CSS3 stylesheet in here.
I've started work with web designing now and I'm just reworking my first website in order to make it be responsive.
I know that when rules are the same, it makes count the last one and it's not always a good pratice to keep it repeating itself but in my case the rules isn't exactly the same, I'm using different classes ("caixa" means "box", and I made different ones for different ocasions, at least it's I believe I'm doing. In this case, I can't change the font-size when coding the #media(max-width: 480px)) in each situation and no matter how I try it...I mean, I even tried to make new classes just to change it but it JUST DON'T RECOGNIZE. I'm getting nuts here guys. What I'm doing wrong?
"Sorry" for portugues classes and yes I mix it with english words, habits, any doubt just ask... oh, and "sorry" for bad english of course, I'M FREAKING NUTS HERE DAMN WANNA EXPLODE EVERYTHING WITH A F*CKING BAZOOKA !!!
My HTML5 file (the part that I wanna mess with):
<!-- REVISTA START -->
<section class="posts-section">
<section class="container-small">
<!-- maria trindade -->
<section id="maria-trindade" class="caixa-destaque">
<div class="title">
<a href="revista\artistas\maria-trindade.html">
<h2>VER DE PERTO</h2>
</a>
</div>
<div class="img">
<a href="revista\artistas\maria-trindade.html">
<img src="_img/posts/maria-trindade/ver-de-perto/3.png" alt="">
</a>
</div>
<div class="author">
<a href="revista\artistas\maria-trindade.html">
<h4>Maria Trindade</h4>
</a>
</div>
<div class="continue-btn">
<a href="revista\artistas\maria-trindade.html">
<h5>CONTINUAR A LEITURA</h5>
</a>
</div>
</section>
<!-- bru pereira -->
<section id="bru-pereira" class="caixa-destaque">
<div class="title title-small">
<a href="revista\artistas\bru-pereira.html">
<h2>Pacto</h2>
</a>
</div>
<div class="text">
<a href="revista\artistas\bru-pereira.html">
<p>Muito me anima compor parte de um novo corpo, fazer corpo é uma arte, uma artesania que aprecio cada vez mais. Me instigo a pensar a partir desse lugar de entrelaçamento entre o somático e o coletivo, a partir desse corpo que fazemos sempre
juntas e juntos. (...)</p>
</a>
</div>
<div class="author">
<a href="revista\artistas\bru-pereira.html">
<h4>Bru Pereira</h4>
</a>
</div>
<div class="continue-btn">
<a href="revista\artistas\bru-pereira.html">
<h5>CONTINUAR A LEITURA</h5>
</a>
</div>
</section>
<!-- carol do vale -->
<section id="carol-do-vale" class="caixa-destaque">
<div class="title">
<a href="revista\artistas\carol-do-vale.html">
<h2>O meu corpo é um templo: Eu respeito, eu curo, eu liberto</h2>
</a>
</div>
<div class="text">
<a href="revista\artistas\carol-do-vale.html">
<p>É pessoalmente difícil escrever sobre algo tão íntimo como mera observadora. A trajetória dos corpos não-brancos diante de um sistema que esmaga a autoestima deve ser sempre narrada em primeira pessoa. Precisamos nos tornar protagonistas e
não meros coadjuvantes em nossa própria história. (...)</p>
</a>
</div>
<div class="author">
<a href="revista\artistas\carol-do-vale.html">
<h4>Carol do Vale</h4>
</a>
</div>
<div class="continue-btn">
<a href="revista\artistas\carol-do-vale.html">
<h5>CONTINUAR A LEITURA</h5>
</a>
</div>
</section>
<!-- bruna gomes -->
<section id="bruna-gomes" class="caixa-destaque proxima-fila">
<div class="title">
<h2>CALO NA MÃO</h2>
</div>
<div class="img">
<a href="revista\artistas\bruna-gomes.html">
<img src="_img/posts/bruna-gomes-afonso/IMAGENS/2.png" alt="">
</a>
</div>
<div class="text text-fix">
<a href="revista\artistas\bruna-gomes.html">
<p>O Projeto Calo na Mão traz como característica a brincadeira, no sentido de brincar a cultura popular, de brincar o maracatu, onde Corpo e Espaço estabelecem relações baseadas na vivência. (...)</p>
</a>
</div>
<div class="author">
<a href="revista\artistas\bruna-gomes.html">
<h4>Bruna Gomes Afonso</h4>
</a>
</div>
<div class="continue-btn">
<h5>CONTINUAR A LEITURA</h5>
</div>
</section>
<!-- bruna diniz -->
<section id="bruna-diniz" class="caixa proxima-fila">
<div class="text text-big poesia">
<a href="revista\artistas\bruna-diniz.html">
<p>corpo estrangeiro sem imagem<br>
um espelho vazio que não sou capaz de ver e já não sei se um dia verei<br>
se quer serei capaz de pintar algum rosto que imagino ser o meu<br>
qualquer imagem que nos dissesse sobre aquele fio de navalha<br>
pelo qual percorri e ainda percorrerei<br>
imagine só o que serão nossos filhos<br>
nossas filhas<br>
que ainda não são frutos<br>
e se forem algum, de quais flores irão nascer? (...)</p>
</a>
</div>
<div class="author">
<a href="revista\artistas\bruna-diniz.html">
<h4>Bruna Diniz</h4>
</a>
</div>
<div class="continue-btn">
<a href="revista\artistas\bruna-diniz.html">
<h5>CONTINUAR A LEITURA</h5>
</a>
</div>
</section>
<!-- bruno caldeira -->
<section id="bruno-caldeira" class="caixa proxima-fila">
<div class="title">
<a href="revista\artistas\bruno-caldeira.html">
<h2>Sobre um treze de maio garganta-abaixo</h2>
</a>
</div>
<div class="text text-big poesia">
<a href="revista\artistas\bruno-caldeira.html">
<p>Segurar o silêncio do peso do mundo<br> Do sujo-modo de um comportamento sódico<br> Grilhões
<br> y correntes<br> Ecoam
<br> Na mente<br> Da Gente preta que sente<br> Manicômios
<br> Escolas
<br> Embranquecimentos
<br> Traumas (...)
<br><p>
</a>
</div>
<div class="author">
<a href="revista\artistas\bruno-caldeira.html">
<h4>Bruno Caldeira</h4>
</a>
</div>
<div class="continue-btn">
<a href="revista\artistas\bruno-caldeira.html">
<h5>CONTINUAR A LEITURA</h5>
</a>
</div>
</section>
<section class="btn-section">
<div class="btn">
<a href="revista\index.html">
<h2>Revista</h2>
</a>
</div>
<div id="btn-m" class="btn">
<a href="edicoes\index.html">
<h2>#1</h2>
</a>
</div>
</section>
My CSS3 stylesheet:
/* -- GENERAL -- */
/*
* colors:
* #4C1919 - Bordô* - rgba(178, 35, 35, .5) - rgba(233, 26, 26, 1)
* #BAA87C - Bege* - lighter => #CFC7B4
*
*
* fonts:
* 'Source Sans Pro', sans-serif;
* 'Oswald', sans-serif;
*/
/* global */
body {
font: 15px/1.5 'Oswald', 'Source Sans Pro', sans-serif;
margin: 0;
padding: 0;
width: 100%;
height: auto;
}
ul {
list-style: none;
padding: 0;
margin: 0;
}
body a:hover {
text-decoration: none;
color: lightgray;
}
section.logo-big img {
width: 80%;
}
.container {
width: 90%;
}
.logo {
width: 60%;
}
.social {
float: right;
margin-top: -85px;
margin-right: 100px;
width: 150px;
height: 60px;
}
.social-btns {
margin-top: 10px;
margin-left: 40px;
}
.social-btns img:hover {
color: #000000;
opacity: 0.7;
}
img.facebook-logo {
margin-top: -5px;
width: 30px;
height: 30px;
}
img.instagram-logo {
margin-top: 5px;
width: 60px;
height: 45px;
}
.section-title {
text-align: center;
margin-top: 100px;
color: #ffffff;
font-size: 120px;
}
/* landing-page */
.landing-page {
width: 100%;
height: 640px;
}
.menu {
width: 100%;
height: 90px;
background: #212121;
border-bottom: 5px solid black;
}
.menu ul {
margin: 35px auto;
}
.menu ul li {
display: inline;
}
.menu ul li a {
font-size: 20px;
color: #ffffff;
padding: 10px;
text-transform: uppercase;
}
.menu ul li a:hover {
color: Dimgray;
}
.landing-page .logo {
width: 50%;
float: right;
margin-right: 200px;
text-align: center;
}
.landing-page .logo img {
width: 80%;
margin-left: -270px;
}
.links-lp {
float: left;
width: 17%;
margin-top: 100px;
margin-left: 100px;
}
.links-lp li a {
color: #000000;
}
.links-lp li a:hover {
font-weight: bold;
background: rgba(233, 26, 26, 1);
}
.coluna01 {
float: right;
clear: right;
margin-top: -200px;
margin-right: 50px;
width: 16%;
height: 80px;
background: #212121;
border: 2px solid black;
box-shadow: 2px 2px 2px Dimgray;
}
.coluna01 h1 {
font-size: 30px;
text-align: center;
margin-top: 20px;
color: #ffffff;
text-shadow: 1.5px 1.5px Dimgray;
}
.coluna01 h1:hover {
color: lightgray;
}
/* cita */
section.cita {
width: 100%;
height: 420px;
background: #ffffff;
border-top: 20px solid #212121;
border-bottom: 20px solid #212121;
}
.coluna02 {
float: left;
width: 30%;
height: 400px;
background: #212121;
}
.coluna02 .section-title {
margin-top: 40px;
margin-left: 40px;
background: rgba(0,0,0, 1);
}
.coluna02 h2.section-title {
width: 80%;
height: 300px;
padding-top: 60px;
text-align: center;
text-shadow: 3px 5px Dimgray;
}
section.cita img {
width: 6%;
}
#aspas01 {
float: left;
margin-top: 130px;
margin-left: 50px;
}
#aspas02 {
float: right;
margin-top: 140px;
margin-right: 30px;
transform: rotate(180deg);
}
.quote-text {
float: left;
margin-top: 115px;
margin-left: 10px;
font-family: 'Crimson Text', serif;
}
.quote-text a {
color: #000000;
font-size: 70px;
font-style: italic;
text-shadow: 0.5px 0.5px black;
}
.quote-text a:hover {
color: Dimgray;
}
.quote-author h4 {
font-size: 40px;
font-style: normal;
text-align: center;
color: rgba(233, 26, 26, 1);
font-family: 'Oswald', serif;
text-shadow: 0.5px 0.5px rgba(233, 26, 26, 1);
}
.quote-author h4:hover {
color: firebrick;
}
/* posts landing page */
section.posts-section {
width: 100%;
height: 1700px;
}
.caixa-destaque {
float: left;
width: 45%;
height: 400px;
margin: 50px 0 20px 140px;
}
.caixa-destaque .title {
width: 80%;
}
.caixa-destaque .title h2 {
font-size: 100px;
color: rgba(233, 26, 26, 1);
text-shadow: 4px 4px black;
}
.caixa-destaque .img {
width: 100%;
}
.caixa-destaque .img img {
width: 80%;
margin-top: 10px;
box-shadow: 4px 4px 4px black;
}
.caixa-destaque .text {
width: 80%;
}
.caixa-destaque .text p {
color: #000000;
font-size: 20px;
text-align: justify;
}
.caixa-destaque .author {
float: right;
text-align: center;
margin-top: 10px;
margin-right: 120px;
width: 220px;
height: 60px;
padding: 10px;
background: #000000;
box-shadow: 2px 2px 2px dimgray;
}
.caixa-destaque .author h4 {
font-size: 30px;
color: #ffffff;
text-shadow: 1px 1px black;
}
.proxima-fila {
margin-top: 200px;
}
.poesia p {
text-align: left;
}
.text-big a p {
font-size: 20.6px;
}
.text-small a p {
font-size: 18px;
}
.caixa {
float: left;
width: 30%;
height: 200px;
margin: 50px 0 20px 140px;
}
.caixa .title h2 {
color: rgba(233, 26, 26, 1);
}
.caixa .img {
width: 80%;
}
.caixa .img img {
width: 100%;
}
.caixa .text p {
color: #000000;
}
.caixa .author {
float: right;
width: 220px;
height: 60px;
margin-top: 10px;
border: 1px solid black;
box-shadow: 2px 2px 2px dimgray;
background: #000000;
}
.caixa .author a,
.caixa .author h4 {
font-size: 25px;
margin-top: 10px;
text-align: center;
color: #ffffff;
text-shadow: 0.5px 0.5px black;
}
.caixa .author a:hover,
.caixa .author h4:hover,
.caixa-destaque .author a:hover,
.caixa-destaque .author h4:hover {
color: lightgray;
}
.caixa .continue-btn,
.caixa-destaque .continue-btn {
float: left;
width: 220px;
height: 60px;
margin-top: 10px;
border: 1px solid black;
box-shadow: 2px 2px 2px dimgray;
background: rgba(233, 26, 26, 1);
}
.caixa .continue-btn a,
.caixa-destaque .continue-btn a {
float: left;
margin-top: 15px;
margin-left: 30px;
text-align: center;
font-size: 20px;
color: #ffffff;
text-shadow: 1.5px 1.5px black;
}
section.btn-section {
float: left;
width: 300px;
height: 400px;
margin-left: 230px;
margin-top: 10px;
}
.btn {
width: 300px;
height: 70px;
background: rgba(233, 26, 26, 1);
box-shadow: 3px 3px 3px Dimgray;
border-radius: 0;
border: 2px solid black;
}
#btn-m {
margin-top: 110px;
}
.btn a h2 {
color: #ffffff;
font-size: 40px;
text-shadow: 1.5px 1.5px black;
}
.btn a:hover,
.btn h2:hover {
color: lightgray
}
section#maria-trindade.caixa-destaque .title h2 {
font-size: 90px;
}
section#bru-pereira.caixa-destaque {
float: right;
margin-top: -420px;
margin-right: 40px;
}
section#bru-pereira.caixa-destaque .title h2 {
text-align: center;
font-size: 100px;
}
#carol-do-vale.caixa-destaque {
float: right;
margin-top: -120px;
margin-right: 40px;
}
#carol-do-vale .title {
margin-top: 50px;
margin-bottom: 10px;
}
#carol-do-vale .title h2 {
font-size: 30px;
text-shadow: 1px 1px black;
}
#bruna-gomes.caixa-destaque {
margin-top: -170px;
}
#bruna-gomes.caixa-destaque .title h2 {
font-size: 90px;
}
#bruna-gomes.caixa-destaque .text {
margin-top: 10px;
}
#bruna-gomes.caixa-destaque .author h4 {
font-size: 25px;
}
#bruna-diniz.caixa {
width: 47%;
margin: -55px 0px 0px -50px;
}
#bruna-diniz.caixa .author {
margin-right: 140px;
}
#bruno-caldeira.caixa {
width: 47%;
margin: 160px 0px 0px -50px;
}
#bruno-caldeira.caixa .title h2 {
font-size: 30px;
}
#bruno-caldeira.caixa .text {
margin-top: 10px;
}
#bruno-caldeira.caixa .author {
margin-right: 140px;
}
/* eventos */
section.events-section {
width: 100%;
height: 500px;
background: #212121;
}
.agenda-text {
width: 22%;
float: left;
text-align: justify;
margin-top: 50px;
margin-left: 80px;
height: 400px;
}
.agenda-text h3 {
text-align: center;
font-size: 20px;
margin-bottom: 10px;
text-shadow: 1px 1px black;
}
.evento01,
.evento02 {
float: left;
}
.evento02 {
margin-top: 50px;
}
#eventos-text a h3,
#eventos-text a p {
text-shadow: 1px 1px black;
color: #ffffff;
}
#eventos-text a h3:hover,
#eventos-text a p:hover {
color: Dimgray;
}
#eventos {
float: left;
margin-top: 20px;
margin-left: 70px;
}
#eventos h1 {
text-shadow: 2px 2px black;
}
.calendario {
float: left;
margin-top: 200px;
margin-left: -395px;
}
.newsletter-section {
margin-top: 20px;
margin-right: 50px;
width: 28%;
float: right;
height: 430px;
background: #ffffff;
}
.newsletter-title {
float: left;
margin-top: 0px;
margin-left: 55px;
}
.newsletter-section .logo img {
width: 100%;
margin-left: 80px;
}
.newsletter-title h3 {
margin-left: -10px;
font-size: 60px;
text-shadow: 2px 2px rgba(233, 26, 26, 1);
}
#mc_embed_signup {
float: left;
margin: 20px 0 10px 60px;
}
#mc_embed_signup input[type=email] {
width: 87%;
height: 40px;
margin: 0 auto;
}
#mc_embed_signup input[type=submit] {
width: 30%;
height: 40px;
margin-left: 90px;
font-size: 18px;
}
.nav-bar-end {
width: 100%;
height: 200px;
background: #212121;
}
.nav-end ul {
float: left;
margin: 80px 0 0 300px;
}
.nav-end ul li{
display: inline;
margin-left: 20px;
}
.nav-end ul li a {
text-transform: uppercase;
font-size: 28px;
color: #ffffff;
text-shadow: 1.5px 1.5px black;
}
.nav-end ul li a:hover {
font-weight: normal;
color: lightgray;
}
.footer-section {
width: 100%;
height: 100px;
background: #212121;
}
.footer-text {
width: 50%;
margin: 0 auto;
text-align: center;
}
.footer-text h6 {
color: #ffffff;
text-shadow: 1px 1px black;
}
.footer-text a {
color: rgba(233, 26, 26, 1);
}
.footer-text a:hover {
color: firebrick;
}
/* MAIN CSS END */
#media (max-width: 480px) {
section.cita,
.calendario {
width: 0;
height: 0;
margin: 0;
padding: 0;
border: none;
display: none;
}
.coluna02 h2,
.quote-text h3,
.quote-author h4 {
font-size: 0;
}
.landing-page,
.landing-page .menu,
.landing-page .links-lp,
.landing-page .coluna01,
.landing-page .btn-section,
.cita,
.cita .coluna02,
.cita .quote-text,
.cita .quote-author,
.posts-section,
#maria-trindade,
#bru-pereira,
#carol-do-vale,
#bruna-gomes,
#bruna-diniz,
#bruno-caldeira,
.posts-section .caixa-destaque,
.posts-section .caixa,
.posts-section .btn-section,
.events-section,
.events-section .agenda,
.events-section #eventos,
.events-section .calendario,
.newsletter-section,
.nav-bar-end,
.nav-bar-end nav,
.nav-bar-end nav ul,
.footer-section {
float: none;
margin: 0;
padding: 0;
}
.clear-fix {
clear: both;
}
body {
margin: 0;
padding: 0;
width: 100%;
}
.container-small {
width: 80%;
text-align: center;
margin: 0;
padding: 0;
}
.section-title {
font-size: 30px;
}
/* global */
/* landing-page */
.landing-page {
width: 100%;
height: auto;
margin: 0;
padding: 0;
}
.landing-page .menu {
display: block;
width: 100%;
height: 200px;
margin-bottom: 10px;
}
.landing-page .menu nav {
padding-top: -20px;
width: 40%;
height: 100%;
}
.landing-page .menu ul {
margin-top: 25px;
margin-left: 20px;
}
.landing-page .menu li {
float: left;
}
.landing-page .menu a {
font-size: 16px;
}
.landing-page .social {
width: 70px;
height: 150px;
margin-top: -180px;
margin-right: 20px;
}
.landing-page .social-btns {
margin: 0;
padding: 0;
}
.landing-page .facebook-logo {
margin-top: 20px;
margin-left: 20px;
}
.landing-page .instagram-logo {
margin-top: 10px;
margin-left: 5px;
}
.landing-page .logo {
margin: 0 auto;
padding: 0;
width: 80%;
}
.landing-page .logo img {
width: 100%;
margin-top: -20px;
margin-left: -40px;
}
.landing-page .links-lp {
margin-top: 40px;
width: 100%;
}
.landing-page .links-lp ul {
text-align: center;
}
.landing-page .coluna01 {
margin-top: 20px;
width: 100%;
display: block;
}
/* revista posts */
section.posts-section {
width: 100%;
height: 2000px;
}
}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { margin:0; padding:0; }
table { border-collapse:collapse; border-spacing:0; }
fieldset,img { border:0; }
address,caption,cite,code,dfn,em,strong,th,var { font-style:normal; font-weight:normal; }
ol,ul { list-style:none; }
caption,th { text-align:left; }
h1,h2,h3,h4,h5,h6 { font-size:101.1%; font-weight:normal; }
q:before,q:after { content:''; }
abbr,acronym { border:0; }
At the end of the file you have a lot of ‘reset’ classes. CSS files are read top to bottom to later rules replace those above.
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { margin:0; padding:0; }
table { border-collapse:collapse; border-spacing:0; }
fieldset,img { border:0; }
address,caption,cite,code,dfn,em,strong,th,var { font-style:normal; font-weight:normal; }
ol,ul { list-style:none; }
caption,th { text-align:left; }
h1,h2,h3,h4,h5,h6 { font-size:101.1%; font-weight:normal; }
q:before,q:after { content:''; }
abbr,acronym { border:0; }
This line here will be resetting your media query as it occurs after it in the code:
h1,h2,h3,h4,h5,h6 { font-size:101.1%; font-weight:normal; }
I would also recommend checking out something like normalize.css: http://nicolasgallagher.com/about-normalize-css/
You can include this at the start of your file.
EDIT:
Looking more closely not all the text has smaller sizes in the break point, for example you could add:
#media (max-width: 480px) {
section#maria-trindade.caixa-destaque .title h2 {
font-size: 30px;
}
}
You can also add as many media blocks as you like so you might find it easier to add each one after the rule it affects. This can help you when you’re learning but does increase the length of your code.
.someclass {
font-size: 10pt;
}
#media (max-width: 480px) {
.someclass {
font-size: 8pt;
}
}
.someclass2 {
color: red;
font-size: 20pt;
}
#media (max-width: 480px) {
.someclass2 {
font-size: 15pt;
}
}
On a side note your selectors are very complex which could be adding to your problems. Here’s some tips:
section#maria-trindade.caixa-destaque .title h2 {
font-size: 30px;
}
In the above rule you don’t need the section or class #maria-trindade .title h2 should be every you require and simplifies the specificity, see: https://stuffandnonsense.co.uk/archives/css_specificity_wars.html
I would also recommend looking at using something like BEM as it keeps your classes simpler: http://getbem.com/
And also some utility classes, for example, all your red titles have the same visual styling but each have a long and complex selector.
<h2 class="t-1">My title</h2>
/* style for primary headers */
.t-1 {
font-size: 100px;
color: rgba(233, 26, 26, 1);
text-shadow: 4px 4px black;
}
You can the reuse this simple style and if the structure of your HTML changes you do not need to edit the CSS.
I hope this helps! :)
Related
p tag occupying 100% of size
In my project I have a problem. In the last area of the site I have a text written "Example" and an image on the side, but for some reason the image is below the text. I wanted to do the same thing as the top div, but invert the text on the left and the image on the right, does anyone know how I put the text up? Code: #import url('https://fonts.googleapis.com/css?family=Manjari&display=swap'); *{ margin: 0; padding: 0; outline: 0; box-sizing: border-box; } html, body, #root, .render{ height: 100%; } body { background: #111; font-family: 'Manjari', sans-serif; } .mainBanner { background: url('https://i.ibb.co/7XY9yyb/fundo.jpg'); height: 100%; width: 100%; } .variacao { height: 12%; background-image: linear-gradient(to bottom, transparent 0%, #111 100%); position: absolute; bottom: 0; left: 0; right: 0; } .wall { background: rgba(0, 0, 0, 0.5); height: 100%; overflow: auto; width: 100%; } .topContainer { margin-top: 15px; } .topContainer h1 { font-size: 35px; text-align: center; color: #e50914; } .wellcomemsg { text-align: center; margin-top: 8%; font-size: 5vw; text-shadow: 1px 2px 3px rgba(255, 255, 255, 0.6); color: #FFF; } .btns button { margin: 0 auto; padding: 15px 20px; margin-top: 5px; cursor: pointer; border-radius: 3px; margin-left: 10px; border: 1px solid #e50914; background: #e50914; color: #FFF; font-size: 22px; } .multi { position: relative; } .multi p { color: #FFF; font-size: 2vw; word-wrap: break-word; float: right; margin-right: 70px; margin-top: 12%; } .multi img { margin-bottom: 5%; opacity: 0.95; margin-left: 60px; width: 30%; margin-top: 4%; cursor: pointer; } .multi img:hover { opacity: 1; } .down { position: relative; } .down p { color: #FFF; font-size: 2vw; word-wrap: break-word; margin-left: 70px; margin-top: 12%; } .down img { margin-bottom: 5%; opacity: 0.95; margin-right: 60px; width: 30%; float: right; margin-top: 0%; cursor: pointer; } .down img:hover { opacity: 1; } hr { border-color: #ccc; width: 90%; margin: 0 auto; } #media only screen and (max-width: 600px) { .wellcomemsg { font-size: 30px; margin-top: 8vh; } .btns button { margin-top: 20px; font-size: 20px; } .multi img { margin-top: 30px; width: 90%; margin-left: 5%; } .multi p { width: 100%; margin-top: 8%; margin-right: 0; text-align: center; font-size: 20px; } } <div class="render"> <div class="mainBanner"> <div class="wall"> <div class="topContainer"> <h1>IMM | YouWatch</h1> </div> <div class="wellcomemsg"> <p>Bem-vindo a YouWatch</p> <p>Cria uma conta gratis ou experimenta</p> <p>Uma conta paga durante 1 Mês</p> <div class="btns"> <button>Criar uma conta</button> <button>Iniciar Sessão</button> </div> </div> <div class="variacao"></div> </div> </div> <div class="multi"> <img src="https://i.ibb.co/q9s3R9v/multi.png" alt="Multi Plataformas" title="Multi Plataformas"/> <p>Veja os seus filmes e series favoritos onde e quando quiser!</p> </div> <hr /> <div class="down"> <p>Example</p> <img src="https://i.ibb.co/q9s3R9v/multi.png" alt="Multi Plataformas" title="Multi Plataformas"/> </div> <hr /> <p>T</p> </div>
The image is underneath the 'Example' line in your code, surely this is why? <div class="down"> <p>Example</p> <img src="https://i.ibb.co/q9s3R9v/multi.png" alt="Multi Plataformas" title="Multi Plataformas"/> </div>
You can use the below css: .down p { display: inline-block; }
web page layout problems
I am working on web page layouts. I created this one. https://codepen.io/iamgonge/pen/paOxxb I dont understand why the .container .left-side and .right-side elements start at the top of the browser and not below the header. Shouldn't the layout out be header->section(hero)->section(one)? I would think that the top of any of those three divs would be underneath the header but they are not. What amy I not understanding here? body { font-family: Verdana, Geneva, sans-serif; margin: 0; padding: 0; } .container { background: #333338; display: inline-block; width: 60%; height: 800px; } header { position: fixed; background: #10105f; width: 100%; height: 150px; } .main-links a { text-decoration: none; color: #fff; font-size: 20px; text-transform: uppercase; } .main-links a:hover { color: #00843d; } .main-links a:active { color: red; } .left-side { display: inline-block; width: 20%; background: #4C4C59; height: 800px; float: left; } nav { position: absolute; bottom: 0; left: 0; height: 50px; width: 100%; text-align: center; } nav ul { margin: auto; padding: 0; display: inline-block; list-style: none; color: #fff; // border: 1px solid #00843D; width: 60%; ; } nav li { display: inline-block; margin: 5px -3px; padding: 5px 10px; // border: 1px solid#fff; } nav li:hover { background: rgba(255, 255, 255, 0.25); } nav li:active { border-bottom: 2px solid red; color: red; } .nav-left { float: left; height: 50px; width: 20%; padding-bottom: 96px; // border: 1px solid #00843D; } .nav-right { float: right; height: 50px; width: 20%; padding-bottom: 96px; //border: 1px solid #00843D; } .nav-center { position: relative; padding-bottom: 21px; margin: 0 auto; height: 75px; width: 300px; // border: 1px solid #00843D; } .nav-right p a { font-size: 16px; text-decoration: none; color: #fff; } .nav-right p a:hover { color: #00843d; } .nav-right p { margin: 20px; padding: 0; color: #fff; } .one { display: block; width: 100%; height: 800px; background: #080853; } .right-side { display: inline-block; width: 20%; background: #4C4C59; height: 800px; float: right; } .rss-title, .rss-date { margin: 0px!important; } .rss-feed { margin: 10px 5px 20px 0px; } .rss-date { padding: 0; font-size: 12px; font-style: italic; } .hero, .one { position: relative; height: 100%; } .success { display: block; text-align: center; margin-top: 20%; font-size: 69px; color: #00843d; // margin-left: auto; // margin-right: auto; } .success:hover { font-size: 71px; } #timestamp { margin: 10px 5px 20px 0px; text-align: center; color: #fff; font-size: 16px; } #timestamp, .rss-feed { background: #080853; padding: 10px; height: 110px; } #media (min-width:1530px) {} <body> <header> <div class="nav-left"> <div id="timestamp"></div> </div> <div class="nav-right"></div> <div class="nav-center"></div> <nav> <ul class="main-nav"> <li class="main-links">home</li> <li class="main-links">about</li> <li class="main-links">projects</li> <li class="main-links">portal</li> <li class="main-links">links</li> </ul> </nav> </header> <section="hero"> <div class="left-side"></div> <div class="right-side"></div> <div class="container"> <div class="success"></div> </div> <!--***Container***--> </section> <section class="one"></section> </body>
The reason is that you have applied position: fixed; to your <header> tag. When you do this you must account for the height of the header and push down other elements to restore the layout.
Is there any better way to build this the correct semantic way?
Could anybody help me and have a look at my HTML page, and explain to me if this is a correct semantic way to set-up a HTML page? I need to learn to build a webpage with as less divs as possible, but you can use them if you want to style something specific right? like I used them in this context. So are there any any flaws in my HTML code? .main-club-bar-music-festival { overflow: auto; } .main-club-bar-music-festival h3 { margin: 0; } .img-club-air { position: relative; } .img-club-air img { width: 100%; } .img-club-air a:first-child { position: absolute; margin: 10px; width: 60px; right: 0; bottom: 0; z-index: 1; } .img-club-air h2 { position: absolute; bottom: 0; font-size: 20px; width: 100%; padding: 10px; color: white; font-family: "LemonMilk" } #paragraph-p { padding: 20px; margin: 0; } .rent-a-bike { width: 200px; margin: 20px auto; text-align: center; background-color: #eb6c74; } .rent-a-bike p { margin: 0; padding: 10px; color: white; text-transform: capitalize; transform: translateX(-5%); overflow: hidden; } .rent-a-bike img { margin-top: 10px; margin-left: 5px; height: 38px; float: left; } .show-me-the-way { width: 200px; margin: 20px auto; text-align: center; background-color: #eb6c74; } .show-me-the-way p { margin: 0; padding: 10px; color: white; text-transform: capitalize; } .show-me-the-way img { height: 38px; float: left; } .info-block { background-color: #eb6c74; color: white; padding: 10px 20px; text-transform: uppercase; font-family: "NeueHaasGrotesk Light"; } .address-club { overflow: auto; margin-bottom: 16px; } .address-club p { padding: 10px 20px 0 20px; margin-bottom: 0; } .address-club img { height: 40px; margin-left: 10px; float: left; margin-right: 10px; } .address-club a { line-height: 40PX; display: block; color: #3b3b3b; text-decoration: underline; } .address-club a[target=_blank] { padding-left: 20px; color: #0000EE; } .padding-info-club { padding: 20px; } .regular-info-left { float: left; width: 49.5%; text-align: center; color: white; } .regular-info-left p:nth-child(1) { margin: 0; } .regular-info-left p:nth-child(2) { margin: 2px 0; } .regular-info-left p:nth-child(3) { margin: 2px 0; } .regular-info-left p { background-color: #3b3b3b; height: 50px; line-height: 50px; text-transform: uppercase; } .regular-info-right { float: right; width: 49.5%; text-align: center; color: white; } .regular-info-right p:nth-child(1) { margin: 0; } .regular-info-right p:nth-child(2) { margin: 2px 0; } .regular-info-right p:nth-child(3) { margin: 2px 0; } .regular-info-right p { background-color: #3b3b3b; height: 50px; line-height: 50px; text-transform: uppercase; } #overflow-regular-info { overflow: auto; } .info-feedback-on-page { margin: 10px 0; border-top: 1px solid #eb6c74; border-bottom: 1px solid #eb6c74; padding: 0px 0px 10px 20px; } .info-feedback-on-page button { border-radius: 40%; background-color: transparent; margin-right: 10px; } #button-yes { background-color: white; border-radius: 28px; border: 2px solid #44c767; color: #44c767; font-size: 15px; padding: 10px 25px; outline: 0; } #button-yes:active { position: relative; top: 2px; outline: 0; } #button-no { background-color: white; border-radius: 28px; border: 2px solid #e35656; color: #e35656; font-size: 15px; padding: 10px 25px; outline: 0; } #button-no:active { position: relative; top: 2px; outline: 0; } <main class="main-club-bar-music-festival"> <div class="img-club-air"> <img src="img/favorite-icon-add.svg" alt="add to favourites"> <img src="img/club-panama.jpg" alt="Club Panama"> <h2>panama</h2> </div> <h3 class="info-block">regular info</h3> <section id="overflow-regular-info"> <div class="regular-info-left"> <p>dancing</p> <p>go out with mates</p> <p>expensive</p> </div> <div class="regular-info-right"> <p>edm</p> <p>locals/foreigners</p> <p>groups</p> </div> </section> <p id="paragraph-p">Panama chose a bit of a peculiar spot to open a nightclub. Located outside the city centre, Panama created a diversified nightclub. The nightclub holds a lot of parties varying from electronic tp 80's and 90s parties. Panama also houses HappyHappyJoyJoy, an asian shared dining restaurant</p> <div class="rent-a-bike"> <a href="http://www.ov-fiets.nl/huurlocaties?locatie=amsterdam&POST_AUTOCOMPLETE=%2Fhuurlocaties.xml" target="_blank"> <img src="img/bicycle-icon.svg" alt="OV-Bicycle"> <p>rent ov-bike <br>€ 3,85,-/24 hour</p> </a> </div> <div class="show-me-the-way"> <a href=""> <img src="img/location-icon.svg" alt="your location to destination"> <p>show me the way</p> </a> </div> <h3 class="info-block">average price for a drink</h3> <p class="padding-info-club">- € 2,30,-</p> <h3 class="info-block">entrance</h3> <p class="padding-info-club">- € 5,00,-</p> <h3 class="info-block">address</h3> <div class="address-club"> <p>Panama <br> Oostelijke Handelskade 4 </p> www.panama.nl 020 311 86 86<img src="img/phone-icon.svg" alt="call-icon"> </div> <h3 class="info-block">opening hours</h3> <p class="padding-info-club">Fr - Su: 21:00 - 05:00pm</p> <div class="info-feedback-on-page"> <p>Was this information usefull for you as an international student?</p> <button id="button-yes">yes</button> <button id="button-no">no</button> </div> </main>
Having troubles with #media
Im just staring with #media css3, and my trouble here is to set responsive, and i dont really get it how to divide this in 2 when the screen goes to 900px i know its # media screen (max-width: 900px) {} but i cant made the code inside work to divide in 2 .row { width: 100%; height: auto; clear: both; float: left; } .contenido{ width: 985px; margin: 0 auto; text-align: left; clear: both; } .lenovoDescripcion .contenido { width: 978px; margin: 0 auto; text-align: left; clear: both; padding-left: 3px; padding-right: 4px; } .lenovoDescripcion .producto { padding-top: 25px; float: left; padding-bottom: 25px; } .lenovoDescripcion .producto img { width: auto; height: auto; float: left; margin-right: 30px; margin-top: 110px; } .lenovoDescripcion .descripcion { float: right; text-align: left; } .lenovoDescripcion .descripcion h2 { color: #0084b0; font-size: 37px; font-weight: normal; height: 43px; overflow: hidden; margin-left: 50%; } .lenovoDescripcion .descripcion h3 { color: #cc7000; font-size: 29px; font-weight: normal; height: auto; overflow: hidden; margin-left: 35%; margin-top: -10px; } .lenovoDescripcion .descripcion p { color: #373737; font-size: 16px; font-style: bold; font-weight: normal; height: auto; overflow: hidden; margin-left: 35%; margin-top: 0; } .lenovoDescripcion .descripcion h4 { color: #c6c6c6; font-size: 16px; font-weight: normal; height: auto; overflow: hidden; margin-left: 35%; margin-bottom: 0; } .lenovoDescripcion .descripcion h5 { color: #0084b0; font-size: 16px; font-weight: normal; height: auto; overflow: hidden; margin-left: 60%; margin-top: -35px; } .lenovoDescripcion .descripcion li { font-size: 14px; line-height: auto; color: #7d7c7c; height: auto; overflow: hidden; margin-left: 30%; width: 100%; } .lenovoDescripcion .descripcion a { text-decoration: none; color: #FFFFFF; border: 1px solid #ff4500; padding: 8px; background-color: #ff4500; margin-left: 60%; transition: all linear .15s; } .lenovoDescripcion .descripcion a:hover { background-color: #b33000; border: 1px solid #FFFFFF; } strike { font-size: 16px; margin-left: 35%; color: #c6c6c6; } hr { display: block; border: 1px dotted #000000; width: 30%; } footer hr { display: block; border: 1px solid #000000; width: 100%; } <div class="row lenovoDescripcion"> <div class="contenido"> <div class="producto"> <img src="images/Productos/pc2.png"> <div class="descripcion"> <h2>IDEAPAD S400</h2> <h5>(59402530)</h5> <h4>Precio de lista</h4 > <strike>$1,399,000.00</strike> <hr> <p>Precio con descuento 10%</p> <h3>$1,259,100.00</h3> <ul> <li>Fully optimized with recognizable touch gestures for the Windows 8.1 experience</li> <li>Added dual-mode functionality to easily convert from a mouse to pointer</li> <li>Winner of the Reddot Design Award</li> </ul> <span>DESCUBRE Y COMPRA</span> </div> </div> </div><!-- Producto --> </div><!-- row -->
You need to do so with the width attribute and floats. Here is 1 example: http://jsfiddle.net/cUCvY/1/ HTML: <div class="wrapper"> <div id="one">one</div> <div id="two">two</div> </div> CSS: .wrapper { border : 2px solid #000; overflow:hidden; } .wrapper div { min-height: 200px; padding: 10px; } #one { background-color: gray; float:left; margin-right:20px; width:140px; border-right:2px solid #000; } #two { background-color: white; overflow:hidden; margin:10px; min-height:170px; } #media screen and (max-width: 400px) { #one { float: none; margin-right:0; width:auto; border:0; border-bottom:2px solid #000; } }
3 DIV side by side wont align correctly
I'm sure this is a facepalm moment for me, but a need some fresh eyes to have a look and tell me what I'm doing wrong... because I can't spot it! That last button on the right needs to be in line with the other two, please help. body { padding: 0; margin: 0; font-family: Arial, sans-serif; font-size: 14px; color: #333; } p { line-height: 1.65em; margin: 0 0 1em 0; } h1, h2, h3, h4, h5, h6 { margin: 0 0 1em 0; font-weight: normal; } /* BUTTON CONTAINER */ #buttoncointainer { width: 100%; } .buttontext { font-size: 175%; font: #fff; } /* LEFT BUTTON */ #arrowleft { float: left; width: 20%; height: 40px; background: #FFFFFF; border: 1px solid #005698; margin-right: 3px; position: relative; } #arrowleft:hover { float: left; width: 20%; height: 40px; background: #ECECEC; } .leftarrow { float: left; width: 100%; display: table-cell; vertical-align: middle; text-align: center; height: 40px; } .leftarrow a:hover { color: #006ec3; } .leftarrow a { text-decoration:none; color: #fff; } /* SHARE BUTTON */ #sharebutton { width: 40%; margin: 0 auto; text-align: center; background: #005698; height: 40px; border: 1px solid #005698; } #sharebutton:hover { width: 40%; text-align: center; background: #006ec3; height: 40px; } .fb-share-text { color: #fff; text-align: center; } .sbutton { margin: 0 auto; } .sbutton a { text-decoration:none; display:block } .sbutton a:hover { text-decoration:none; display:block; color: #006ec3; } /* RIGHT BUTTON */ #arrowright { float: right; width: 20%; height: 40px; background: #FFFFFF; border: 1px solid #005698; margin-left: 3px; position: relative; } #arrowright:hover { float: right; width: 20%; height: 40px; background: #ECECEC; } .rightarrow { float: right; width: 100%; display: table-cell; vertical-align: middle; text-align: center; height: 40px; } .rightarrow a:hover { color: #006ec3; } .rightarrow a { text-decoration:none; color: #fff; } <div id="buttoncointainer"> <div id="arrowleft"> <div class="leftarrow"> <p class="buttontext"> ◄ </p> </div> </div> <div id="sharebutton"> <div class="sbutton"> <p class="buttontext"> Share </p> </div> </div> <div id="arrowright"> <div class="rightarrow"> <p class="buttontext"> ► </p> </div> </div> </div>
Change the order of your html for your code to take hold... The float:right; element should be before the center aligned element. body { padding: 0; margin: 0; font-family: Arial, sans-serif; font-size: 14px; color: #333; } p { line-height: 1.65em; margin: 0 0 1em 0; } h1, h2, h3, h4, h5, h6 { margin: 0 0 1em 0; font-weight: normal; } /* BUTTON CONTAINER */ #buttoncointainer { width: 100%; } .buttontext { font-size: 175%; font: #fff; } /* LEFT BUTTON */ #arrowleft { float: left; width: 20%; height: 40px; background: #FFFFFF; border: 1px solid #005698; margin-right: 3px; position: relative; } #arrowleft:hover { float: left; width: 20%; height: 40px; background: #ECECEC; } .leftarrow { float: left; width: 100%; display: table-cell; vertical-align: middle; text-align: center; height: 40px; } .leftarrow a:hover { color: #006ec3; } .leftarrow a { text-decoration: none; color: #fff; } /* SHARE BUTTON */ #sharebutton { width: 40%; margin: 0 auto; text-align: center; background: #005698; height: 40px; border: 1px solid #005698; } #sharebutton:hover { width: 40%; text-align: center; background: #006ec3; height: 40px; } .fb-share-text { color: #fff; text-align: center; } .sbutton { margin: 0 auto; } .sbutton a { text-decoration: none; display: block } .sbutton a:hover { text-decoration: none; display: block; color: #006ec3; } /* RIGHT BUTTON */ #arrowright { float: right; width: 20%; height: 40px; background: #FFFFFF; border: 1px solid #005698; margin-left: 3px; position: relative; } #arrowright:hover { float: right; width: 20%; height: 40px; background: #ECECEC; } .rightarrow { float: right; width: 100%; display: table-cell; vertical-align: middle; text-align: center; height: 40px; } .rightarrow a:hover { color: #006ec3; } .rightarrow a { text-decoration: none; color: #fff; } <div id="buttoncointainer"> <div id="arrowleft"> <div class="leftarrow"> <p class="buttontext"> ◄ </p> </div> </div> <div id="arrowright"> <div class="rightarrow"> <p class="buttontext"> ► </p> </div> </div> <div id="sharebutton"> <div class="sbutton"> <p class="buttontext"> Share </p> </div> </div> </div>
I've made you a fiddle here http://jsfiddle.net/vmb0sfag/3/ Use float left on your main elements: body { padding: 0; margin: 0; font-family: Arial, sans-serif; font-size: 14px; color: #333; } p { line-height: 1.65em; margin: 0 0 1em 0; } h1, h2, h3, h4, h5, h6 { margin: 0 0 1em 0; font-weight: normal; } /* BUTTON CONTAINER */ #buttoncointainer { width: 100%; } .buttontext { font-size: 175%; font: #fff; } /* LEFT BUTTON */ #arrowleft { float: left; width: 20%; height: 40px; background: #FFFFFF; border: 1px solid #005698; margin-right: 3px; position: relative; float: left; } #arrowleft:hover { float: left; width: 20%; height: 40px; background: #ECECEC; } .leftarrow { float: left; width: 100%; display: table-cell; vertical-align: middle; text-align: center; height: 40px; float: left; } .leftarrow a:hover { color: #006ec3; } .leftarrow a { text-decoration:none; color: #fff; } /* SHARE BUTTON */ #sharebutton { float: left; width: 40%; margin: 0 auto; text-align: center; background: #005698; height: 40px; border: 1px solid #005698; } #sharebutton:hover { width: 40%; text-align: center; background: #006ec3; height: 40px; } .fb-share-text { color: #fff; text-align: center; } .sbutton { margin: 0 auto; } .sbutton a { text-decoration:none; display:block } .sbutton a:hover { text-decoration:none; display:block; color: #006ec3; } /* RIGHT BUTTON */ #arrowright { float: right; width: 20%; height: 40px; background: #FFFFFF; border: 1px solid #005698; margin-left: 3px; position: relative; float: left; } #arrowright:hover { float: left; width: 20%; height: 40px; background: #ECECEC; } .rightarrow { float: right; width: 100%; display: table-cell; vertical-align: middle; text-align: center; height: 40px; } .rightarrow a:hover { color: #006ec3; } .rightarrow a { text-decoration:none; color: #fff; }