如何在HTML Doxygen中指定图像大小?

问题描述 投票:15回答:2

我试图在Doxygen生成的HTML中手动指定图像大小。但是,正如我在documentation中读到的那样,只有在使用LaTeX输出时才会发生这种情况。这里有人知道任何解决方法吗?

举个例子,我想做这样的事情:

\image html example.png "Caption" width=10px

谢谢!

documentation doxygen image-resizing
2个回答
17
投票

把它放在CSS文件“Doc / doxygen_html_style.css”中:

div.image img[src="example.png"]{ 
    width:100px; 
}

并将Doxygen配置变量* HTML_EXTRA_STYLESHEET *设置为“Doc / doxygen_html_style.css”


11
投票

为了避免使用额外的CSS样式表,您可以直接内联CSS代码:

\htmlonly <style>div.image img[src="test.png"]{width:100px;}</style> \endhtmlonly 
@image html test.png "Caption"

甚至更好地在Doxygen配置文件中创建别名:

ALIASES = imageSize{2}="\htmlonly <style>div.image img[src=\"\1\"]{\2}</style>\endhtmlonly"

然后使用这个新的和更短的Doxygen命令:

@imageSize{test.png,height:270px;width:20px;}
@image html test.png "Caption"
© www.soinside.com 2019 - 2024. All rights reserved.