1

I wanted to do some UI-Design and came across a little problem. Basically the tag should be the background of that

tag -which is only red so that it can be found more easily-.

screenshot

HTML-Code:

<div class="tournament">
        <p>
            &lt;GET system.template.tournament.date&gt; <progress id="value" max="8"></progress>
        </p>
        <button>Information</button>
    </div>
    <p class="playerNumber">
        <span id="players">4</span>/<span id="max">8</span> <span id="plural">Players</span> in
    </p>

CSS-Code:

.tournament {
  background-color: #202020;
  width: 98%;
  margin-left: 1%;
  margin-top: 15px;
  height: 121px;
}

.tournament p {
  text-align: left;
  position: absolute;
  margin-top: 48px;
  margin-left: 20px;
}

.tournament button {
  margin-left: 90%;
  margin-top: 43px;
  border-radius: 100px;
  width: 135px;
  height: 35px;
  border-color: #666666;
}

.tournament progress {
  border-color: #666666;
  background-color: #202020;
  width: 285%;
  height: 45px;
  position: absolute;
  margin-top: -10px;
  margin-left: 80%;
}

progress::-moz-progress-bar { background: #151515; }
progress::-webkit-progress-value { background: #151515; }
progress { color: #151515; }

.playerNumber {
  text-align: left;
  color: red;
  margin-left: 30%;
  margin-top: -50px;
  z-index: 200;
}

Basically that p-element shows some information related to that progressbar. In this case it says "4/8 Players in" which is refered to the tournament. Thats why the progressbar is 50%-full.

Its not a problem if you have a solution that comes without a

-tag but allowes me to write something on the progressbar.

Why am i asking here?

  1. z-index didnt solve my problem as you can see in the code
  2. I didnt found an answer to my problem on this forum
  3. Google had no clue either

1 Answers1

0

you need to put the .playerNumber element inside the .tournament element.

just adjust the positions using, top, left css props for .playerNumber element...

then you would need this css and...

.playerNumber {
  text-align: left;
  color: red;
  left: 300px;
  top: 10px;
  z-index: 3;
  display:block;
}


.tournament progress {
  border-color: #666666;
  background-color: #202020;
  width: 285%;
  height: 45px;
  position: absolute;
  margin-top: -10px;
  margin-left: 0px;
  z-index: 2;
}

...and html like this

<div class="tournament">
  <p>
    &lt;GET system.template.tournament.date&gt; <progress id="value" max="8"></progress>
  </p>
  <button>Information</button>
  
<p class="playerNumber">
  <span id="players">4</span>/<span id="max">8</span> <span id="plural">Players</span> in
</p>
</div>

test here

Dean Van Greunen
  • 5,060
  • 2
  • 14
  • 28
  • 1
    First of all thank you for letting me know how i can move the p tag in this case... I still dont understand, why margin-[position] doesnt work since it workes normally... But i have a problem with the solution you came up with... Its not responsive... Full-HD-Screen: https://www.clanneko.tk/Files/Asuna_1163ddcc-ef9e-4e5b-bc26-15c872c5e9cc_5dk_07-08-2022_12-11.png 4K-Screen: https://www.clanneko.tk/Files/Asuna_d6991d6c-ffe2-4612-a352-d12ad7e5e7f9_5dl_07-08-2022_12-11.png – Sakura Queen Aug 07 '22 at 10:08
  • @SakuraQueen you need to use `top` and `left` instead, as now is inside and next to the same elements – Dean Van Greunen Aug 07 '22 at 10:23
  • 1
    Did that. CSS right now: https://pastebin.com/zg0SPTRr – Sakura Queen Aug 07 '22 at 12:40
  • 1
    Figured it out. I just had to use "left: randomNumber px" for the progressbar element to – Sakura Queen Aug 10 '22 at 09:13