r/csshelp • u/icemann155 • Aug 20 '21
Request Newbie css help. block getting ignored when I add 1 line of code.
Hi All,
Not sure whats wrong so I figured I would ask. When I enter a line of code it completely negates the entire block. Everything looks correct on my end and its bugging me. I'm guessing the error is human and I'm just not seeing it but that doesn't make it any less frustrating!
HTML
<!DOCTYPE html><html><head><title>CSS Cheat Sheet</title><link rel="stylesheet" type="text/css" href="styles.css"></head><body><div class="container"><div class="box-1"><h1>Hello World</h1><p>
Lorem ipsum, dolor sit amet consectetur adipisicing elit.
Cupiditate libero laborum a quod odit deserunt porro, eaque corporis repellendus,
nesciunt tempore ipsa eligendi tempora! Asperiores veritatis natus cum quis sit!
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Commodi nobis rem fugit,
nulla blanditiis voluptate accusantium tempora voluptas officiis architecto.
Repudiandae voluptas error ex reprehenderit fugit! Impedit minima amet libero!
Lorem ipsum dolor sit amet consectetur adipisicing elit. Ullam quia amet est atque,
voluptatum perferendis optio nobis tempora dolore quisquam odio delectus et sunt
porro repudiandae? Fugiat et aliquam delectus?</p></div></div></body></html>
CSS
body{background-color:#f4f4f4;color:#555555;font-family:
font-size: 16px;font-weight:normal;/* Same as above *//* font:normal 10px Arial, Helvetica, sans-serif */line-height:1.6em;margin:0}.container{width:80%;margin:5px 10px;}.box-1{background-color:#333;color:#fff
}
when I add this line of code to the .box-1 class
border-right:5px red ;
all the css elements in .box-1 are ignored and it doesn't process the border. Any ideas on what I've done wrong?
1
u/icemann155 Aug 20 '21
Also new to posting code. Not sure if I did something wrong as the formatting looks absolutely horrible.
1
u/Zmodem Moderator Aug 21 '21
Hey!
For future reference, you can place four spaces on each new line before your code, and those lines will be treated like code.
This is code { with four spaces};.sample-class { display: none; }
You can also use ticks to make inline code blocks,
{just like this}.`ticks`1
3
u/curie2353 Aug 20 '21 edited Aug 20 '21
I am also still learning CSS. I pasted your code to codepen and noticed a missed semicolon in
.box-1after the color. Other than that everything worked withborder-right: red 5px solid;I think it wouldn't show the border without specifying what kind of border it is?
https://codepen.io/yokaion/pen/wvdVVLY