Entrance Events! Chat Gallery Search Everyone Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
May 10, 2025 - @34.06 (what is this?)
Activity rating: Four Stars Posts & Arts: 70/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts Start New Topic  Submit Art
News: :seal: Thank you for today! :seal: Super News: Upload a banner!

+  MelonLand Forum
|-+  World Wild Web
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  Please help me understand this none display code


« previous next »
Pages: [1] Print
Author Topic: Please help me understand this none display code  (Read 147 times)
Myrmeform
Newbie ⚓︎
*


improve your interplanetary funksmanship

⛺︎ My Room

View Profile WWW

First 1000 Members!Joined 2023!
« on: May 03, 2025 @376.27 »

Hello! I am using this sadgrl code snippet here for my various image galleries, example here. (if you look at the page source, please don't mind my army of br's, I am slowly learning lol)
It is doing exactly what I want it to be doing.
My question is, when looking at the sadgrl snippet, it just says
Code
[id]
for the selector. Am I supposed to designate an id for that? What id should I put there?

Thank you for your time!!
Logged

ヤーナム
Casual Poster
*


call me yharnam

⛺︎ My Room

View Profile

Joined 2023!
« Reply #1 on: May 04, 2025 @975.80 »

You don't need to modify the CSS. It looks like a placeholder but it's actually a selector for any element with an ID attribute. So it will match <div id='5'> but it won't match <div class='5'>.

CSS lets you match on element attributes with square brackets like that, normally you would see it paired with an element. You could do it with any HTML element/attribute, like this:

Code: html
<style>
  a[href='https://melonking.net'] {
    border: 4px dashed green;
  }

  input[type='text'] {
    border: 4px dashed purple;
  }
</style>

<a href='https://melonking.net'>melonking.net will have a dashed green border</a>

<a href='httts://mozilla.org'>mozilla.org won't have any styling</a>

<input type='text' placeholder='text input will have a dashed purple border' />

<input type='button' value="button input won't have styling" />

Are you seeing a problem with your site where it feels like you should modify the CSS?
Logged
Myrmeform
Newbie ⚓︎
*


improve your interplanetary funksmanship

⛺︎ My Room

View Profile WWW

First 1000 Members!Joined 2023!
« Reply #2 on: May 04, 2025 @288.78 »

Ooooh, that makes a lot of sense, thank you so much!!! w3schools didnt say anything about that when I was looking at their selectors page so I wasn't sure what it was doing. But now I think I should be looking at more resources other than w3schools haha.

I'm having no problems, but I was also wondering what I should do if I want to put anything else on the page that also has an id? Thank you for your help!
Logged

ヤーナム
Casual Poster
*


call me yharnam

⛺︎ My Room

View Profile

Joined 2023!
« Reply #3 on: May 04, 2025 @807.51 »

The best over all resource for web tech is MDN, but it can be intimidating for beginners. I love wandering around the MDN docs and discovering things I didn't know HTML/CSS could do.

If you want other elements on your page to have IDs you should make the selectors for the blog entries to be more specific. You actually don't need the ID attribute in the selector at all, you can just use a class. Choose a class name you want to use for blog entry links:

Code: html
<style>
  .entry {
    display: none;
  }

  .entry:target {
    display: block;
  }
</style>

The cool thing happening here is that the :target pseudo-selector is active when the URL fragment matches an element ID, just like when you have an anchor tag to scroll the user to a point on the page, e.g.

Code: html
<a href='#thing'>go to thing</a>

<div style='height: 500px'>
  ... spacing ...
</div>

<div id='thing'>thing!</div>

When you do this and click on the "go to thing" link, the URL in your address bar will have the #thing fragment added to it. The :target pseudo-selector will match when the ID of an element matches that fragment. Your blog code is being clever and using this feature to hide all blog entries unless the fragment matches. :) It's neat!
Logged
Myrmeform
Newbie ⚓︎
*


improve your interplanetary funksmanship

⛺︎ My Room

View Profile WWW

First 1000 Members!Joined 2023!
« Reply #4 on: May 06, 2025 @727.04 »

The mdn looks like a great resource, thank you!!
I'll try the class selector and making it more specific.

Oh yeah, I understand that part about the code, that's why I wanted to use it, so I wouldn't have to make whole new pages for the different years in my galleries haha.

Thank you so much for all your help!
Logged

ヤーナム
Casual Poster
*


call me yharnam

⛺︎ My Room

View Profile

Joined 2023!
« Reply #5 on: May 06, 2025 @779.21 »

Happy to help <3 :D
Logged
Pages: [1] Print 
« previous next »
 

Vaguely similar topics! (3)

Deltarune Chapter 2 and The Goner Code

Started by DoctorScreechBoard ♖ ∙ Video Games

Replies: 0
Views: 4263
Last post December 03, 2021 @256.40
by DoctorScreech
What do you use to code websites?

Started by neoratzBoard ✁ ∙ Web Crafting

Replies: 72
Views: 9418
Last post May 03, 2025 @957.62
by Paprika
Keeping motivation to code?

Started by dotmidiBoard ✁ ∙ Web Crafting

Replies: 6
Views: 1182
Last post February 06, 2023 @772.11
by Commodorn

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | ~ Send Feedback ~ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi