I have a question about css.

Asked 2 years ago, Updated 2 years ago, 133 views

Hello, I am a student who dreams of becoming a developer. I'm currently making a homepage with a project. I'm trying to make a bulletin board, but there are two problems.

I want to create a bulletin board with only pictures. So through infinite scrolling, When you get to the bottom of the page, you take out the pictures in the list as foreach statements.

First of all, the code is I wrote it like this.

<div id="content" style="text-align: center;">
<c:forEach var="board" items="${boardList}" varStatus="stat" begin="0" end="8">
    <span>
        <a href="detailBoardboardno=${board.boardno}&searchItem=${searchItem}&searchWord=${searchWord}">
            <img src="uploadPath/${board.SFile}" style="width: 30%; height: 300px;" alt="" /></a>
    </span>
</c:forEach>    
</div>

And the additional part is (JavaScript)

    $(document).scroll(function() {
    var maxHeight = $(document).height();
    var currentScroll = $(window).scrollTop() + $(window).height();
    var start = ${requestScope.result};
    var end = "";
    var content = "";
    if (maxHeight <= currentScroll) {
        content += "<br>";
        content += "<c:forEach var='board' items='${boardList}' varStatus='stat' begin='9' end='18'>";
        content += "<span>";
        content += "<a href='detailBoard?boardno=${board.boardno}&searchItem=${searchItem}&searchWord=${searchWord}'>";
        content += "<img class='card-img-top' src='uploadPath/${board.SFile}' style='width: 30%; height: 300px;' alt='' /></a>";    
        content += "&nbsp;";
        content += "</span>";
        content += "</c:forEach>";

        content += "<br>"

        $("#content").append(content);


    }
  })

});

It's woven like this, but it comes out slightly different. No matter how much I try to find out what the problem is, what is it? I'm not sure if it's coming out wrong.

Secondly,

I'll set the style to text-align:center in the division and specify the style for the child object, spandegree I can't move that one in the middle to the left. Is there a way to move the middle span to the left?

css div foreach

2022-09-21 10:22

1 Answers

I don't know because I haven't seen the entire style sheet..

<div id="content" style="text-align: center;">

Because of this, the span below is aligned in the middle.


2022-09-21 10:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.