Put text on the same line with button - html

I'm trying to put the text with button on right on the same level but for some reason it doesn't show up correctly. What am I doing wrong?
.lyrics {
margin: 20px 0;
}
.lyrics a {
color: white;
padding: 10px 16px;
border: 1px solid white;
font-size: 11px;
letter-spacing: 2px;
}
.lyrics a:hover {
text-decoration: none;
color: black;
background: #f0d0b5;
}
lyric-align {
display: inline-block;
margin: 0;
}
Song Title <div class="lyrics">Lyrics

Just write html like this:
<div class="lyrics">Song Title Lyrics</div>
And css like this:
.lyrics {
margin: 20px 0;
}
.lyrics a {
color: white;
padding: 10px 16px;
border: 1px solid white;
font-size: 11px;
letter-spacing: 2px;
}
.lyrics a:hover {
color: black;
background: #f0d0b5;
text-decoration: none;
}
And because now you have one div, you can move him where you want. If you want to have a wonder size not across the entire page, but just around the text, use:
.lyrics{
width: fit-content;
width: -moz-fit-content;
}
My recommended solution
I think the best solution would be to do it without DIV, leave only the "a" element there and style it like this. But I don't know what part of the page you didn't show.
HTML
Song Title Lyrics
CSS
.lyrics {
margin: 20px 0;
color: white;
padding: 10px 16px;
border: 1px solid white;
font-size: 11px;
letter-spacing: 2px;
}
.lyrics:hover {
text-decoration: none;
color: black;
background: #f0d0b5;
}

Couple of things I see in your code:
A div is a block element, it's going to take up the whole page horizontally where it is placed.
The button is there, you can see it if you hover over the space below the text Song Title. But you don't have a closing tag for the first tag.
Extra Credit
Your CSS for your class lyric-align is missing a dot in front of the class's identifier.

Does this work for you?
I think you want the lyrics to be inline .
.lyrics {
margin: 20px 0;
}
.lyrics a {
color: white;
padding: 10px 16px;
border: 1px solid white;
font-size: 11px;
letter-spacing: 2px;
}
.lyrics a:hover {
text-decoration: none;
color: black;
background: #f0d0b5;
}
lyric-align {
display: inline-block;
margin: 0;
}
.lyrics {
display:inline;
}
.song-title {
display:inline;
}
<p class="song-title">Song Title </p><a class="lyrics" href="#">Lyrics</a></div>
If you want a button instead of the link, view this link.

Related

How to show the breadcrumbs in a single line in wordpress?

I have a code in php to show the breadcrumb it outputs like this
the link i found the php code
output
<div id="crumbs">Home » About The Tests » <span class="current">Page Image Alignment</span></div>
and it looks like this
#crumbs a,
#crumbs span {
border-radius: 0px 10px 10px 0px;
box-shadow: -3px 2px 18px -3px #000;
background: #4489ff;
width: max-content;
display: inline-block;
color: white;
font-size: 17px;
padding: 6px;
font-weight: bolder;
margin-left: -1px;
margin-top: 1rem;
text-decoration: none;
}
#crumbs span.current{
background: #eef5ff !important;
color: black !important;
}
<center>
<!-- Do Not use <center> tag ! !-->
<div id="crumbs">Home About The Tests <span class="current">Page Image Alignment</span></div>
<!-- Do Not use </center> tag ! !-->
</center>
i want to make the breadcrumbs a single line and fancy like this .
i have made 90% percent of it but i don't know how to show the box shadow like the image down
Please tell how to. thanks for your help !
image desktop
image mobile
EDIT: I removed the absolute positioning method, centered it and made it responsive.
.crumbswrapper {text-align: center;}
#crumbs {
text-align: left;
display: inline-block;
font-family: roboto;
font-weight: 400;
letter-spacing: 1px;
text-transform: uppercase;
font-size: 12px;
}
.innerwrap {
display: inline-block;
background:#4489ff;
padding-right: 10px;
margin: 0 0 0 -5px;
}
.innerwrap:last-child {
background: none;
}
.innerwrap:nth-last-child(2) {
background: #eef5ff;
}
#crumbs a, #crumbs span {
background:#4489ff;
border-radius: 0 20px 20px 0;
box-shadow: 5px 0 10px -4px #444;
color: white;
padding: 10px 25px 10px 20px;
text-decoration: none;
white-space: nowrap;
line-height: 34px;
}
.innerwrap:nth-last-child(2) a {
box-shadow: none!important;
}
#crumbs span.current{
background: #eef5ff !important;
box-shadow: none!important;
white-space: nowrap;
color: #4489ff!important;
}
<div class="crumbswrapper">
<div id="crumbs">
<div class="innerwrap">Home</div>
<div class="innerwrap">About The Tests</div>
<div class="innerwrap"><span class="current">Page Image Alignment</span></div>
</div>
</div>

(HTML/CSS) Text in a button doesn't show itself in certain browsers

As I said, depending on what browser I'm using, the button varies for some reason.
Here's the code I'm using right now-
HTML-
<input type="button" id="submitButton" onclick="generateLink()" value="Go" />
CSS-
#submitButton {
display: block;
color: white;
background-color: #8373e6;
font-size: 26px;
font-family: "Raleway", sans-serif;
font-weight: 400;
outline: none;
border: 3px solid #8373e6;
padding: 5px 15px;
margin: 20px;
border-radius: 30px;
box-shadow: 0 0 20px #9c9c9c67;
width: min-content;
cursor: pointer;
}
#submitButton:hover {
background-color: #6b5ebd;
}
#submitButton:active {
background-color: #554a97;
}
Whenever I look this up on the live server on my Windows PC (on both Firefox and Chrome), it looks the way I want it to. But when I deploy the test site on Firebase and check it out on my mobile phone (iPhone with Safari Browser), The text "Go" is gone and all I can see is a flat, text-less button.
I have also tried changing the <input> tag to a <button> tag, adding a display: block; and a bunch of other stuff but it doesnt seem to work.
Any idea why this could be happening?
Please and thanks.
Have you tried using anchor element ?
Go
a{
display: block;
color: white;
background-color: #8373e6;
font-size: 26px;
font-family: "Raleway", sans-serif;
font-weight: 400;
outline: none;
border: 3px solid #8373e6;
padding: 5px 15px;
margin: 20px;
border-radius: 30px;
box-shadow: 0 0 20px #9c9c9c67;
width: min-content;
text-decoration:none;
}
a:hover {
background-color: #6b5ebd;
cursor:pointer;
}
a:active {
background-color: #554a97;
}

Set hover on the link inside a class

I'm trying to set a :hover for a link inside a class. At first I tried
.link{
color: #e62739;
}
I saw past discusssion and try the solution proposed
.opener a.link:hover {
color: #e62739;
}
but it didn't work. Im'not sure to know where is my mistake.
.link{text-decoration:none; color:white;}
.opener a.link:hover {
color: #e62739;
}
.row {
display: flex; /* equal height of the children */
}
.col {
flex: 1; /* additionally, equal width */
padding: 1em;
border: solid;
}
div {font-family:'Varela Round';
}
.opener {
background-color: #07183d;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
border: 1px white solid;
}
.benefits {
background-color: #07183d;
border: none;
color: white;
padding: 15px 32px;
text-decoration: none;
display: inline-block;
font-size: 16px;
width:300px;
}
a {
text-decoration: none;
}
#upbutton {
border: 1px dotted white;
}
<div class="row">
<div class="opener col" style="padding-left: 10px;padding-right: 10px;"><a class="link" href="www.google.com" name="1" onclick=" show('1');" style="color: white;font-size: 14px;">SOCIETES: 400</a>
<div class="benefits" id="b1" style="display: none; color: white; font-size: 14px;">Part SBF 120 : 120<br />
Part Filiales +100M€: 280
<div id="upbutton"><a onclick=" hide('1');">fermer</a></div>
</div>
</div>
The issue is the inline styling you've got on the link: color: white;.
This is taking priority over any styling you're adding in your CSS file. Removing that from the inline styling allows the hover color to work.
If you need the white color by default add it to the stylesheet rather than inline. For example:
.link {
color: white;
}

Remove blank spaces between buttons in HTML, CSS

I want to remove blank spaces between the buttons, so that when I for example hover over the NORMAL button, there will be no blank space between it and the HARD button. How can I do that and where do these blank spaces come from?
body {
margin: 0;
}
#stripe {
background-color: white;
text-align: center;
height: 50px;
color: black;
}
button {
border: none;
background: none;
text-transform: uppercase;
height: 100%;
font-weight: 700;
color: black;
letter-spacing: 1px;
font-size: inherit;
transition: all 0.3s;
outline: none;
}
button:hover {
color: white;
background: black;
}
.selected {
color: white;
background: black;
}
<div id="stripe">
<button class="mode">Easy</button>
<button class="mode">Normal</button>
<button class="mode selected">Hard</button>
</div>
Browsers always add spaces between some elements, including buttons. To remove these, you need to set font-size to zero for their parent container. Then, to restore text size inside buttons, set font-size for them.
#stripe {
font-size: 0;
}
button {
font-size: 14px; // Set font size that you need here
}
Either remove the spaces and carriage returns, or put an HTML comment between them.
body {
margin: 0;
}
#stripe {
background-color: white;
text-align: center;
height: 50px;
color: black;
}
button {
border: none;
background: none;
text-transform: uppercase;
height: 100%;
font-weight: 700;
color: black;
letter-spacing: 1px;
font-size: inherit;
transition: all 0.3s;
outline: none;
}
button:hover {
color: white;
background: black;
}
.selected {
color: white;
background: black;
}
<div id="stripe">
<button class="mode">Easy</button><!--
--><button class="mode">Normal</button><!--
--><button class="mode selected">Hard</button>
</div>
Add display: flex; to the parent container
If using bootstrap, can group buttons together by wrapping in div with class="btn-group".
Example for v3.3.7: https://getbootstrap.com/docs/3.3/components/#btn-groups-single
Visually might or might not be what you want. Has rounded corners on left and right ends and straight line between buttons. Can probably restyle.

Tough CSS issue- how to move image down or text up within a href?

I am having a frustrating CSS problem- basically I have an image that needs to be exactly inline (not above or below) text that I have all within an a href. HTML-
<li><img class= "emoji" src="../images/emojis/1f642.png"/><p class="emojiText">Pretty good</p></li>
produces this:
You can see that the image is the right size but slightly too far up from the text. I have rearranged my html and stuck the text within its own <p>, moved the image, everything. Nothing has worked. My current CSS:
.emoji {
height: 18px;
width: 18px;
margin-top: 8px;
margin-right: 8px;
margin-left: 5px;
}
.emojiText {
margin-bottom: 10px;
display: inline;
}
.status li a {
text-indent: 5px;
display: block;
width: 250px;
color: white;
height: 35px;
font-family: 'Source Sans Pro', sans-serif;
font-size: 16px;
text-align: left;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
outline: 0;
border-top: 1px solid rgba(255, 255, 255, 0.3);
background-color: rgba(255, 255, 255, 0.1);
position: relative;
padding-top: 0px;
text-decoration: none;
}
the last block affects both but no matter how I play with the margins I can't fix the image-text align problem. What can I do to fix this?
EDIT:
If you want the emoji and text to align their center-points...
.emoji,
.emojiText {
display: inline-block;
vertical-align: middle;
}
This is what you expecting...
<style>
a { display:inline-block; background:#52D4A4; text-align:center; text-decoration:none; padding:10px; }
a img { display:block; margin:0 auto; }
</style>
<img src="http://www.cmegroup.com/etc/designs/cmegroup/cmegroupClientLibs/images/iconFacebook.png">Pretty good