In the complex component, how to make the image as background image and the text as center align on the background image??
Solved! Go to Solution.
Views
Replies
Total Likes
It should be taken care in your CSS making image as background and text as center aligned for that div
Views
Replies
Total Likes
It should be taken care in your CSS making image as background and text as center aligned for that div
Views
Replies
Total Likes
bsloki wrote...
It should be taken care in your CSS making image as background and text as center aligned for that div
<%@include file="/libs/foundation/global.jsp"%>
<%@ page import="com.day.cq.wcm.foundation.Image" %>
<%
Image image = new Image(resource, "image");
image.setSelector(".img");
String text = properties.get("text", "TEXT NA");
%>
<%= text %>
<%
image.draw(out);
%>
<%
image.getDescription().length();
%>
i m using this code...how to have the css inside it
Views
Replies
Total Likes
The image object has a getSrc() property. You can switch your code up to utilize it:
<%
Image image = new Image(resource, "image");
image.setSelector(".img");
String text = properties.get("text", "TEXT NA");
%>
<%= text %>
<div style="background-image: url(<%=image.getSrc() %>);"></div>
Views
Replies
Total Likes