0

I have a web project. I have no trouble when styling html tags, div or class. But when I style a JSF tag (graphicImage) it doesn't work.

It doesn't work neither like this :

graphicImage{
width:280px;
height:130px;
margin-left:10px;}

nor:

h:graphicImage{
width:280px;
height:130px;
margin-left:10px;}

How can I style with external css? Can you please help me?

9
  • h:graficImage might me in your code. You have to style what it renders. Or add inline style attribute Commented Apr 19, 2018 at 17:36
  • Of course I use h:graphicImage tag in xhtml file. And I want to style this tag.. Commented Apr 19, 2018 at 17:38
  • 1
    Yes, but what does it render on your client? Do you have a live preview Commented Apr 19, 2018 at 17:39
  • 1
    Please take a step back and learn what JSF is and does before trying things... It effectively just renders HTML Commented Apr 19, 2018 at 17:40
  • Yes the photo is on the web site with its size. (really big). not the size I wrote in css Commented Apr 19, 2018 at 17:42

2 Answers 2

2

You DON'T style jsf xhtml tags. You style the client-side html. Take a browser developer tool and inspect the source of what is in the browser. A JSF h:graphicImage client-side side is an <img> tag. Style that.

img {
   width:280px;
   height:130px;
   margin-left:10px;
}

But you can of course use the style and styleClass as well

Sign up to request clarification or add additional context in comments.

Comments

1

Maybe you can do at the tag itself, by using style attribute.

<h:graphicImage style="width:280px;
                height:130px;
                margin-left:10px;"/>

or might be like this.

<h:graphicImage styleClass="testStyle"/>

.testStyle
 {
    width:280px;
    height:130px;
    margin-left:10px;
 }

1 Comment

Sure but that does not explain the error in thinking in the question and hence the reason for the question. Using a (styleClass) is available all over the internet

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.