Positioning and changing button appearance - html

I'm lost. I have no idea what I'm doing, so please forgive me if I write something stupid or don't understand your answers.
My goal is to have a modal box showing after clicking a button. That's the easy part and I accomplished that already, so yay me.
Basically, I'm using this code:
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_modal2
Now, what I don't know how to do:
1) How do I change the appearance of the button? Can I change it to an image?
The only thing I could do is place an image IN the button (looks weird), but not replacing it.
2) How do I change the position of the button?
I would like to have few buttons on the left side of the screen (not website but screen). So I would need to adjust them to be on the left side, and I would also need to change the height of all the buttons.
Now, I changed the appearance and the position of the button when trying something else (a slideout), so I know it's possible. But the codes are different and I don't know how to "merge" them. The lines that work in the first one don't work in the another.
And I have absolutely no idea in what language it is. I know that it uses this createElement thing to create this button, but I don't know how to change anything about it. I went through the whole w3school and many topics on this site but I don't know how to use this knowledge - so maybe you could help me out. Thank you!

If you want to use an image to open the modal, you should not use the button tag. Just attach your event to an img.
using the example code, replace:
<button id="myBtn">Open Modal</button>
with
<img id="myImg"></img>
and attch the click event to "myImg"
var img = document.getElementById("myImg");
img.onclick = function() {
modal.style.display = "block";
}
Repositioning is going to be a little more difficult to answer without seeing your full code. W3Schools has a good intro to CSS for beginners so I would start there.

Replace button to code similar to this id="myBtn" is important
<img id="myBtn" src="image url">
And check
https://www.w3schools.com/css/default.asp
Css is used to design the html elements
it have some property like
height, background-image , position , float , flex etc
which can help you to achieve your goals.

Related

Buttons must have discernible text: Element has no title attribute

I was creating a website and I find some problems - so one of this problem is that shown in the picture this the real problem is that button isn't an html element - I don't have those buttons in my html; it's from owl-carousel.
How do I get them or how can I fix the problem and thanks
To be clear I didn't try anything because i don't know how to get to them
Give the button a 'title' attribute and it will disappear. I think it is necessary for accessibility reasons, possibly to explain the purpose of a button. For example, if a button was supposed to logout a user, a screen reader could describe that to them clearly.

CSS I want to center a image in a button that is linkable

I want to make a button with the discord logo but when I try to add the anchor tag the text goes down a bit and it becomes uncentered.
Is there a way to fix this or a different way I should be approaching this?
HTML Code:
<li class="nav__btn">
Join our Discord
</li>
Try reading this to see if it could help out.
https://coder-coder.com/how-to-center-button-with-html-css/
I would assume it would work the same way with an image button. Also try experimenting with div tags.
You have mistake in your code here: "button" >< img class.
Better use button tag for this, see example button with icon.
Also, provide some screenshot what exactly do you need.

Permanent mouse hover effect on buttons

I made a site with lots of ghostbuttons that change color when the user hovers his or her mouse over them. The buttons are arranged by color like a rainbow and I want them to stay active/colored even when the mouse stops hovering over it so that when the user hovers over the all the buttons, all the buttons will be colored at the same time.
The buttons are all placed within bootstrap columns.
I have no experience with JavaScript so pure CSS would be ideal for me. But if JavaScript is the best way to go with this please let me know exactly how to implant it in HTML and CSS.
Please don't mind any mistakes in the spelling, I'm dutch and dyslectic :P
Thanks in advance!
Place this at the bottom of your code just before the </body> tag.
<script>
$(".btn").mouseout(function() {
$(this).css("background-color","pink");
});
</script>
You can change the (".btn") bit to any class on the page, so if you only wanted it to change btn-primary classes you'd have (".btn-primary") etc.

Hyperlink Input Image

I'm struggling to replicate the login form found at the top of the PayPal website.
I have been able to create the username and password fields including the 'blue glow' from searching the web for tutorials; however, I'm unable to find any coding to add the 'clickable' question mark to the field.
I would like to be able to replicate the drop down when the question mark is clicked.
Any help will be greatly appreciated.
I hope I have made it clear.
What you could do is in your form have the question-mark image trigger a java-function... Ex:
<img src="my_image.jpg" onClick="myjava_function()">
Then in your java function you could have a div containing the drop-down displayed.
<script type="text/javascript">
myjava_function(){
document.getElementById('mydiv').style.display="block"
}
</script>
Then in near the form you could have your div that contains the drop down first being hidden but shown on the click.
<div id="mydiv" style="display:none;"><form><select><option value=1>1</option></select></form></div>
This would be my approach to getting it done. Firstly, try and get a log that is similar to the question mark, and position it in the div that you would place your area at. In the CSS for the logo apply float right so that the logo would appear to the right of that div. Then build a whole div that appears when you click the log before hand and give it the CSS display none, hence it would not be shown. Write a javascript function that works with the onclick you apply on the logo that changes the CSS of that div to display block and hence the whole div appears when you click it. The div by itself has a cross mark that could trigger another javascript call to change the CSS to display none. Good luck.

HTML/CSS PayPal Button

I've searched quite a bit, but all results reference using a custom image. I'm working with fluid layouts/retina displays and I'd like the button to be purely HTML/CSS.
Does anyone know a workaround/method?
Without seeing some code, I'd say hide the image with jQuery, then again use jQuery to create a new element with whatever content you want inside what I presume is the anchor tag used.
If javascript isn't supported, it'll show the image, if not, it'll show your new element (which you can style accordingly)
edit: ok, some clarification... use jquery to hide the existing input type="image"... then use jquery again to create a new input of type submit, do whatever you need it to do
Here's a fiddle to explain: http://jsfiddle.net/erinfreeman/PFZY8/
If there's a better way of doing it, I'm all ears. As below, I don't think jpann can add any additional code else it would simply be a case of hiding the existing input field and adding another.
Hi I was working on a project and the client wanted custom paypal buttons. I found a great site that provided custom code for the button: http://www.daddydesign.com/wordpress/how-to-create-a-custom-paypal-button-without-images/
You simply replace the input type="image" tag with an input type="submit" and style it. Hope this helps.