I'm using Thymeleaf (Spring Boot project). I have the code:
<div class="single_product_thumbnails">
<ul>
<li class="active"><img th:src="${product.mainImage}" alt="" data-image="${product.mainImage}"/></li>
<li><img th:src="${product.imageSecond}" alt="" data-image="${product.imageSecond}"/></li>
<li><img th:src="${product.imageThird}" alt="" data-image="${product.imageThird}"/></li>
</ul>
</div>
Th:src load image thumbnail in left panel (EL code works). Data-image load image on the center of screen - code not work i.e. if I use data-image="http://image.png" or data-image="images/single_2.jpg" it works but my EL expression doesn't work.
Original code (fully works - from https://colorlib.com/etc/coloshop/single.html):
<div class="single_product_thumbnails">
<ul>
<li><img src="images/single_1_thumb.jpg" alt="" data-image="images/single_1.jpg"></li>
<li class="active"><img src="images/single_2_thumb.jpg" alt="" data-image="images/single_2.jpg"></li>
<li><img src="images/single_3_thumb.jpg" alt="" data-image="images/single_3.jpg"></li>
</ul>
</div>
How to use EL properly in this data-image example? Thank you in advance for your help.
Thymeleaf only evaluates attributes that are prefixed with th:. You should be able to use:
<div class="single_product_thumbnails">
<ul>
<li><img src="images/single_1_thumb.jpg" alt="" th:data-image="${product.mainImage}" /></li>
<li class="active"><img src="images/single_2_thumb.jpg" alt="" th:data-image="${product.imageSecond}" /></li>
<li><img src="images/single_3_thumb.jpg" alt="" th:data-image="${product.imageThird}" /></li>
</ul>
</div>
The other option would be to use th:attr, to dynamically generate the attribute you want. Like this:
<img src="images/single_1_thumb.jpg" alt="" th:attr="data-image=${product.mainImage}">
Related
I am currently working on a portfolio for my website. I added my picture in it, but the picture does not show.
<div id="wrap">
<h1>Portfolio/CV</h1>
<ul id="gallery">
<li>
<a href="#">
<img src="logo.png"> <!-- doesn't show -->
<div>These are coming soon!</div>
</a>
</li>
</ul>
</div>
You can see above html live on my portfolio.
I have uploaded the image to my server.
Does somebody understand what I'm doing wrong?
this is how your HTML looks, when you are able to access those links your site will work. Seems your images are uploaded to a different folder or maybe permission to read is not there.
http://www.anika.nl/logo.png
<body>
<div id="wrap">
<h1>Portfolio/CV</h1>
<ul id="gallery">
<li><img src="logo.png"><div>These are coming soon!</div></li>
<li><img src="lights2.jpg"><div>I am working on it!</div></li>
<li><img src="flo3.jpg"><div>Why are you even reading this?</div></li>
<li><img src="lights1.jpg"><div>Humans are always so curious</div></li>
<li><img src="flo2.jpg"><div>LOL </div></li>
<li><img src="lights3.jpg"><div>Can't stop?</div></li>
</ul>
</div>
</body>
</html>
Does anyone know how i can add "links" to these image row codes
HTML
<ul>
<li><img src="1.jpg"></li>
<li><img src="2.jpg"></li>
<li><img src="3.jpg"></li>
<li><img src="4.jpg"></li>
<li><img src="5.jpg"></li>
<li><img src="6.jpg"></li>
<ul>
CSS
#images {
width: 2000px;
}
#images img {
width: 300px;
height: 200px;
float: left;
}
Fiddle Example: http://jsfiddle.net/mdesdev/gEGMF/
Could you possibly mean you want to add hyperlinks to the pictures? A simple <a href='[[your URL'>[[img-tag]]</a> should do the trick, as seen here.
Try this:
<ul>
<li><img src="1.jpg"/></li>
<li><img src="2.jpg"/></li>
<li><img src="3.jpg"/></li>
<li><img src="4.jpg"/></li>
<li><img src="5.jpg"/></li>
<li><img src="6.jpg"/></li>
</ul>
I have been created css3 image slideshow, Its working perfect, but location of slideshow is absolutely incorrect.
Here is the code in html:
<div id = "header">
<div class = "wrap">
<div class = "logo">
<img src = "img/photo.jpg" alt = "" />
</div>
<div class = "navigation">
<ul>
<li>HOME</li>
<li>ABOUT </li>
<li>HISTORY </li>
<li>NEWS </li>
<li>CONTACT </li>
<li>CONTACT </li>
<li>CONTACT </li>
</ul>
</div>
</div>
</div>
<div class = "wrap">
<div class="slides">
<ul>
<li><img src="slide-1.jpg" alt="" /></li>
<li><img src="slide-2.jpg" alt="" /></li>
<li><img src="slide-3.jpg" alt="" /></li>
<li><img src="slide-4.jpg" alt="" /></li>
</ul>
</div>
</div>
<div class = "wrap">
<p>Saina Nehwal (About this sound pronunciation (help.info); born 17 .../p>
</div>
Here is my working jsfiddle: http://jsfiddle.net/qj6s0xdh/
Can anyone help me to align the position of slideshow?
Thanks in advance.
Is this what you want?
http://jsfiddle.net/qj6s0xdh/2/
I don't think the float: left; in the #header is what you want.
Here is the slider is now center-aligned by just adding following to the ul of slider
width: 60%;
margin: auto;
display: block;
Add the following properties:
.slides ul li {
width:100%;
}
.slides ul li image {
margin:0 auto;
}
Learning Bootstrap (and frontend-stuff in general) recently and am stuck at one particular problem. I have a navbar that scales across the whole pagewidth with a logo aligning to the left and then a followup of 5 items in an unordererd list, floating to the right. Works great as long as the responsiveness doesn't kick in. The general behavior showing when entering a certain min/max width - ordering the list-items underneath each other - is great, however, the right floating is lost somewhere down the road then. While skimming through the bootstrap-responsive.css I have trouble spotting the line responsible for this behavior.
Does anybody have any idea where I should start looking?
<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="#"><img src="img/logo.png" alt="horizontal-ad"></a>
<ul class="nav" style="float: right;">
<li><img src="img/ad/adhorizontal.jpg" alt="horizontal-ad"></li>
<li><img src="img/ad/adhorizontal.jpg" alt="horizontal-ad"></li>
<li><img src="img/ad/adhorizontal.jpg" alt="horizontal-ad"></li>
<li><img src="img/ad/adhorizontal.jpg" alt="horizontal-ad"></li>
<li><img src="img/ad/adhorizontal.jpg" alt="horizontal-ad"></li>
</ul>
</div>
</div>
Besides the inline-styling of the unordered list, the only rule I override is .navbar-inner from the main bootstrap.css to adjust the coloring.
Regards!
::edit: I just realized that this has nothing to do with the bootstrap-responsive.css, since I removed it but the behavior remains the same. However, the problem still exists. ::
html
<ul class="nav" id="nav_ul">
CSS
#nav_ul{
float:right!important;
}
Try Boostrap helper class pull-right:
<ul class="nav pull-right">
or try to display in block:
<ul style="display:block" class="nav pull-right">
Try this
<div class="navbar">
<div class="navbar-inner clearfix">
<a class="brand pull-left" href="#"><img src="img/logo.png" alt="horizontal-ad"></a>
<ul class="nav pull-right">
<li><img src="img/ad/adhorizontal.jpg" alt="horizontal-ad"></li>
<li><img src="img/ad/adhorizontal.jpg" alt="horizontal-ad"></li>
<li><img src="img/ad/adhorizontal.jpg" alt="horizontal-ad"></li>
<li><img src="img/ad/adhorizontal.jpg" alt="horizontal-ad"></li>
<li><img src="img/ad/adhorizontal.jpg" alt="horizontal-ad"></li>
</ul>
</div>
</div>
Try using:
float: right!important;
clear: right;
text-align: right;
Also to kepp it on the same line though if the screen gets too small it will disappear so won't work well on mobile devices use this line of css:
white-space: nowrap;
http://jsfiddle.net/hive7/b9cgn/4
This line displays my logo:
<li><img class="logo" src="selector/logo.png" alt="" /></li>
How can I add a clickable link to this image?
Try this here:
<li>
<a href="target.html">
<img class="logo" src="selector/logo.png" alt="" />
</a>
</li>
You want properly also to remove the border around the image. To fix that use this CSS:
.logo {
border: 0;
}
Are you just asking how to make the image a hyperlink to itself? Like this?:
<li>
<a href="selector/logo.png">
<img class="logo" src="selector/logo.png" alt="" />
</a>
</li>