It seems like there could be an issue with the CSS file not properly connecting to the HTML, or possibly the Jumbotron is not allowing the

Need help with text color! Trying to set h1 element to #513271, but it's not working. Check out my code and failed solutions below.

CSS saved as stylesheet.css in same folder as tributePage.html.

jumbotron h1 {
  color: #513271;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<link href="\stylesheet.css" rel="stylesheet" />

<html>

<head>
  <title>Lizzy McGuire, an Evolution</title>
</head>

<div class="container">
  <div class="jumbotron">

    <body>
      <h1 style="jumbotron-h1" class="text-center">Hey now, hey now.</h1>
    </body>
  </div>
</div>

</html>


Tried several solutions. All attempts listed below.

  1. Change the CSS file path
    • C:\Users\Ashle\Coding\Assignments\FCC -- Tribute Page\stylesheet.css
    • C:\Users\Ashle\Coding\Assignments\FCC -- Tribute Page\
    • \stylesheet.css (I've used \ through \\\)
    • stylesheet.css\
  2. Change the external CSS link style (no spaces between side carets, just included them so this would print below)
    • < link href="stylesheet.css" rel="stylesheet" type="text/css"/ >
    • < link href="stylesheet.css" rel="stylesheet" >
  3. Change the h1 element name in CSS
    • h1, #h1, .h1
    • jumbotron h1, #jumbotron h1, .jumbotron h1
    • jumbotron-h1, #jumbotron-h1, .jumbotron-h1
    • purple text, #purple text, .purple text
    • purple-text, #purple-text, .purple-text
  4. Change the font color with an inline element
    • < h1 style="color:purple;" class="text-center" >Hey now, hey now.< /h1 > Now, oddly enough, THIS will turn the title purple.

Thank you for your assistance!

Answer №1

When styling your webpage with CSS, make sure to use the following code:

.banner h1 {
    color: #513271;
}  

Don't forget to include the period before 'banner' to signify it as a class.

Answer №2

I trust that my response will be beneficial to you:

Here is your initial code:

<html>
  <head>
    <title>Lizzy McGuire, an Evolution</title>
  </head>

  <div class="container">
    <div class="jumbotron">
      <body>
        <h1 style="jumbotron-h1" class="text-center">Hey now, hey now.</h1>
      </body>
    </div>
  </div>
</html>

It is not permissible to have a div element outside of the body tag.

You must add the link to the CSS file in the head tag. Revise your code as follows:

<html>
  <head>
    <title>Lizzy McGuire, an Evolution</title>
    <link rel="stylesheet" type="text/css" href="stylesheet.css">
  </head>
  <body>
    <div class="container">
      <div class="jumbotron">
        <h1>Hey now, hey now.</h1>
      </div>
    </div>
  </body>
  </html>

Upon examination, it appears that in your CSS file you defined a 'jumbotron h1', but in your HTML code, jumbotron seems to be a class. To style a class in an external CSS file, you need to use a dot (.) before the class name. Your CSS should be structured like this:

.jumbotron h1 {
  color: #513271;
}

I hope this explanation clarifies the issue.

Answer №3

Your tag is not properly placed nor your external css tag is missing.

and

the class is not used for styling (except if you used bootstrap).

Here is the correct one:

HTML:

<!DOCTYPE html>
<html>
<head>
    <title>Lizzy McGuire, an Evolution</title>
    <link rel="stylesheet" href="dir/style.css" > <!-- put the external css link here -->
</head>

<body>
  <div class="container">
    <div class="jumbotron">
      <h1>Hey now, hey now</h1>
    </div>
  </div>
</body>

</html>

CSS:

  jumbotron h1 {
    color: #513271;
    text-align: center;
}

I suggest practicing with external css files instead of inline/internal for a better coding style.

Answer №4

Encountered a similar issue where my CSS styling wasn't showing up in my HTML document. After some investigation, I discovered that my supposed .css file was actually saved as a .css.txt file, named "mystyle.css.txt".

To fix this issue, I navigated to any directory containing the HTML and CSS files, clicked on view at the top, then selected options. From there, I went to the view tab and unchecked the option "Hide extensions for known file types". This allowed me to remove the .txt extension from the CSS file, turning it into a proper .css file, which then displayed correctly in my HTML document.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Buefy: Secure the header of the table in place while allowing the rows to scroll freely

How can I make the header of the table component stay fixed while allowing only the rows to scroll? ...

How to center the navigation list vertically with double lines and maintain the href block?

Looking for a solution to align vertically in a basic navigation list bar, particularly when some items have two lines of text. I want the text to be vertically aligned to the middle, while still maintaining the ability to hover and click within the list ...

Seeking an efficient localStorage method for easy table modification (HTML page provided)

Currently, I am in the process of developing a custom 'tool' that consists of a main page with a menu and several subpages containing tables. This tool is intended for composing responses using prewritten components with my fellow colleagues at w ...

Create a circular div that fills in when hovered over using CSS

I attempted to create an interesting effect when hovering over a circular div, but I struggled to figure out how to fill it in with the same round shape. Currently, the fill is in a square shape, but I am looking to have it match the shape of the div (whi ...

Adjust jQuery UI's resize functionality to maintain the current total width

I arranged two containers horizontally using the position: absolute property. I am attempting to create a "resize bar" in the center that, when dragged, will expand one container while shrinking the other (thus maintaining the overall width). <div clas ...

What is preventing jQuery 3 from recognizing the '#' symbol in an attribute selector?

After updating my application to jQuery 3, I encountered an issue during testing. Everything seemed to be working fine until I reached a section of my code that used a '#' symbol in a selector. The jQuery snippet causing the problem looks like th ...

Blank space on the lower portion of my website as I attempt to implement a responsive layout

Working on making my webpage responsive for iPad and mobile devices. While adjusting the media query, I noticed a white area at the bottom of the page that seems to be outside the body element. Unsure of where it's coming from. Any help would be great ...

Semantic UI Footer allows you to easily create a stylish

Greetings! I'm new to the semantic-ui framework and I'm encountering an issue with the footer. My goal is to have the footer always stay at the bottom of the page without being fixed. Here's a snippet of my simple HTML code: <!DOCTYPE h ...

unable to clear form fields after ajax submission issue persisting

After submitting via ajax, I am having trouble clearing form fields. Any help in checking my code and providing suggestions would be greatly appreciated. Here is the code snippet: jQuery(document).on('click', '.um-message-send:not(.disabled ...

perfecting the styling of a tab management system

For reference, please check out the following link: http://jsfiddle.net/XEbKy/3/ In my design, I have organized two layers of tabs. The top layer consists of two tabs while the bottom layer has three tabs. My goal is to have all these tabs neatly enclosed ...

Error in compiling: Incompatibility between oncommand and CommandArgument attributes within LinkButton

I'm facing an issue with a LinkButton in a repeater on my aspx page. I am trying to call a function oncommand and pass a parameter via CommandArgument, but it keeps giving me a compilation error. Can someone help me figure out what I am missing here a ...

The issue I'm facing is that the ng-click functionality in Angular JS is not functioning properly when the

Upon loading the page, my JavaScript function creates a tree structure from JSON data and generates a list of anchor tags which look like this: <a ng-click="shareParent(4619)">Some data</a> Despite associating the ng-click directive with the ...

problem encountered when converting SVG HTML into SVG paths

Recently, I came across an interesting SVG file depicting a question mark enclosed in a circle. Intrigued by its design, I wanted to extract the paths from this SVG image so that I could integrate it directly into my codebase. Following some online tutoria ...

Directing users to a specific section on another webpage can be accomplished using HTML, JavaScript, or

<nav> <div class='container-fluid'> <h1 class='logo'>Logo</h1> <ul class='list-unstyled naving'> <li><a href='index.html'>Home</a></li> ...

Is there a way to set the focus on a text box automatically when a page is loaded, even without support for JavaScript?

On my form, I have a few text fields and I am looking to automatically set the cursor (auto focus) on the first text field when the page loads. I aim to accomplish this without relying on javascript. ...

In Angular, a white screen may suddenly appear if the scrolling speed is too fast

My experience has been primarily on Chrome. I've noticed that when I scroll for a long time, the data on the screen disappears briefly and then reappears after a few seconds. Is there a resolution for this problem? Thank you, ...

Printing from a Windows computer may sometimes result in a blank page

Looking to incorporate a print button into an HTML page, I'm facing an issue. The majority of the content on the page should not be included in the printed version, so my approach involves hiding everything in print and then showing only the designate ...

Guide to placing an image below a <div> using HTML?

Before diving into the creation of my website, I took the time to draft a wireframe using Balasmiq. You can take a look at the wireframe here. Upon reviewing the wireframe, you'll notice that the first section bears a semblance to this layout: https:/ ...

Struggling to connect HTML elements with AngularJS and TinyMCE?

My objective is to edit text using tinymce, persist it in a database, and display it within a div by incorporating angularJS for the same styling and formatting. I am utilizing tinymce 3.5.8 with an angularUI directive. I have successfully saved the wysiw ...

The sliding hamburger menu children fail to move in unison with the parent

I'm currently working on a dynamic sliding navigation menu that activates when the hamburger icon is clicked. However, I am facing an issue where the child <a> elements are not sliding along with the parent div. You can see how it currently loo ...