/r/learncss

Photograph via snooOG

A place to learn CSS in a community!

About CSS
  • CSS, short for Cascading Style Sheets, is used almost universally across the web to affect the design and appearance of every website you visit. Here in /r/learncss, you've got a place on reddit to talk about CSS, whether you're new to CSS and want to learn and develop your skills.
Related subreddits
Useful Links
  • Inspire, a collection of all kinds of useful links.
  • /r/snippit can be used to post/use little snippets of code.
  • Use Codepen or jsFiddle or a sub that you're working on, to provide working code samples.
  • Mozilla Developer Network is your one-stop shop for detailed information on CSS properties. Formal specifications for everything CSS can be found at W3.org. Don't go to W3Schools - it isn't a wiki maintained by real developers like MDN, so it's often out of date and prone to significant errors, and it has no relationship with the W3 so they have no special or insider knowledge.
  • CanIUse.com has 99% of the information you need on supporting different browsers.
  • Codecademy can get you started from 0 knowledge of web development in mere hours.
  • Learn Layout will teach you advanced techniques for designing modern sites.
Rules
  • This is a place to ask questions, post tutorials and guides for CSS, and help each other to learn CSS.
  • Once your question has been answered, please mark your post as "Resolved".
  • You are allowed to ask questions about your website, it doesn't have to be specific to Reddit CSS.
  • Please provide a sample or link to the code that you have tried or are working with, this will help us a lot in answering questions.
  • Keep titles relevant, don't post, for example, "I have this question", post something like "How do I change the background of the header on my sub?"
  • This isn't a place to share your CSS creations, unless you're asking for help on them, please use /r/reddithax if you've done some cool CSS on reddit.

Sidebar styles stolen from /r/css

/r/learncss

1,446 Subscribers

2

๐ŸŽฎ Build Your Own "Four In A Row" Game Using JavaScript - Step-by-Step Tutorial! [Video]

Hey everyone!

I've just uploaded a comprehensive tutorial on how to create the classic "Four In A Row" game using JavaScript, HTML, and CSS. Whether you're a beginner looking to dive into game development or someone who's interested in honing your JavaScript skills, this tutorial is for you!

๐Ÿ”— Watch the full tutorial here: Four In A Row Game Tutorial

What You'll Learn:

  • Project Setup: Step-by-step guide to setting up your environment and files.
  • HTML & CSS: Designing the game layout and styling it for a professional look.
  • JavaScript Game Logic: Learn how to handle game mechanics, player turns, and game state.
  • Adding Features: Implement sound effects, animations, and more!
  • Problem Solving: Tips on debugging and improving your code.

Why Watch This Tutorial?

  • Beginner-Friendly: Perfect for those who are new to JavaScript and game development.
  • Hands-On Learning: Follow along with real-time coding and explanations.
  • Community Support: Join the discussion, ask questions, and share your progress.

Join the Discussion:

I'd love to hear your feedback, see your creations, and answer any questions you might have. Let's build and learn together!

Feel free to share your thoughts and let me know what other projects you'd like to see in the future. Your support and feedback are invaluable.

Happy coding! ๐Ÿš€

0 Comments
2024/08/03
12:29 UTC

1

Variable in the content attribute

Hi everyone!

I am working on a project, and I am trying to allow multi-language.

A part of my (HTML) code looks like this:

<div
  class="class1 class2"
  v-if="condition1"
>
  <span v-if="condition2">Some sentence</span>
</div>

And then, the CSS part:

&.class2 span {
 # Some other CSS properties here
 &:before {
  content: "My text";
 }

Here it works perfectly. When we are hover this element, we see the text "Some sentence", with on the left, "My text".

โ€‹

What I am trying to do now is replace this content, "My text", by a variable, so this string will change according to the language used by the user. The variable is locale.fileA.myText. And if I use it in the HTML part, the text works perfectly, but I cannot make it in CSS.

I tried content: locale.fileA.myText, :content: "locale.fileA.myText", content: "{{ locale.fileA.myText}}, but no one work.

So, what is the good syntax?

Thanks in advance.

1 Comment
2024/04/22
14:56 UTC

1

Master CSS GRID in 4 minutes

Ever felt overwhelmed by creating responsive designs? ๐Ÿค” CSS Grid is here to change that, and Iโ€™ve got just the tutorial for you. Whether youโ€™re crafting your first website or aiming to refine your layout skills, this CSS Grid guide is tailored for beginners and packed with everything you need to know to start building sleek, responsive layouts with minimal fuss.

0 Comments
2024/03/01
16:44 UTC

4

Vertical alignment (middle)

Hi everyone!

I am creating two buttons. Each of these buttons contains both a span and an img (this way I can have both a text and an image).

โ€‹

https://preview.redd.it/gw9x7zyroilc1.png?width=657&format=png&auto=webp&s=c6d76bbf7a07084c3bfd39b48fa07596c11d03ba

I will change some things (font size, button's height), but there is one point I wanna change and I tried without success.

I wanna have the spans at the (vertical) middle of the button (instead to be at the top).

And, ideally, I'd like to have them, for the horizontal alignment, at the middle of the free space (so middle without taking account the picture). For this point, I am pretty sure I can easily solve it with a text-align: center;

But so, how can I make the vertical alignment?

Thanks in advance for answers.

2 Comments
2024/02/29
12:28 UTC

1

Two colors with a third in the middle

Don't know how to describe this well.

White box on top, black box on bottom. Picture in center needs show part on the top and show part on the bottom.

Don't know what to call this to google it. How is this done?

0 Comments
2024/02/01
09:07 UTC

6

7 Common CSS Mistakes Junior Frontend Developers Make (And How to Fix Them)

2 Comments
2024/01/28
12:06 UTC

2

Along one line, but separated and different style?

Example

feature number

feature number

feature number

feature number

I have a bold span on them, but then I can't get them to line up properly. I have tried flex, margin, padding.

1 Comment
2024/01/25
17:50 UTC

1

CSS z index not working (Reason with solution live snippet code)

1 Comment
2023/08/03
17:43 UTC

1

How to perfectly center a Bootstrap icon vertically

I'm using Bootstrap CSS and Bootrap Icons to build an avatar component, but I'm facing a problem with centering the icon, I can't get the icon centered perfectly. Please can someone help me to fix this problem? This is the codepen

Thank you in advance.

0 Comments
2023/06/26
11:04 UTC

1

Become a web developer yourself | First part of HTML presentation

0 Comments
2023/06/17
20:06 UTC

0

*NEW* Loading animation tutorial: Create a dynamic and stylish loader using HTML, CSS and JavaScript

0 Comments
2023/06/13
05:02 UTC

0

HTML, CSS and JavaScript loading animation step by step

0 Comments
2023/06/12
12:07 UTC

1

HTML & CSS & JavaScript || Interactive navigation bar animation tutorial

0 Comments
2023/06/11
11:12 UTC

1

Mosaic Grid Modal - using HTML, CSS and Javascript!

1 Comment
2023/06/10
17:23 UTC

1

Interactive Text Animation - Simple tutorial using HTML, CSS and JavaScript

0 Comments
2023/06/10
17:22 UTC

1

JavaScript Dynamic Content Editor Tutorial: Create Interactive Web Pages

0 Comments
2023/06/10
17:19 UTC

0

Dynamic Content Editor Tutorial: Create Interactive Web Pages with JavaScript

0 Comments
2023/06/03
16:08 UTC

2

Build an Interactive Dynamic List with HTML, CSS, and JavaScript

0 Comments
2023/06/01
18:08 UTC

1

Create a simple and interactive Service Box using HTML and CSS

0 Comments
2023/05/30
10:19 UTC

1

Mosaic Grid Modal - using HTML, CSS and Javascript!

0 Comments
2023/05/30
10:17 UTC

1

Create Letter-by-Letter Text Animation with HTML, CSS, and JavaScript

0 Comments
2023/05/30
10:17 UTC

1

Create Letter-by-Letter Text Animation with HTML, CSS, and JavaScript

https://www.youtube.com/watch?v=-mN6kN3vggg&ab_channel=NaturalFrontend

https://preview.redd.it/y38asmv8vt2b1.jpg?width=1711&format=pjpg&auto=webp&s=2cfd02d768d5e4cb49f71d2f8593479aa2ca9f9f

Learn how to create attractive letter-by-letter text animation using HTML5, CSS3, and JavaScript. In this tutorial, we'll go through the code step by step to understand how to wave each letter individually. Watch as we demonstrate how to implement the animation and provide a detailed explanation of the HTML, CSS, and JavaScript code involved. Get ready to add eye-catching text effects to your web projects!

0 Comments
2023/05/29
20:10 UTC

0

Interactive Text Animation - Simple tutorial using HTML, CSS and JavaScript

0 Comments
2023/05/29
13:28 UTC

0

HTML CSS JAVASCRIPT MODAL GRID

https://www.youtube.com/watch?v=1QoNuri_Wes&ab_channel=NaturalFrontend

Please check it out and tell me what you think. Thanks.

1 Comment
2023/05/28
22:23 UTC

Back To Top