How to fix the button position in HTML? [closed] - html

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I'm making a website and I have one problem: the middle button is located differently from the other buttons. Here's what the source code looks like:
<!DOCTYPE HTML>
<html>
<h1 style="text-align:center;color:darkblue;font-family:franklin gothic"><b><i>DAVE J'S OFFICIAL WEBSITE</b></i></h1>
<button style="text-align:center;color:slateblue;background:lightgreen;font-family:courier new;height:50px;width:75px;font-size:17px"><b><i>HOME</i></b></button>
<button style="text-align:center;color:slateblue;background:lightgreen;font-family:courier new;height:50px;width:75px;font-size:17px;position:relative;"><b><i>SOCIAL MEDIA</i></b></button>
<button style="text-align:center;color:slateblue;background:lightgreen;font-family:courier new;height:50px;width:75px;font-size:17px"><b><i>BLOG</i></b></button>
</div>
</html>
Can you please tell me where's the problem? Thank you for help! :-)

Interesting. I didn't realize that the text inside a button behaves that way. Seems to have a life of its own.
A couple of errors to begin with:
missing opening div
b and i reversed in h1
Fix:
add flex to wrapping div.
h1 {
color: darkblue;
font-family: franklin gothic;
font-style: italic;
font-weight: bold;
text-align: center;
}
div {
display: flex;
}
button,
.btn {
background: lightgreen;
color: slateblue;
font-family: courier new;
font-size: 17px;
font-style: italic;
font-weight: bold;
height: 50px;
text-align: center;
width: 75px;
}
<h1>DAVE J'S OFFICIAL WEBSITE</h1>
<div>
<button>HOME</button>
<button style="position:relative;">SOCIAL MEDIA</button>
<button>BLOG</button>
</div>

Related

Text not staying in border? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I am making a website for a school project and i'm trying to make the height of a border fit the size of the text. however, whenever i adjust the height the text doesn't go with it and i'm not sure how to fix this.
Code:
#slidercompare {
font-size: 17px;
font-family: sans-serif;
border-style: solid;
border-color: grey;
opacity: 87%;
position: absolute;
top: 5px;
right: 10px;
}
#slidercompare {
width: 355px;
height: 40px; /* for some reason I can't adjust the height smaller than this or else the border goes through the text. */
color: white;
background-color: black;
}
<html>
<head>
<link rel="stylesheet" href="css/boardgames.css">
</head>
<body>
<h1 id="slidercompare"><br>Chess.com (left) vs Video Chess (right)</h1>
</body>
</html>
Any ideas? Thanks
May this be what you are trying to achieve?
#slidercompare {
font-size: 17px;
border-style: solid;
border-color: grey;
opacity: 87%;
}
#slidercompare {
width: fit-content;
color: white;
background-color: black;
}
<h1 id="slidercompare">Chess.com (left) vs Video Chess (right)</h1>
I inserted <br> to <h1>. Used that to seperate a thing earlier i dont need to seperate now. So, removing the <br> tag fixed the issue.

Why has this navigation bar appeared like this? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I wanted to have a navigation bar that has white text links without it underlined but instead it has appeared with basic links in a div so hasn't worked but I don't know what is missing.
Any suggestions would be apricated.
<html>
<style>
.box3{
padding:7px;
background: black;
font-family: arial;
font-size:15px;
}
</style>
<div class="box3">
Home
About
Contact
</div>
</html>
You will need to add style to your links, for example you can add
.box3 a {
color: white;
text-decoration: none;
}
This will change the color to white and remove the underline.
.box a { css } will only target the a tags inside of the box3 div
.box3 {
padding: 7px;
background: black;
font-family: arial;
font-size: 15px;
}
.box3 a {
color: white;
text-decoration: none;
}
<div class="box3">
Home
About
Contact
</div>

Css How to make elements after span appear on different line while shrinking [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Consider this code:
<h2 class="section-title">what <span>Client Say?</span></h2>
When I shrink it get shown like this:
I want to make it like this(Ignore the underline)
What's the simplest way of achieving this?
Create a CSS rule for your span:
h2.section-title > span {
white-space: nowrap;
}
You can easily do that with a <br> tag, or put this code in the p selector:
p {
display: flex;
flex-direction: column;
}
p{
font-family: sans-serif;
font-size: 18px;
}
span{
font-size: 26px;
font-weight: bold;
text-transform: uppercase;
}
<p>What <br><span>Client say?</span></p>
You have a sans-serif font, upper case inside the span.
Note that the span might better be a div but you already provided the markup so we force it here to block display effectively the same thing.
h2 {
font-family: Helvetica, Arial, sans-serif;
font-weight: lighter;
}
h2.section-title>span {
white-space: nowrap;
display: block;
text-transform: uppercase;
font-size:1.0em;
font-weight: bold;
}
<h2 class="section-title">what <span>Client Say?</span></h2>

End of <li> text dropping to next line [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am working with a list that needs to work with mobile. When I shrink the window width down, most li elements shrink with the page but "SETUP" is dropping down. I'm using bootstrap.
.dollar {
font-size: 20px;
font-weight: 600;
vertical-align: top;
position: relative;
top: 17px;
}
.price {
font-size: 83px;
line-height: 1em;
padding: 0 3px;
font-weight: 200;
vertical-align: middle;
margin-right: -15px;
}
.price.in.table2 {
margin-bottom: 20px;
}
.price.in.table2 span {
color: #262626;
}
<ul>
<li>
<div class="price in table2">
<sup class="dollar">$</sup>
<span class="price">5000</span>
<span class="afterprice">/ ONE-TIME SETUP</span>
</div>
</li>
</ul>
You can set the whitespace property, but if it doesn't wrap it's going to overflow its container, which is worse from a design perspective. You're better off reducing the font size in a media query so that neither happens at that minimal break point.
you can use in css white-space: nowrap for <li> or for css class .price on <div> tag.

A semantic HTML tag for a signature [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
The community reviewed whether to reopen this question 8 months ago and left it closed:
Needs details or clarity Add details and clarify the problem by editing this post.
Improve this question
While making a form in HTML which will get converted to PDF, I just realized there is no HTML tag that conveys the meaning that the underlined block is a signature (or should be signed).
Any suggestions on how to use a semantically correct HTML element for a signature?
Why not use an input? This way, you get the correct semantics. For example, screen readers will understand that the user is expected to submit information.
.signature {
border: 0;
border-bottom: 1px solid #000;
}
<input type="text" class="signature" />
You can make an input tag, then style it so that it only has a border on the bottom
input {
border: none;
border-bottom: 1px solid black;
}
Simple codepen to illustrate the idea
Edit: Just noticed somebody else posted the same solution while I was typing this. What's with all the downvotes of these answers?
There are a couple of things you could do to achieve this. Option number one is a div with a border-bottom, but that is not editable. That can be viewed here:
#signaturename {
text-align: center;
font-weight: bold;
font-size: 150%;
}
#signature {
width: 100%;
border-bottom: 1px solid black;
height: 30px;
}
<div id="signaturename">
Signature:
</div>
<div id="signature">
</div>
The seconds option, which is editable, would be just a simple input box:
#signaturetitle {
font-weight: bold;
text-align: center;
font-size: 150%;
}
#signature {
width: 100%;
border: 0px;
border-bottom: 1px solid black;
height: 30px;
}
<div id="signaturetitle">
Signature:
</div>
<input type="text" id="signature">
EDIT
Now just thinking of another way to achieve what you would like! :)
You could perhaps use _, but there would be spaces right? False, there is a work around! View here:
#signaturetitle {
text-align: center;
font-weight: bold;
font-size: 200%;
}
#signature {
text-align: center;
height: 30px;
word-spacing: 1px;
}
<div id="signaturetitle">
Signature:
</div>
<div id="signature">
______________________________
</div>
As you can see with this one I am simply just adding the CSS property word-spacing.