/    Sign up×
Community /Pin to ProfileBookmark

Border-bottom

I have a text and I want to add an underline under so I used border-bottom. But when I redimension the size of the window up the border it’s too long. I want it to be as long as the text.

I also tried this
`.title::after {
content: “”;
display: block;
width: 100%;
height: 3px;
background: #e60f86;
}`

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@cootheadApr 09.2020 — Hi there RaulRogojan,

do you have an aversion to the CSS property...

``text-decoration: underline;``


_coothead_
Copy linkTweet thisAlerts:
@codyhillauthorApr 09.2020 — @coothead#1617190 that works fine but I want to be able to change the color
Copy linkTweet thisAlerts:
@cootheadApr 09.2020 — Hi there RaulRogojan,

in that case do it like this...

``<i>
</i>&lt;!DOCTYPE HTML&gt;
&lt;html lang="en"&gt;
&lt;head&gt;

&lt;meta charset="utf-8"&gt;
&lt;meta name="viewport" content="width=device-width,height=device-height,initial-scale=1"&gt;

&lt;title&gt;untitled document&lt;/title&gt;

&lt;!--&lt;link rel="stylesheet" href="screen.css" media="screen"&gt;--&gt;

&lt;style media="screen"&gt;

body {
background-color: #f0f0f0;
font: normal 1em / 150% sans-serif;
}

#container {
padding: 1em;
margin: auto;
border: 1px solid #999;
background-color: #fff;
}

h1 {
font-size: 1.5em;
color: #444;
text-transform: capitalize;
text-align: center;
}

h1 span {
display: inline-block;
padding: 0.2em;
border-bottom: 0.2em solid #e60f86;
}

&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;div id="container"&gt;

&lt;h1&gt;
&lt;span&gt;border&lt;/span&gt;&lt;span&gt;under&lt;/span&gt;&lt;span&gt;text&lt;/span&gt;
&lt;/h1&gt;

&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;<i>
</i>
``


_coothead_
Copy linkTweet thisAlerts:
@codyhillauthorApr 10.2020 — @coothead#1617198 Yes, this is good. Thx!
Copy linkTweet thisAlerts:
@cootheadApr 10.2020 — No problem, you're very welcome. :)

_coothead_
×

Success!

Help @codyhill spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.13,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...