Former Member
inherit
guest@proboards.com
256233
0
Nov 22, 2024 20:15:58 GMT -8
Former Member
0
January 1970
Former Member
|
Post by Former Member on Mar 7, 2019 10:00:40 GMT -8
Forum URL: rats-that-strike.proboards.comWhen more than one sub-board is there, they get a bit glitched: I know it's something to do with my code, just not sure what.
{if $[board.sub_board]} <p class="sub-boards" style="padding: 2px;"> {if $[board.sub_board] != 1}{/if} {foreach $[board.sub_board]} <div class="subboardname" style="font: caption;"> <a href="$[board.sub_board.href]"> | $[board.sub_board.name] | </a> {/foreach} </div> </p> {/if}
|
|
#e61919
Support Staff
224482
0
1
Nov 22, 2024 17:59:24 GMT -8
Scott
“Asking for help isn't giving up... it's refusing to give up.”
24,521
August 2015
socalso
|
Post by Scott on Mar 7, 2019 10:06:29 GMT -8
@majority, what is the goal of this:
{if $[board.sub_board] != 1}{/if}
Also, how do you want them to look? Like "Introductions" or "Forum Games" ?
|
|
Former Member
inherit
guest@proboards.com
256233
0
Nov 22, 2024 20:15:58 GMT -8
Former Member
0
January 1970
Former Member
|
Post by Former Member on Mar 7, 2019 10:11:24 GMT -8
I wasn't sure what that was for either. I deleted it, but nothing seemed to change so I just left it there. Might've been something I was trying awhile back and forgot about I would like them to be side-by-side, like: GENERAL CHAT Guests welcomed here! Sub-board #1 Sub-board #2
|
|
Former Member
inherit
guest@proboards.com
256233
0
Nov 22, 2024 20:15:58 GMT -8
Former Member
0
January 1970
Former Member
|
Post by Former Member on Apr 7, 2019 16:16:19 GMT -8
still looking for help.
|
|
inherit
96289
0
May 17, 2020 9:37:00 GMT -8
elli
1,822
January 2007
ebbymac
|
Post by elli on Apr 7, 2019 19:42:02 GMT -8
You are closing your sub-board </div> after the foreach loop closes, which means that the loop ends without each sub-board having a closing </div> tag. This is causing each subsequent sub-board to be nested within the previous sub-board, creating that extra white line. Try this: {if $[board.sub_board]} <p class="sub-boards" style="padding: 2px;"> {foreach $[board.sub_board]} <div class="subboardname" style="font: caption;"> <a href="$[board.sub_board.href]"> | $[board.sub_board.name] | </a> </div> {/foreach} </p> {/if}
It's good practice to indent nested HTML elements and keep indentation tidy. Easier to find errors.
|
|
Former Member
inherit
guest@proboards.com
256233
0
Nov 22, 2024 20:15:58 GMT -8
Former Member
0
January 1970
Former Member
|
Post by Former Member on Apr 8, 2019 13:09:38 GMT -8
Thank you so much!! Now, is there a way to make them NOT go to next line, and stay in a row?
|
|
inherit
96289
0
May 17, 2020 9:37:00 GMT -8
elli
1,822
January 2007
ebbymac
|
Post by elli on Apr 8, 2019 14:46:21 GMT -8
Yes. <div> is a block-level element in HTML, which means that it will always take up 100% of its container's width unless specified otherwise with CSS. Other block-level elements include <p>, <h1> through <h6>, <ol>, <ul>, and <table>. The opposite of a block-level element is an inline element; these are elements that only take the space they need, and will be rendered on the same baseline. Like text. Examples include <strong>, <em>, <a>, and <span>. If you want your sub-boards to sit next to each other, you have two options: you can change the formatting of <div> with CSS, or you can use an inline element. Since you're nesting your sub-boards within a <p>, I would recommend using an inline element because it's not semantically correct to nest a <div> within a <p>. Try this: {if $[board.sub_board]} <p class="sub-boards" style="padding: 2px;"> {foreach $[board.sub_board]} <span class="subboardname" style="font: caption;"> <a href="$[board.sub_board.href]"> | $[board.sub_board.name] | </a> </span> {/foreach} </p> {/if}
This will probably need a little bit of CSS to add spacing between sub-boards, but not much.
|
|
Former Member
inherit
guest@proboards.com
256233
0
Nov 22, 2024 20:15:58 GMT -8
Former Member
0
January 1970
Former Member
|
Post by Former Member on Apr 8, 2019 15:27:11 GMT -8
Hmm, I tried that but it didn't work. Didn't change anything I think. (Oh also, I really appreciate this help!! )
|
|
inherit
96289
0
May 17, 2020 9:37:00 GMT -8
elli
1,822
January 2007
ebbymac
|
Post by elli on Apr 8, 2019 15:37:12 GMT -8
Hmm, I don't see that change on your live site, and it looks like a tag isn't closed somewhere because there are empty paragraphs before and after your sub-boards.
|
|
Former Member
inherit
guest@proboards.com
256233
0
Nov 22, 2024 20:15:58 GMT -8
Former Member
0
January 1970
Former Member
|
Post by Former Member on Apr 8, 2019 15:41:16 GMT -8
Oh sorry! I reset it back after it didn't work. I'll change it back, and look into the tag and see if I find something.
|
|
Former Member
inherit
guest@proboards.com
256233
0
Nov 22, 2024 20:15:58 GMT -8
Former Member
0
January 1970
Former Member
|
Post by Former Member on Apr 8, 2019 15:42:36 GMT -8
Wait that worked!! I don't know what happened before but now the subboards are awesome!! Thank you!!
|
|