vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   How Do You create CUSTOM FORUM BUTTONS without left alignment? (https://vborg.vbsupport.ru/showthread.php?t=281922)

addamroy 05-02-2012 12:21 PM

I did it Lynne I did it! Here's the answer for anyone who might have the same question...

The original CSS that makes the buttons work is the newcontent_textcontrol class as we already know. It has the following:

Code:

.newcontent_textcontrol {
        background: {vb:stylevar control_content_background};
        _background-image: none;
        -moz-border-radius: {vb:stylevar control_content_radius};
        -webkit-border-radius: {vb:stylevar control_content_radius};
        -moz-box-shadow: 0 3px 8px {vb:stylevar control_content_shadow_color};
        -webkit-box-shadow: 0 3px 8px {vb:stylevar control_content_shadow_color};
        font: {vb:stylevar control_content_font};
        color: {vb:stylevar control_content_color};
        padding: {vb:stylevar control_content_padding};
        border: {vb:stylevar control_content_border};
        display:block;
        float: {vb:stylevar left};
        clear: {vb:stylevar right};
}

Actual HTML for the button is,
Code:

<a class="newcontent_textcontrol" href="http://www.buttonurl.com">Button Text</a>
Notice the float and clear attributes, those are forcing the left alignment. If you remove the alignment however, the button container stretches the full length of whatever div it's inside.

So I solved the problem by creating a new class in additional CSS with all the attributes shown above EXCEPT I removed the bottom float and clear attributes, as well as changed the display: attribute to inline-block instead of block. My final result is the following:

Code:

.my_custom_button {
        background: {vb:stylevar control_content_background};
        _background-image: none;
        -moz-border-radius: {vb:stylevar control_content_radius};
        -webkit-border-radius: {vb:stylevar control_content_radius};
        -moz-box-shadow: 0 3px 8px {vb:stylevar control_content_shadow_color};
        -webkit-box-shadow: 0 3px 8px {vb:stylevar control_content_shadow_color};
        font: {vb:stylevar control_content_font};
        color: {vb:stylevar control_content_color};
        padding: {vb:stylevar control_content_padding};
        border: {vb:stylevar control_content_border};
        display:inline-block;
}

The new HTML code for this button is,
Code:

<a class="my_custom_button" href="http://www.buttonurl.com">Button Text</a>
. The only difference is it's not a forced alignment and the button block will be the same size as the text always, so you can do whatever you want with it and put custom buttons anywhere in your forum.

Works like a charm!

Lynne 05-02-2012 05:31 PM

Glad you got it working. :)


All times are GMT. The time now is 03:25 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01627 seconds
  • Memory Usage 1,722KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete