Really need some help styling html - html

I can't seem to figure out why my style attributes aren't having an effect on my divs. The only one that seems to work is the body tag.
It's for a course I'm currently doing. I feel like I've tried everything but can't get it to work. I'm pretty sure it's something minor that I'm missing but it is really frustrating me.
body {
font-family: Arial, Helvetica, sans-serif;
margin: 0;
float: left;
}
PageBanner {
margin: 0;
width: 100%;
float: none;
width: 50px;
}
NavBar {
background: #FD0C10;
}
Header {
text-align: center;
margin-bottom: 20px;
}
Subheading {
text-align: center;
}
Content {}
Footer {}
body>
<div wrapper="Mainwrapper">
<div class="PageBanner"><img src="../images/banner.jpg" alt="PageBanner"></div>
<div class="Navbar">
<ul>
<li>
</li>
<li>
</li>
</ul>
</div>
<div class="Header">
<h1>The Club Site</h1>
</div>
<div class="SubHeading">
<h2>Members Prices</h2>
</div>
<div class="Content">
</div>
<div class="Footer">
</div>
</div>
<!--Mainwrapper-->
</body>

Have the css class definition like .PageBanner which will work like you expected PageBanner refers to a tag with name PageBanner. And #PageBanner refers to an element which has id PageBanner
body {
font-family: Arial, Helvetica, sans-serif;
margin: 0;
float: left;
background: color: red;
}
.PageBanner {
margin: 0;
width: 100%;
float: none;
width: 50px;
background:red;
}
.NavBar {
background: #FD0C10;
}
.Header {
text-align: center;
margin-bottom: 20px;
}
.Subheading {
text-align: center;
}
.Content {}
.Footer {}
<div wrapper="Mainwrapper">
<div class="PageBanner"><img src="../images/banner.jpg" alt="PageBanner">
</div>
<div class="Navbar">
<ul>
<li>
</li>
<li>
</li>
</ul>
</div>
<div class="Header">
<h1>The Club Site</h1>
</div>
<div class="SubHeading">
<h2>Members Prices</h2>
</div>
<div class="Content">
</div>
<div class="Footer">
</div>
</div>
<!--Mainwrapper-->

You need to put a CSS Selector
to make your style work.
Selector Example Example description
.class .Header Selects all elements with class="Header"
<div class="Header">
#id #firstname Selects the element with id="firstname"
<input id="firstname">
Please do read this link for more info about CSS Selector Reference.
https://www.w3schools.com/cssref/css_selectors.asp

The answer has been given. But make sure to pay close attention to how you write your CSS because this case you were trying to define a class but was missing the dot .class but also you can do ids which are defined #class. You had a good approach you were just missing the signifying selector.

Related

Why is there a gap in color at the bottom of my webpage?

I have attached my HTML along with my CSS code and a picture of the webpage. I can not figure out why there is a gap in the red background color at the bottom. Any help is much appreciated
/*
Landon Byrd
Fall 2021
Plain Red #f60d41
Rich Red #f6130d
Orioles Orange #f64d0d
Sunset Orange #f6870d
Golden Yellow #f6c10d
*/
/* Global settings */
h1 {
text-align: center;
font-family: Papyrus
}
h2 {
text-align: center;
color: #f6130d;
text-decoration: underline
}
.wrapper {
width: 85%;
margin: 0 auto;
max-width: 960px;
}
/* Nav Section */
.nav {
width: 85%;
margin: 0 auto;
background-color: #f6130d;
text-align: center;
}
.menu {
float: left;
width: 25%
}
/* Main section */
.banner {
justify-content: center;
background-color: #f6c10d;
text-align: center;
}
.bulletPoints {
text-align: center;
}
section {
background-color: #f6870d;
color: #f60d41;
font-style: italic;
margin: 25px 50px 75px;
}
body {
background-image: url("images/background.jpeg");
}
.image1 {
display: block;
margin-left: auto;
margin-right: auto;
}
figcaption {
text-align: center;
}
.row {
display: flex;
}
.column {
flex: 33.33%;
padding: 5px;
}
/* Footer section */
* {
box-sizing: border-box;
}
.footer {
text-align: center;
background-color: #f6130d;
color: #f6c10d;
}
.box {
float: left;
width: 33.33%
}
.footer::after {
content: "";
clear: both;
display: table;
}
/* Copyright section */
.copyright {
text-align: center;
background-color: #f6130d;
color: #f6c10d;
}
<!DOCTYPE html>
<head>
<title>Augie's Custom T-shirts</title>
<meta charset="utf-8">
<link href="Style.css" rel="stylesheet">
</head>
<body>
<nav class="nav">
<div class="menu">
<p>Home</p>
</div>
<div class="menu">
<p>Shop</p>
</div>
<div class="menu">
<p>Events</p>
</div>
<div class="menu">
<p>Contact Us</p>
</div>
<br/>
<br/>
</nav>
<main class="wrapper">
<div class="banner">
<h1><span class="name">Augie's Custom T-shirts</span></h1>
<h2>Custom T-shirts for you or your party.</h2>
<div class="bulletPoints">
<ul>
<li>Birthday parties</li>
<li>Vacation groups</li>
<li>Bachelorette Parties</li>
<li>Family reunions</li>
<li>Work team rewards</li>
<li>Business promotions</li>
</ul>
</div>
<br/>
</div>
<p id="Catch">
Do you have an event coming up, and want everyone to get in the spirit? T-shirts can bring a group together, make everyone feel connected, and let everyone know what you're celebrating.
</p>
<p>T-shirts can also be a great gift to someone that acknowledges their special interest or hobby.</p>
<p>Choose from one of our unique designs, or let us put your own design on a shirt for you.</p>
<div class="row">
<div class="column">
<img src="images/gorilla.jpg" alt="Gorilla" style="width:100%">
</div>
<div class="column">
<img src="images/pink.jpg" alt="Pink" style="width:100%">
</div>
<div class="column">
<img src="images/skull.jpg" alt="Skull" style="width:100%">
</div>
</div>
<p><strong>How it works:</strong></p>
<p>Browse our selection of unique designs, select the size and colors of the shirts you would like, and place your order. We will ship your shirts within three business days for in-stock shirts, or five days for custom size and colors.</p>
<figure>
<img src="images/t-shirt-colors.jpeg" alt="T-shirt colors" class="image1">
<figcaption>Choose from are variety of t-shirt colors!</figcaption>
</figure>
<p>Have a design of your own? Can't find the right sentiment? Call or email us to discuss the possibilities or get some ideas for your event.</p>
<p>Please note there will be a one time $15 charge for any custom graphics design.</p>
<h2><em>Contact us today!</em></h2>
</main>
<footer class="footer">
<div class="box">
<p>Augie's Custom T-shirts</p>
<p>(478) 555-1212</p>
<p>augieB#augiesTees.com</p>
<br/>
</div>
<div class="box">
<p>Check out are Social Media for updates!</p>
<p>Facebook:</p>
<p>Instagram:</p>
<p>Twitter:</p>
</div>
<div class="box">
<p>Locations:</p>
<br/>
<p>100 Tanger Dr, Locust Grove, GA</p>
<p>2954 Watson Blvd Suite 100, Warner Robins, GA</p>
</div>
</footer>
<div class="copyright">
<h3> #copyright: Landon Byrd</h3>
<p>Fall 2021, All Rights Reserved</p>
</div>
<p>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" />
</a>
</p>
</div>
</body>
Side note my verified CSS checker image is also not showing up at the very bottom of the page and the HTML checker is giving me the following error
Error: Stray end tag div.
From line 123, column 1; to line 123, column 6
just add h3{ margin-top: 0px; } to your css code to remove the white line between the red divs at the bottom of the side
add the div with 'class=copyright' inside the footer and remove the extra </div> at last
that h3 tag in your .copyright div taking the default
margin-block-start: 1em;
margin-block-end: 1em;
you can use
.copyright h3{
margin-block:0;
}
this will remove the white space..
or you can use
*{
margin:0;
padding:0;
}
this will remove the default margin and padding from the page

Changing line height without affecting the background color

I'm currently working on freecodecamp's first test, so my question is probably dumb. I would like to change the line-height of #titles to a smaller one, while keeping it's background color. It's probably the display element, but I can't figure out what to do. Also, I'd like to get rid of the white line surrounding my image, right before the border...
<div id="main">
<div id="titles">
<h1 id="title">A tribute to Ocelote</h1>
<h2 id="title2">The man who has done it all.</h2>
</div>
<hr>
<div id="img-div">
<img id="image" src="https://theshotcaller.net/wp-content/uploads/2017/09/IMG_5488-1.jpg" alt="A photo of Ocelote">
<div id="img-caption"> A story of how far can one go, if only the desire is
there.
</div>
<div id="tribute-info">
<br>
<br>
fgj
</div>
<a id="tribute-link" href="https://lol.gamepedia.com/Ocelote" target="_blank"> </a>
</div>
</div>
https://jsfiddle.net/deffciu/hrna0Lfs/
any help is appreciated
Adding the below two rules to #titles makes it work:
#titles {
display: block;
background: #6C7E95;
line-height: 5px;
/* Add the below two rules */
overflow: hidden;
padding: 0 0 20px;
}
You get this:
Snippet
html, body {
font-family: 'Oswald', sans-serif;
text-align: center;
background: white;
}
#title2 {
color: #052449;
margin-bottom: 0px;
}
#titles {
display: block;
background: #6C7E95;
line-height: 5px;
/* Add the below two rules */
overflow: hidden;
padding: 0 0 20px;
}
#image {
border: 8px solid #052449;
border-radius: 50%;
width: 500px;
height: 375px;
margin-top: 15px;
}
hr {
border-color: #486282;
margin-top:0px;
}
#img-caption {
margin-top: 20px;
font-style: italic;
font-size: 25px;;
}
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<link href="https://fonts.googleapis.com/css?family=Oswald" rel="stylesheet">
<div id="main">
<div id="titles">
<h1 id="title">A tribute to Ocelote</h1>
<h2 id="title2">The man who has done it all.</h2>
</div>
<hr>
<div id="img-div">
<img id="image" src="https://theshotcaller.net/wp-content/uploads/2017/09/IMG_5488-1.jpg" alt="A photo of Ocelote">
<div id="img-caption"> A story of how far can one go, if only the desire is there.
</div>
<div id="tribute-info">
<br>
<br>
fgj
</div>
<a id="tribute-link" href="https://lol.gamepedia.com/Ocelote" target="_blank"> </a>
</div>
</div>
For the white border issue, it's your body's margins. The below code will fix it.
body {margin: 0;}

Sidebar links unclickable, unselectable

I'm pretty comfortable with basic html/css, but I've been really tripped up by a problem in a tumblr theme I'm working on. The text in my sidebar can't be selected, and the links do not work. I've read about people having problems where they put a div inside of a span tag, or because of a position:absolute, but I don't think that either of those are the issue. You can view the very unfinished site here.
Edit: including the relevant code
<header id="masthead">
<div id="header">
{block:IfMastheadPortrait}
<img src="{PortraitURL-128}"/>
{/block:IfMastheadPortrait}
<div id="big">{Title}</div>
<div id="goto">About //
Contact</div>
{block:Description}
<p>{Description}</p>
{block:Description}
</div>
<!--Navigation-->
<nav>
<div id="linx">
<span style="background-color: #007A5E">Design</span>
<br />
<span style="background-color: #007A5E">Drawing & Painting</span>
<br />
<span style="background-color: #007A5E"> Photography</span>
<br />
<span style="background-color: #007A5E">Mixed Media</span>
</div>
<br />
</nav>
</header>
And the CSS
#big {
color: {color:Masthead links};
font-size: 40px;
font-family: 'Codystar', sans-serif;
text-align: center;
}
#masthead {
background: {color:Masthead background} url('{image:Masthead}');
opacity: 0.7;
padding: 2%;
color: {color:Masthead text};
font-size:10.5px;
width: 180px;
height: 100%;
position: fixed;
float:left;
xmargin: {text:Post margin};
}
#masthead a {
color: {color:Masthead links};
}
nav li {
display: inline;
}
#linx {
text-align:center;
font-size:15px;
line-height:1.5;
font-family: {font:body} ;
color: #007A5E;
}
#linx a {
color:#000;
}
#goto {
text-align:center;
line-height:3;
}
#goto a {
color:#00A37D;
}
Give the sidebar a z-index so it sits on top of #content:
#masthead {
z-index: 1;
}
Just a heads up, xmargin isn't a thing. :D

How to make a href link to a name AND not bring it to the top of site

here's what I'm using
<h1>Red to Violet</h1>
first .
second .
<div id="section">
<div class="innersections">
<a name="one"></a>
(text)
</div> <hr>
<div class="innersections">
<a name="two"></a>
(text)
</div></div>
I want it so that when I click a link, it doesn't take the page up and I can't see the title 'red to violet' but I can see the second 'innersections' if I clicked 'second'.
note; I can only use css/html codes.
Use id with element you want to navigate to.
<h1>Red to Violet</h1>
first .
second .
<div id="section">
<div class="innersections">
<a id="one" name="one"></a>
(text)
</div> <hr>
<div class="innersections">
<a id="two" name="two"></a>
(text)
</div></div>
If you wnat the h1 header to remain at the top, you can use position:fixed;top:0.
Here is a JSFiddle that illustrates this: http://jsfiddle.net/VZjdN/ (I've made some small changes to your HTML. If you don't want to use an HTML5 header tag, you can use a div.)
The full CSS is:
header {
position: fixed;
top: 0;
background: white;
width: 100%;
}
.innersections {
padding-top: 5em;
}
And the modified mark-up:
<body>
<header>
<h1>Red to Violet</h1>
first. second.
</header>
<div id="section">
<a name="one"></a>
<div class="innersections" style="padding-top:6em">
<h2>Inner 1</h2>
<div style="height:800px"></div> <!-- filler -->
</div>
<hr>
<a name="two"></a>
<div class="innersections" style="padding-top:4em">
<h2>Inner 2</h2>
<div style="height:800px"></div> <!-- filler -->
</div>
</div>
</body>
SOLVED
http://jsfiddle.net/GPRVX/
.section {
margin-top: 8em;
}
.fix {
height: 7em;
top:0; left: 0;
position: fixed;
background: white;
margin: 0;
padding: 0.5em;
width: 100%;
}
.innersections {
padding: 0.5em;
}
.section a:before {
display:block;
content:"";
height:8em;
margin:-8em 0 0;
}

duplicating div background

I'm trying to build a small website that is one page with 5 stacked divs within the body. The first and second div are fine but all the divs after that(3, 4, and 5) all repeat the unique background image when the site is viewed in IE9. The site works fine in FF 20.0.1, IE10, IE 10 compatibility, and IE9 compatibility so this issues appears to only show up in IE9. I have taken everything out of the CSS and html except for just those 5 containers and find that I can't pinpoint the issue causing the background images to duplicate in the 3rd, 4th, and 5th div. I've also repeated the second div and it also duplicates the background in the second instance. If anyone has any insight as to what I am missing I would greatly appreciate it.
Also, I have played with no-repeat and other ideas I found while searching for a solution but nothing has worked for me at this point.
CSS:
* {
list-style: none;
margin: 0;
padding: 0;
text-decoration: none;
}
body {
font-family: Myriad, Arial, Helvetica, sans-serif;
}
p {
margin-bottom: 1em;
}
a {
color: #60789c;
text-decoration: none;
}
a:visited {
color: #60789c;
}
img {
border: 0;
}
body {
margin-bottom: 0px;
margin-top: 0px;
}
div#content {
margin: auto;
padding: 0;
width: 900px;
}
div#SectionOne {
Background-image: url(../images/section1.jpg);
height: 707px;
width: 100%;
}
div#SectionTwo {
Background-image: url(../images/section2.jpg);
color: #FFFFFF;
height: 1159px;
width: 100%;
}
div#SectionThree {
Background-image: url(../images/section3.jpg);
height: 668px;
width: 100%;
}
div#SectionFour {
Background-image: url(../images/section4.jpg);
height: 1385px;
width: 100%;
}
div#SectionFive {
Background-image: url(../images/section5.jpg);
height: 1165px;
width: 100%;
}
And this is the HTML:
<body>
<div id="content">
<div id="SectionOne">
</div>
<div id="SectionTwo">
<a name="SectionTwo" />
</div>
<div id="SectionThree">
<a name="SectionThree"/>
</div>
<div id="SectionFour">
<a name="SectionFour"/>
</div>
<div id="SectionFive">
<a name="SectionFive"/>
</div>
</div>
</body>
Close your a tags like this <a name="SectionXXX"></a> rather than this <a name="SectionXXX" />
HTML
<div id="content">
<div id="SectionOne">
</div>
<div id="SectionTwo">
<a name="SectionTwo"></a>
</div>
<div id="SectionThree">
<a name="SectionThree"></a>
</div>
<div id="SectionFour">
<a name="SectionFour"></a>
</div>
<div id="SectionFive">
<a name="SectionFive"></a>
</div>
</div>
All I can suggest with what you've posted is that you change Background-image to background-image ... but that's a long shot.
Also your <a> elements are incomplete; and the name attribute is out of date now. Use IDs instead. That is, if you want to link to one of those divs, use this:
Go to Section Five
Then just get rid of those as in the divs altogether.