-
Is there any way to add styles to align elements correctly ? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Each element placed on a custom web page has a For example, the CSS to align the label columns of a custom web page is following: .noorder {
width: 100%
}
.noorder label {
display: inline-block;
width: 10.5em;
cursor: pointer;
padding: 5px
}
.noorder input[type='number'] {
width: 4em;
margin: 3px 0.3em 0 0;
padding: 3px
} The JSON for a custom web page declaration to enable this CSS in a sketch using the ACStyle element looks like this: {
"uri": "/elements",
"title": "SmartElec config",
"menu": true,
"element": [
{
"name": "cs",
"type": "ACStyle",
"value": ".noorder{width:100%}.noorder label{display:inline-block;width:10.5em;cursor:pointer;padding:5px}.noorder input[type='number']{width:4em;margin:3px 0.3em 0 0;padding:3px}"
},
{
"name": "cap",
"type": "ACText",
"value": "E-scooter characteristics",
"style": "color:navy"
},
{
"name": "wheel",
"type": "ACInput",
"label": "Wheel size",
"apply": "number"
},
{
"name": "motors",
"type": "ACInput",
"label": "Motor number of poles",
"apply": "number"
},
{
"name": "throttle",
"type": "ACCheckbox",
"label": "Throttle regeneration",
"value": "throttle",
"labelposition": "infront",
"checked": true
},
{
"name": "sep",
"type": "ACElement",
"value": "<hr style=\"height:1px;border-width:0;color:gray;background-color:#52a6ed\">",
"posterior": "par"
},
{
"name": "load",
"type": "ACSubmit",
"value": "Load",
"uri": "/load"
},
{
"name": "save",
"type": "ACSubmit",
"value": "Save",
"uri": "/save"
}
]
}
|
Beta Was this translation helpful? Give feedback.
-
thanks a lot for this answer. i'll try that ! |
Beta Was this translation helpful? Give feedback.
-
After many days of trial and error I have achieved this in case it helps someone. I think I should sign up for a ccs w3 master class ;) .noorder input[type='text'] .noorder input[type='number'] .noorder input[type='button'] Example 1: {
"name": "style",
"type": "ACStyle",
"value": "
.noorder {
margin: auto
}
.noorder label {
display: inline-block;
width: 9em;
margin: 5px 0 0 0;
cursor: pointer;
padding: 5px
}
.noorder input[type='number'] {
display: inline-block;
width: 40px;
height: 25px;
margin: 5px 0 0 12.5em;
cursor: pointer;
padding: 5px;
text-align: center;
background-color: #EBD7FF
}
.noorder input[type='button'] {
background-color: #4A2E7C
}"
},
Example 2: {
"name": "style",
"type": "ACStyle",
"value": "
.noorder {
margin: auto
}
.noorder label {
display: inline-block;
width: 10.5em;
cursor: pointer;
padding: 5px
}
.noorder input[type='text'] {
display: inline;
width: 200px;
height: 25px;
margin: 5px 0.3em 0 0;
cursor: pointer;
padding: 5px;
background-color: #EBD7FF
}
.noorder input[type='button'] {
background-color: #4A2E7C
}"
},
With this you can change colors and alignments of each custom web page and buttons. Even so, it is not exactly as I would like and it is due to lack of knowledge on my part. but it might help other people On the other hand, I can't change the background color of the menu without touching the library, not even with.
#ifdef AUTOCONNECT_MENUCOLOR_BACKGROUND
#undef AUTOCONNECT_MENUCOLOR_BACKGROUND
#define AUTOCONNECT_MENUCOLOR_BACKGROUND "#1a237e"
#endif // !AUTOCONNECT_MENUCOLOR_BACKGROUND
|
Beta Was this translation helpful? Give feedback.
Each element placed on a custom web page has a
div
element with a.noorder
class as the parent element. You can qualify the style of the particular elements by using CSS selector with the.nooder
class.You allow the sketch to override the style of selected elements by declaring the CSS using ACStyle element within your custom web page definition.
For example, the CSS to align the label columns of a custom web page is following:
The JSON for a custom web page decla…