1 reply [Last post]
jPaulB
jPaulB's picture
Offline
newbie
Moncton, NB
Last seen: 12 weeks 1 day ago
Moncton, NB
Timezone: GMT-3
Joined: 2013-07-11
Posts: 5
Points: 9

Hi Everybody,

I'm using a mix of PHP and HTML and need to create a box class that would be flexible enough to contain strings of various lengths.

So far, I do have a CSS file:

  .boxed {
    position: absolute;
    top: 0;
    height:40px;
    width:40px;
    border:1px solid green;
    background-color: #75FF75;
    text-align: center;
    }

The code I have to "fill that box is:

<div class="col-sm-6">
  <?php
    $firstnumb = rand(1,10);
    $secondnumb = rand(1,10);
    $entrycode = $firstnumb + $secondnumb;
    print "<h2>Add these two numbers together:</h2>";
  ?>
  <div class="boxed">
    <?php
      print "<h2>$firstnumb + $secondnumb</h2>";
    ?>
  </div>
</div>

I have two questions about this:

  1. Can I make the CSS box flexible enough to adjust for strings of different lengths?
  2. When I execute the file it renders on one single line with the BOX obscuring the first five characters of "Add these two numbers together". How could I force the BOX to break?I've attached a gif file to show what I mean

Many Thanks,
Paul

AttachmentSize
css.gif10.22 KB
Omega22
Omega22's picture
Offline
newbie
Last seen: 22 weeks 4 days ago
Timezone: GMT-3
Joined: 2022-07-01
Posts: 1
Points: 1

wtf