Calendar dot or underline!

Hi there, I am a total novice at coding but trying to create a calender application…how do you code putting a dot above a date or an underline to show that there in an entry for that date?? Where could I find the code to do this??

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at https://freecodecamp.org.

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

It is pretty typical on here for people to share a codepen / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.

Please provide some example of what you’ve tried and I’m sure you’ll get more help.

Happy coding :slight_smile:

1 Like

Typically, for a calendar date with an event or events attached to it, there would be a CSS change to the date to indicate it. For example, where normally it might be <div class='date-cell'>...</div>, in the event of a date with an event, it might be <div class='date-cell has-event'>...</div> or <div class='date-cell is-recurring'>...</div> or whatever convention you choose to use.

For specialized cases like this, I try to make my class names meaningful. Doing this would let me query for all the dates that have events, very easily, and work with that collection.

As to the styling, you could apply a class to the cell, or to any of its descendants. For example, if the date itself was in a <span class='date'>25</span>, you could easily style just that:

.date-cell {
  display: inline-block;
  ...
}
.has-event {
  background-color: salmon;
  ...
}
.date-cell .date {
  /* This targets the actual date within every date-cell */
  /* You could float it right, or do whatever.                   */
  position: relative;
  left: 5em;
  height: 1.5em;
  width: 1.5em;
}

.date-cell.has-event .date {
  /* This is a more targetted rule than the last, so any styles here will override those. So
   *    we could do things like giving it a border-radius of 50% to circle it, change the
   *    background color, whatever we wanted.
   */
  border-radius: 50%;
  background-color: navy;
}

Typically, you’ll simply want to apply styles to indicate a specialized case of the date cell, then you can style the content accordingly.

This is all hypothetical, of course, and YMMV.

Thankyou, snowmonkey, that’s really helpful I will try out this kind of approach :tada::tada::tada: