Jump to content
  • 0

Не получается поставить картинку поверх checkbox


Hatton
 Share

Question

%D0%91%D0%B5%D0%B7-%D0%B8%D0%BC%D0%B5%D0

 

 

Здравствуйте. Посмотрите пожалуйста на код, может сможете помочь.
 
Есть код HTML
 

<div class="checkbox"><input type="radio" value="2" name="option" id="2"/><label for="2">текст</label></div>

 
и CSS
 
 

.checkbox {position:relative;padding-left:25px;}.checkbox input[type=checkbox], .checkbox input[type=radio] {display:none;}.checkbox label:after {content:'';display:block;height:24px;width:24px;outline:2px solid #939598; position:absolute;top:0;left:0;bottom-radius:5px;outline-radius:50px;}.checkbox input[type=checkbox]:checked + label:after, .checkbox input[type=radio]:checked + label:after { position:absolute;background:url(images/galka.png) repeat-x;}
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
.checkbox label:after { content:''; display:block; height:24px; width:24px; outline:2px solid #939598; position:absolute; top:0; left:0; bottom-radius:5px; outline-radius:50px; }

у вас же размеры 24px на 24px, как туда картинка должна поместиться?


попробуйте сделать две картинки разных, увеличить размеры label:after в высоту и менять их

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy