0

I'm using cakephp. I have a form where one of the inputs is there for users to enter a money amount into. I'm trying to get a £ symbol to appear in a div beside the form input which would both be below the form label. In otherwords I want the label to be on one line, then beneath that a div with the £ in it and beside, on the same line, the input.

I use this to make the input

echo $form->input('Campaign.target',
    array('label'=>'I want to raise',
        'between'=>'<div id="currencySymbol">£</div>'));

and it outputs:

<div class="input text required">
    <label for="CampaignTarget">I want to raise</label>
    <div id="currencySymbol">£</div>
    <input name="data[Campaign][target]" type="text" maxlength="11" id="CampaignTarget" />
</div>

I've tried floating things, inlines blaa blaa etc but I'm a bit of a newb with css and in a hurry. Can anyone set me straight?

Cheers :)

1 Answer 1

2

You should use a <span> instead of a <div> so that you get an inline element.

Sign up to request clarification or add additional context in comments.

2 Comments

I was about to post a solution with floatings, but you're damn right, nosense to inline a div when you could use spans.
You know, I'd actually tried that and it hadn't worked. Turned out I had a width set for that particular input which I'd forgotten about and it was stopping them being on the same line. I'd never have figured it out if you hadn't pointed me to using a span. Thanks :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.