Sublime Forum

CSS classes not being applied to html

#1

Hey, this may sound like a bit of a ridiculous question, but I’m kinda new to sublime text and coding in general so I’d appreciate the support.

I’m trying to make a website for a project and I’m running some tests to make sure the CSS works. I’ve created my CSS stuff:

image

And I’m trying to apply it to my HTML:

(because I’m a new user it won’t let me attach a second image, but I’ll reply to this post with this image)

The body element works, because the background is the color I want, but the class I have applied to the HTML is not affecting the text.

Please help me on this, I know it must be annoying to have newbies like me clogging up the forums, but I can’t really find anything anywhere else.

Thanks.

0 Likes

#2

This is not really a place to get help with your code. This forum is for discussing Sublime Text and Sublime Merge. I am going to suggest you create an account on Stack Overflow and ask there.

0 Likes

#3

The issue of yours is not Sublime specific, but I will try to answer it!

All of your style declarations should be contained inside <style> element. So, your code should be:

<style>

body {
    background: #9EDBF4;
}

.top-text {
    text-align: center;
    color: orange;
}

</style>

Now try if it helps!

:pray:t3:

0 Likes