Adriano Luís
Adriano Luís

Reputation: 1

Simple way to make a mobile page with labels and inputs

I'm a newbie when talking about HTML, and I need to make a web page to a data collector with Windows CE. These stuff have a very low resolution screen (300px-) and everything I try to do goes bad on that resolution.

The best screen I could make:

        //Remove a mensagem de sucesso ou falha
        function none(){
            document.getElementById('message').style.display = 'none';
        }

        //Insere a mensagem de sucesso ou falha
        function block(){
            document.getElementById('message').style.display = 'block';
        }

        function setCodDeposito1(){
            document.getElementById('codDeposito').value = "1";
        }

        function alertSuccess(){
            alert("");
        }
        body{
        margin-left: 3px;
        font-family: sans-serif;

        }

        .btnLimpar{
        margin-top:5px;
        padding: 0px 65px 0px;
        margin-left: 180px;
        text-align: center;
        }
        .btnConsulta{
        width: 100%;
        text-align: center;
        margin: 5px 0px 4px 0px;

        }

        label{
        margin: 3px 0px 3px;
        display:inline-block;
        float: left;
        clear: both;
        text-align:right;
        }

        h3{
        align-self: center;
        }
        input{
        margin-bottom: -10px;
        text-align: right;
        float: right;

        }

        #main{
            overflow: all;
            width: 100%;
            height: 100%;
        }
<h3>Consulta de Produtos</h3>
<div id="main">
    <label for="codDeposito">C&oacute;digo do Dep&oacute;sito:</label><input type="text" id="codDeposito" size="20"/>
    <label for="codBarras">C&oacute;digo de Barras:</label><input type="text" id="codBarras" size="20" />
    <input type="button" class="btnConsulta" value="Consultar" onclick="block(); setCodDeposito1();"/>
    <form>
        <label for="codProduto">C&oacute;digo do Produto:</label><input type="text" id="codProduto" size="20"/>
        <label for="descProduto">Descri&ccedil;&atilde;o do Produto:</label><input type="text" id="descProduto" size="20"/>
        <label for="complemento">Complemento:</label><input type="text" id="complemento" size="20"/>
        <label for="enderecamento">Endere&ccedil;amento:</label><input type="text" id="enderecamento" size="20"/>
        <label for="qtdEstoque">Qtd em Estoque:</label><input type="text" id="qtdEstoque" size="20"/>
        <input type="button" class="btnLimpar" value="Limpar" onClick="this.form.reset();none();"/>
    </form>
</div>
<div class="alert" id="message" style="display: none;">
    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
    Consultado com sucesso!
</div>

Sorry for the giant code with a lot of trash that does nothing..

Anyways, I need to make a web page like this that goes well in a very small resolution. And my code is showing a success message when I click on Consult, but that's showing in the middle of the screen and I can't take it out there.

Do you have any suggestions with a better way to do this?

Upvotes: 0

Views: 71

Answers (1)

claudios
claudios

Reputation: 6656

You need to add media queries to your css. Be specific also on adding it. Example:

@media only screen and (max-width: 300px) {
    body {
        background-color: #000;
    }
}

Upvotes: 1

Related Questions