Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

Unexpected text alignment under inline-block with text-align

i have set up a number of URL links using CSS so they look like buttons. Most of the time this works, but I have a couple of web pages where the alignment doesn't work, reducing the readability of the page.

First I have a style:

CSS:
    .button    { 
                font-family:        sans-serif;
                font-weight:        bold;
                font-size:          80%;
                text-align:         center;
                text-decoration:    none;
                background-color:   #E0E0E0;
                color:              #000000;
                border-top:         2px solid white;
                border-left:        2px solid white;
                border-bottom:      3px solid #606060;
                border-right:       3px solid #606060;
                border-radius:      5px;
                padding:            2px 12px 2px 12px;
                display:            inline-block;
                }

Then I reference it from HTML:

HTML:
        <a href="mailto:?to=$TOLIST&amp;bcc=$BCCLIST&amp;subject=[JamesCobban.net]%20General%20Notice" 
          class="button" id="bulkMail">
            Envoyer un message<br>à tous les abonnés
        </a>

$TOLIST and $BCCLIST are replaced by a template engine. What I do not understand is why the first line of the text is not aligned according to "text-align: center". The second line is, but French is such a wordy language that I need to break the long line of text, whereas I do not with English "Send mail to all Users"

WonkyButton.png
 
Of the top of my head I'd say look for other styles that might be affecting this due to the cascade (the 'C' in CSS) and also check for any hidden/invisible characters in the text that could throw it off. Hard to troubleshoot without the full picture.
 

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom