- better way?

View Poll Results: Why do you feel you have your PHP expertise?

Voters
2. You may not vote on this poll
  • It came naturally

    0 0%
  • I first learned C to C++ or another preparatory language

    0 0%
  • For Employment reasons

    0 0%
  • Other

    2 100.00%
Multiple Choice Poll.
Results 1 to 8 of 8

Thread:   - better way?

  1. #1
    Senior Member
    Join Date
    May 2013
    Location
    NYS
    Posts
    128

    Question   - better way?

    A quick question, I think (famouse last words!).

    I have a ratings system where the user clicks on 1 of 10 horizontally aligned Radio Buttons.

    Underneath it, for the visitor's convenience, I have printed the values from 0 thru 9 in order to number the rating of each of the above 10 choices. e.g.:

    Definition attempt:
    Ten circles for each of the ratings choices from 0 to 9 (Ten circles).
    ID's below each one, indicating the button is for 0, 1, 2, 3, ,,, 9.
    In order to line up the numbers with the circles, I find I've had to use a bunch of "   " to space the text out to align with the Radio button circles. I tried a "nl3br" but apparently there is no such thing.

    Is there a better way to space out the text than using a bunch of   between the numbers? I want to keep the buttons horizontally in order to keep the real-estate from being excessively long in the vertical length on the screen. At the font sizes I'm using it takes 3   and a space between each digit.

    Is there a better way?

    Regards & TIA,

    Rivet`
    Last edited by Rivet; 07-31-2013 at 05:05 PM. Reason: typos

  2. #2
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,697
    Perhaps. Generally, the "acceptable" way to do things in this regard has moved from markup (e.g., " ") to CSS.

    So, I suppose you might have ten DIV tags, all with a left-margin and set to float to the right of each other? Each DIV would contain your button, a linebreak, and the number?
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  3. #3
    Senior Member traq's Avatar
    Join Date
    Jun 2011
    Location
    so.Cal
    Posts
    949
    I'd suggest inline-block instead of floats.

  4. #4
    Senior Member
    Join Date
    May 2013
    Location
    NYS
    Posts
    128
    Quote Originally Posted by dalecosp View Post
    Perhaps. Generally, the "acceptable" way to do things in this regard has moved from markup (e.g., " ") to CSS.

    So, I suppose you might have ten DIV tags, all with a left-margin and set to float to the right of each other? Each DIV would contain your button, a linebreak, and the number?
    Nooooo thanks!! I wish to minimize code, not write more than necessary, lol!

    Actually, I've been so interested in relearning PHP all over again that I've been lazy and bypassed using CSS. Guess I'll have to get in gear with it!
    If I'd remembered CSS I wouldn't have bothered you guys' time with the question.

    Thanks much!

    Rivet`

  5. #5
    Senior Member
    Join Date
    May 2013
    Location
    NYS
    Posts
    128
    Quote Originally Posted by traq View Post
    I'd suggest inline-block instead of floats.
    I'm sorry; I don't know what you mean unless it was a reference to Dale's post?

    Rivet`

  6. #6
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,410
    Quote Originally Posted by Rivet View Post
    I'm sorry; I don't know what you mean unless it was a reference to Dale's post?
    It was. dalecosp was suggesting you utilize the float CSS property, while traq was suggesting setting the display property to "inline-block."

  7. #7
    Senior Member traq's Avatar
    Join Date
    Jun 2011
    Location
    so.Cal
    Posts
    949
    Right. For example,
    HTML Code:
    <label class=ratings>
        <input type=radio name=rating value=1><br>1
    </label>
    <label class=ratings>
        <input type=radio name=rating value=2><br>2
    </label>
    <!-- etc. ... -->
    Code:
    .ratings{
        display: inline-block;
        text-align: center;
        padding: .5em;
        margin: .15em;
        border: 1px outset gray;
        border-radius: 4px;
        background: #eee;
    }
    Screenshot from 2013-08-01 18:30:44.png
    Last edited by traq; 08-01-2013 at 09:33 PM.

  8. #8
    Un Re Member cretaceous's Avatar
    Join Date
    Sep 2004
    Location
    London UK
    Posts
    940
    or simpler just do <span style='padding:0 40px'>blah</span>

    note that span can only take left / right padding values , top/bottom are ignored

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •