- This topic is empty.
August 23, 2012 at 2:49 pm #39486
Hello, I have this button http://i50.tinypic.com/20hvcr6.jpg
This button can be a link or a submit button.
And of course, the width of the button have to change to fit the text
Right now, I have to use a first div with the first 5px of the button (the left part)
As a child, a other div, with a 5px (the right part)
And a third level child, with the text (with a background as repeat-x)
But when it’s a submit button, I have to put the submit button at the first level, and use some position absolute inside relative so all the button is the submit button.
So how would you do it?
Thank youAugust 23, 2012 at 3:04 pm #108367
I’m not sure precisely what it is you are trying to achieve but why not just use the ‘button’ element rather than a series of divs?August 23, 2012 at 3:07 pm #108368
My button will be links or submit button. (Sorry forgot to mention that… pretty important details, my bad)August 23, 2012 at 3:08 pm #108369emmaParticipant
Take a look at how the Twitter bootstrap buttons are styled, they look very similar to yours.August 23, 2012 at 3:11 pm #108370
I still don’t get it.
A button is just an element like a div…what it does depends on the content or what you have told it to do.August 23, 2012 at 3:17 pm #108372August 23, 2012 at 3:21 pm #108373
That’s my point….put the link in a button element.
Codepen updated: http://codepen.io/Paulie-D/pen/GhtsBAugust 23, 2012 at 3:24 pm #108374
I tried to put the link in a button like such
But even if I press it, I stay on the same page… something I’m missing?August 23, 2012 at 3:48 pm #108376
Odd…seems to work when I use a codepen link but not ones external to codepen.
That being the case, let’s just style your submit button the same way as a link with a class of button.
I think that’s how Twitter Bootstrap does it anyway. http://codepen.io/Paulie-D/pen/KuiDG
[EDIT] I think the previous example works but it looks like it doesn’t like extenal links unless you Ctrl-click the links. Peculiarity of Codepen I guess.
- The forum ‘CSS’ is closed to new topics and replies.