I am displaying a list of files on a page, at the end of the each file nameI have used one background image(cross mark). But I need that image should be clickable element. When I click on the image it should delete from the given path.For more details, see the below image
How can I achieve that, give some suggestion.
Below html and css code I am using to display that image
$data .= '<div class = "public-file-names" ><a href="'.$path .'xmluploads/'. $foldnames .'/'. $filenames.'" target="_blank" download>' ."--". $filenames .'</a><br></div>';
div.public-file-names {
background: transparent url("../images/close-cross.jpg") no-repeat scroll right center;
font-size: 14px;
margin: 10px 0;
}
You need to add another anchor tag for the delete button, then move the background image to the tag.
$data .= '<div class = "public-file-names" ></div>';
.public-file-names {
font-size: 14px;
margin: 10px 0;
}
.delete-button {
float: right;
display: inline-block;
width: 16px;
height: 16px;
background: transparent url("../images/close-cross.jpg") no-repeat scroll right center;
}
you can use jQuery but it can be achieved by html
you could just wrap each of your .public-file-names divs in an a tag
<a href="your-link.html">
<div class="public-file-names">
</div>
</a>
<a href="your-link.html">
<div class="public-file-names">
</div>
</a>
<a href="your-link.html">
<div class="public-file-names">
</div>
</a>
if that doesnt work for you let me know if you want me to help you using jQuery
Related
enter image description hereSo I have a problem, when i add negative margins to links the links move, but they are not clickable.
style file fragments:
.abc123{
margin-top: -14% ;
margin-bottom: 2%;
}
.link{
background: #E3B448;
border-radius: 8%;
margin-left: auto;
margin-right: auto;
padding: 1px 5px;
}
<center>
<p class = "abc123">
<a class="link" href="shitpost.html">Loud = Funny</a>
<a class="link" href="first_page.html">Cały tekst znajdziesz tu</a>
</p>
</center>
enter image description here
The 1st foto is when it's not clickable (class = "abc123" is included in the code), the second one is what it looks without it, and I can click links normally.
all i want to do is to be able to create this main page button.
i want to put an image and text next to each other in a button and when click on the button it'll link me to the main page. (i'll give it a <a href... later) i couldn't resize or stretch the image in button.
in order to observe what does my code, i expanded dimensions of the div and button. normally, my button is w:100px, h:30px and the div is w:1000px, h:30px. and it looks like this
i'm new to css & html and as well as asp.net. please help, thanks.
my codes:
<div style="width:800px; height:1000px; margin-left:auto; margin-right: auto; background-color:#D9FFFF">
<button style="width:725px; height:427px; background-size: 5%; background:url('pics/home.png') no-repeat 1px 1px; padding:0; margin:0;">Home Page</button>
</div>
Like I said in the comment, it is not a button it is an anchor. Shouldn't be too hard with basic HTML and CSS knowledge. The thing you probably struggling with is the home icon. Easiest way to get this is by using the font-awesome library by adding it to the head element: <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.7/css/all.css">
and add it as innerHTML to the anchor: <i class="fas iconname"></i> TEXT
a {
text-decoration: none;
color: black;
background-color: lightgrey;
display: inline-flex;
padding: 5px;
width: 100px;
height: 30px;
font-size: 14.5px;
justify-content: space-between;
align-items: center;
}
a > i {
color: grey;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.7/css/all.css">
<i class="fas fa-home"></i> MAIN PAGE
I've currently created a navigation bar for my website for university assignment. I've implemented an image on their which is the universities logo which I'd like to link to the university homepage. However, when I try to use the anchor tag '' to make the image clickable to link to the homepage, it messes up for the style of my navigation bar and would like to know if there's a workaround. I know the issue is that the image will take on the styles of the anchor tags I have declared for the navigation bar. I'll include images of before and after creating the link and show the HTML and CSS of that section.
This is the navbar before making the image clickable.
This is the HTML for it:
<div class="top_nav">
<img class="logo" src="images/NTU_badge.png" alt="NTU Badge">
<a class="active" href="#Home"> Home </a>
Hackathon
Choose a Challenge
Digital Horizons
</div>
This is the CSS for it:
.top_nav {
overflow: hidden;
background-color: #2c3e50;
border-bottom: 20px solid #ed0162;
position: fixed;
top: 0;
width: 100%;
}
.top_nav a {
float: left;
color: white;
text-align: center;
padding: 30px 20px;
text-decoration: none;
font-size: 17px;
margin-bottom: 0;
font-family: monospace;
}
.top_nav a:hover {
background-color: #ed0162;
color: white;
}
.logo {
float: left;
margin: 15px;
}
This is the HTML and webpage after I try to make the image clickable:
There is now big spacing inbetween and the hover style now affects the image when I don't want it too.
The HTML code after:
<header>
<div class="top_nav">
<a href="https://www.ntu.ac.uk/">
<img class="logo" src="images/NTU_badge.png" alt="NTU Badge">
</a>
<a class="active" href="#Home"> Home </a>
Hackathon
Choose a Challenge
Digital Horizons
</div>
</header>
I've tried removing the 'logo' class from the image style but it doesn't really change it that much.
There are lots of ways to do this but flexbox makes it really easy. also will simplify your css. Just wrap the image in a anchor tag to make it clickable.
.top_nav {
display:flex;
justify-content:space-around;
align-items:center;
overflow: hidden;
background-color: #2c3e50;
font-size:2vw;
width: 100%;
}
.top_nav a {
width:10%;
color: white;
text-decoration: none;
font-family: monospace;
}
.top_nav a:hover {
background-color: #ed0162;
color: white;
}
img{
width:100%;
}
#short{
width:2.5%;
}
<div class="top_nav">
<a id='short' href='https:\\www.google.com'><img class="fa facebook" src="https://www.sustainablewestonma.org/wp-content/uploads/2019/09/facebook-square-brands-blue.png" scale="0"></a>
<a class="active" href="#Home"> Home </a>
Hackathon
Choose a Challenge
Digital Horizons
</div>
I find that it's generally pretty poor practice to use element names (such as a and div) in CSS selectors at all, for this exact reason.
Consider adding something like class="navigation" to each link in your navbar, and then change the .top_nav a selector to .top_nav .navigation. Then you could add a similar class to the logo <a>.
Not only does this make the CSS more specific, but much more readable when someone else (or you in six months' time) has a look at this without any other context of the rest of the page.
One way to solve this is to use the :first-of-type pseudo css selector. Something like that would be the correct way to handle it:
.top_nav a:first-of-type {padding: 0;}
EDIT
I'm sorry, on the original answer i miss the part to advice you wrapping your image with a element. So change this:
<img class="logo" src="images/NTU_badge.png" alt="NTU Badge">
To:
<img class="logo" src="images/NTU_badge.png" alt="NTU Badge" />
I have a small menu panel that needs to be included on my page that looks like the image below:
I have the code in a jsFiddle that I have created so far and I know some of the images are incorrect but the issue is I cannot get the header to align neatly to the right of the image as shown in the image.
Any clues?
Changed 2 properties:
ul.block-with-icons span {
display: block;
font-size: 11px;
line-height: 1.2em;
position: relative;
top: 12px;
}
h5 {
font-size: 16px;
position: absolute;
left: 98px;
top: 30px;
}
http://jsfiddle.net/wRkdL/25/
If you are developing in HTML5, I think the best option is to move <h5> inside <a> tag like this:
<li class="b1">
<a href="#">
<h5>Our background</h5>
<span>A little background info on who we are...</span>
</a>
</li>
In HTML4 it's not allowed to insert a block element inside anchors.
I'm applying a css class for the following asp.net custom control which renders in browser something like this:
<div class="box search_mlo">
<div class="gray_box">
<div class="blue_box">
<div>
<input id="Search_srcText" class="btn" type="text" onblur="return objSearchWidgetLibrary.searchLostFocus(ECMSSearchTextBox2_srcText)" onfocus="return objSearchWidgetLibrary.clearText2(ECMSSearchTextBox2_srcText)" onkeypress="return objSearchWidgetLibrary.fnTrapKD2('ECMSSearchTextBox2_srchAnchor1',event)" name="ECMSSearchTextBox2$srcText">
</input>
<a id="Search_srchAnchor1" class="btn" onclick="return objSearchWidgetLibrary.onsearchclick1('ECMSSearchTextBox2_srcText','ECMSSearchTextBox2_srchAnchor1')" href="../System/SearchResults.aspx?k=">
<span>Search</span>
</a>
</div>
</div>
</div>
</div>
The CSS class is:
.blue_box div a.btn
{
background: url("/publish/images/btn_search.jpg") no-repeat;
height: 36px;
width: 86px;
}
.blue_box div input.btn
{
background: url("/publish/images/bg_search.jpg") no-repeat scroll 9px 6px #FFFFFF;
border: 1px solid #0064AD;
color: #BFBFBF;
float: left;
font-size: 1.3em;
font-style: italic;
font-weight: bold;
height: 21px;
margin-right: 4px;
margin-top: 2px;
padding: 5px;
width: 328px;
}
so it looks something like search box and button to submit. This control is used by other sites so, for some sites we require only hyperlink search button and in some we replace image. But in this case I'm trying to replace image but I'm getting only half of the image something like below..
http://i.stack.imgur.com/Dfaqn.jpg
You can see a search text coming inside that image.
The prototype is something like this and the first button should match with this:
http://i.stack.imgur.com/QpRmg.jpg
I cannot remove that span tag present inside anchor tag since in other sites its working fine and removing that would create problem in them.
can any one help with feasible solution where I can get the entire image.?
Thanks in advance.
#Sayed; a tag is an inline element & inline elements didn't take height, width, vertical margin & padding. So; give display:block in your css for a tag like this:
.blue_box div a.btn
{
background: url("/publish/images/btn_search.jpg") no-repeat;
height: 36px;
width: 86px;
display:block
}