mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-25 16:22:37 +02:00
responsive style for image
This commit is contained in:
parent
8b04cbc38f
commit
3f874dc43e
@ -85,11 +85,5 @@ func (i *Image) ImgStyle(viewWidth, viewHeight int, align string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf("top:%.2f%%; %s;", marginH*100/float64(viewHeight), align)
|
||||||
"width:%dpx; height:%dpx; top:%.2f%%; %s;",
|
|
||||||
i.Width,
|
|
||||||
i.Height,
|
|
||||||
marginH*100/float64(viewHeight),
|
|
||||||
align,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
@ -15,4 +15,6 @@ img {
|
|||||||
margin:0;
|
margin:0;
|
||||||
padding:0;
|
padding:0;
|
||||||
z-index:0;
|
z-index:0;
|
||||||
|
max-width:100%;
|
||||||
|
max-height:100%;
|
||||||
}
|
}
|
@ -8,8 +8,6 @@
|
|||||||
<meta name="viewport" content="{{ .ViewPort }}"/>
|
<meta name="viewport" content="{{ .ViewPort }}"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<img src="../{{ .ImagePath }}" alt="{{ .Title }}" style="{{ .ImageStyle }}"/>
|
||||||
<img src="../{{ .ImagePath }}" alt="{{ .Title }}" style="{{ .ImageStyle }}"/>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
x
Reference in New Issue
Block a user