user4708518
user4708518

Reputation:

CSS weird dashes after buttons

Basically I have these buttons that I use on my web page design. However I have just noticed when changing backgrounds that they have this weird dash ( - ) after the button.

CSS:

* {
    font-family: 'Caviar Dreams';
}
.button-fill {
    text-align: center;
    background: #ccc;
    display: inline-block;
    position: relative;
    text-transform: uppercase;
    margin: 25px;
    border:dashed 0px #000000;
    -moz-border-radius-topleft: 17px;
    -moz-border-radius-topright:17px;
    -moz-border-radius-bottomleft:17px;
    -moz-border-radius-bottomright:17px;
    -webkit-border-top-left-radius:17px;
    -webkit-border-top-right-radius:17px;
    -webkit-border-bottom-left-radius:17px;
    -webkit-border-bottom-right-radius:17px;
    border-top-left-radius:17px;
    border-top-right-radius:17px;
    border-bottom-left-radius:17px;
    border-bottom-right-radius:17px;
}

.button-fill.orange {
    background: #B26B24;
    color: #fff;
}
.button-fill.orange .button-inside {
    color: #f26b43;
}

.button-text {
    padding: 0 25px;
    line-height: 56px;
    letter-spacing: .1em;
}
.button-inside {
    width: 0px;
    height: 54px;
    margin: 0;
    float: left;
    position: absolute;
    top: 1px;
    left: 50%;
    line-height: 54px;
    color: #445561;
    background: #0033CC;
    text-align: center;
    overflow: hidden;
    -webkit-transition: width 0.5s, left 0.5s, margin 0.5s;
    -moz-transition: width 0.5s, left 0.5s, margin 0.5s;
    -o-transition: width 0.5s, left 0.5s, margin 0.5s;
    transition: width 0.5s, left 0.5s, margin 0.5s;
    -moz-border-radius-topleft: 75px;
    -moz-border-radius-topright:75px;
    -moz-border-radius-bottomleft:75px;
    -moz-border-radius-bottomright:75px;
    -webkit-border-top-left-radius:75px;
    -webkit-border-top-right-radius:75px;
    -webkit-border-bottom-left-radius:75px;
    -webkit-border-bottom-right-radius:75px;
    border-top-left-radius:75px;
    border-top-right-radius:75px;
    border-bottom-left-radius:75px;
    border-bottom-right-radius:75px;
}
.button-inside.full {
    width: 100%;
    left: 0%;
    top: 0;
    margin-right: -50px;
    border: 1px solid #445561;
}
.inside-text {
    text-align: center;
    position: absolute;
    right: 50%;
    letter-spacing: .1em;
    text-transform: uppercase;
    -webkit-transform: translateX(50%);
    -moz-transform: translateX(50%);
    -ms-transform: translateX(50%);
    transform: translateX(50%);
}

I think that the following code is the issue, it is located under the .button-fill.

display: inline-block;

I have tried removing it, changing it, however it stops the buttons from working. I have reached a dead end with this. Does anyone know how I would fix this? Or do the buttons need to be re-designed?

Picture of weird dash:

enter image description here

HTML Code:

<CENTER>
    <div class="mywork" id="portfolio">
        <a href="./forum/">
            <div class="button-fill orange">
                <div class="button-text">Outside text</div>
                <div class="button-inside">
                    <div class="inside-text">inside&nbsptext </div>
                </div>
            </div>
        </a>
        <a href="#">
            <div class="button-fill orange">
                <div class="button-text">Outside text</div>
                <div class="button-inside">
                    <div class="inside-text">Inside&nbspText </div>
                </div>
            </div>
        </a> 
    </div> 
</CENTER>

Upvotes: 0

Views: 558

Answers (2)

tcollart
tcollart

Reputation: 1062

The dash is due to <a> default styling.

You can add the property text-decoration: none; to your a selector.

Upvotes: 1

j08691
j08691

Reputation: 207963

Inline elements are sensitive to white space, so an easy fix is to remove the spaces between the anchor and div (no CSS changes necessary). On a side note, don't use the deprecated <center> element, and the non-breaking space entity is &nbsp;

* {
    font-family:'Caviar Dreams';
}
.button-fill {
    text-align: center;
    background: #ccc;
    display: inline-block;
    position: relative;
    text-transform: uppercase;
    margin: 25px;
    border:dashed 0px #000000;
    -moz-border-radius-topleft: 17px;
    -moz-border-radius-topright:17px;
    -moz-border-radius-bottomleft:17px;
    -moz-border-radius-bottomright:17px;
    -webkit-border-top-left-radius:17px;
    -webkit-border-top-right-radius:17px;
    -webkit-border-bottom-left-radius:17px;
    -webkit-border-bottom-right-radius:17px;
    border-top-left-radius:17px;
    border-top-right-radius:17px;
    border-bottom-left-radius:17px;
    border-bottom-right-radius:17px;
}
.button-fill.orange {
    background: #B26B24;
    color: #fff;
}
.button-fill.orange .button-inside {
    color: #f26b43;
}
.button-text {
    padding: 0 25px;
    line-height: 56px;
    letter-spacing: .1em;
}
.button-inside {
    width: 0px;
    height: 54px;
    margin: 0;
    float: left;
    position: absolute;
    top: 1px;
    left: 50%;
    line-height: 54px;
    color: #445561;
    background: #0033CC;
    text-align: center;
    overflow: hidden;
    -webkit-transition: width 0.5s, left 0.5s, margin 0.5s;
    -moz-transition: width 0.5s, left 0.5s, margin 0.5s;
    -o-transition: width 0.5s, left 0.5s, margin 0.5s;
    transition: width 0.5s, left 0.5s, margin 0.5s;
    -moz-border-radius-topleft: 75px;
    -moz-border-radius-topright:75px;
    -moz-border-radius-bottomleft:75px;
    -moz-border-radius-bottomright:75px;
    -webkit-border-top-left-radius:75px;
    -webkit-border-top-right-radius:75px;
    -webkit-border-bottom-left-radius:75px;
    -webkit-border-bottom-right-radius:75px;
    border-top-left-radius:75px;
    border-top-right-radius:75px;
    border-bottom-left-radius:75px;
    border-bottom-right-radius:75px;
}
.button-inside.full {
    width: 100%;
    left: 0%;
    top: 0;
    margin-right: -50px;
    border: 1px solid #445561;
}
.inside-text {
    text-align: center;
    position: absolute;
    right: 50%;
    letter-spacing: .1em;
    text-transform: uppercase;
    -webkit-transform: translateX(50%);
    -moz-transform: translateX(50%);
    -ms-transform: translateX(50%);
    transform: translateX(50%);
}
<CENTER>
    <div class="mywork" id="portfolio"> <a href="./forum/">
            <div class="button-fill orange">
                <div class="button-text">Outside text</div>
                <div class="button-inside">
                    <div class="inside-text">inside&nbsp; </div>
                </div>
            </div></a>
 <a href="#"><div class="button-fill orange">
                <div class="button-text">Outside text</div>
                <div class="button-inside">
                    <div class="inside-text">Inside&nbsp; </div>
                </div>
            </div>
        </a> 
    </div>
</CENTER>

Upvotes: 0

Related Questions