Horizontal line in card - (small contribution)

I have come across a few topics where users are attempting to place a horizontal line in their UI. I myself had this need so messed around with a </>template node and some HTML. There could be better ways, but this is what I came up with. You can also include text if desired, or just remove that from the code. This is also a little fancy using box shadows, but it is easy just to make a simple line, change width, color...etc.

I have gotten a lot from this forum, just a little something to give back.

[{"id":"dbfc9026.affcc","type":"ui_template","z":"87cea03e.b710b","group":"b5ec3e8f.47604","name":"UI Horizontal line top with title","order":14,"width":20,"height":1,"format":"<html>\n <!--box-shadow: (left) -5px (top) -5px (blur) 5px (spread)5px (color)#888;-->\n<head>\n<style>\n\th1 {text-align: center;}\n\tp {text-align: center;}\n\tdiv {text-align: center;}\n</style>\n<hr style=\n    \"border-top: 1px solid #a39d99;\n    border-width: 0px 0px 0;\n    width: 100%;\n    margin-left: auto;\n    margin-right: auto;\n    height: 0px;\n    margin-top: 0;\n    border-bottom: 1px solid #a39d99;\n    box-shadow: 0 0 3px #a39d99\";\n\t>\n<div>Historical Data Query</div>  \n</html>\n\n\n\n\n\n\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":1190,"y":540,"wires":[[]]},{"id":"b5ec3e8f.47604","type":"ui_group","name":"Climate - Exterior","tab":"c2eeb8ac.68fa38","order":1,"disp":true,"width":20,"collapse":false},{"id":"c2eeb8ac.68fa38","type":"ui_tab","name":"Climate - Exterior","icon":"wb_sunny","order":2,"disabled":false,"hidden":false,"info":"help"}]
2 Likes

Small improvement to center the text without inadvertently changing the "div" css tag that is used throughout node red and altering other text elements. As I am learning, there is usually a better way to do things. In this case a simple use of the "center" tags is a much better way to go.

[{"id":"dbfc9026.affcc","type":"ui_template","z":"87cea03e.b710b","group":"b5ec3e8f.47604","name":"UI Horizontal line top with title","order":12,"width":20,"height":1,"format":"<html>\n <!--box-shadow: (left) -5px (top) -5px (blur) 5px (spread)5px (color)#888;-->\n<head>\n<hr style=\n    \"border-top: 1px solid #a39d99;\n    border-width: 0px 0px 0;\n    width: 100%;\n    margin-left: auto;\n    margin-right: auto;\n    height: 0px;\n    margin-top: 0;\n    border-bottom: 1px solid #a39d99;\n    box-shadow: 0 0 3px #a39d99\";\n\t>\n<center>Historical Data Query</center> \n</html>\n\n\n\n\n\n\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":1190,"y":540,"wires":[[]]},{"id":"b5ec3e8f.47604","type":"ui_group","name":"Climate - Exterior","tab":"c2eeb8ac.68fa38","order":1,"disp":true,"width":20,"collapse":false},{"id":"c2eeb8ac.68fa38","type":"ui_tab","name":"Climate - Exterior","icon":"wb_sunny","order":3,"disabled":false,"hidden":false,"info":"help"}]
1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.