Css alignments

Asked

Viewed 152 times

3

My case is this::

inserir a descrição da imagem aqui

But I want to leave it at that:

inserir a descrição da imagem aqui

HTML

    <div id="problema">

    <div id="verificar" style="width: 500px; height: 100px;">

    <h1  style=" clear: both;position: relative; display: table; " >Log<sub>4</sub> <sup>64</sup> = 
    <input style=" display: table;" type="text" id="valor_total" /></h1>

    </div>
    </div>

CSS

 // Não sei o css que deverei usar :D
 // já tentei vários :/

3 answers

4


I leave two options, both using the display: inline;.
The difference is that the inline does not break line. The display: block; inserts the line break you don’t want.

#1

Take out the <input> from within the <h1></h1> and put the header with display: inline;. Then you don’t even need style=" display: table;" in the <input>.

Example: http://jsfiddle.net/bLN2Z/2/

#2

Place style=" display: inline;" in the <input>.

Example: http://jsfiddle.net/bLN2Z/1/


And if you want to help the vertical position of <input> you can use it like this:

input {
    position: relative;
    top: -5px;
}

Example: http://jsfiddle.net/bLN2Z/3/

  • 1

    Thank you very much.

3

SUGGESTION

In your case you could just use the tags sup and sub, unless you want to go through css.

Here’s a Example :

<div style="font-size: 40px;">
    <span>Log</span><sub>4</sub><sup>64</sup> = 3
</div>

1

<div id="verificar">
    <h1  style=" clear: both;position: relative; display: table; " >Log<sub>4</sub> <sup>64</sup> =     
</div>
<div id="campo">
    <input style=" display: table;" type="text" id="valor_total" /></h1>
</div>

<style type="text/css">
    #verificar{
        width: 125px;
        height: 100px;
        float: left;
    }
    #campo{
        float: left;
        margin-top: 32px;
    }

</style>
  • Hi Rafael, welcome to [en.so]. It’s nice to explain because your code solves the problem. Check out the guide [Answer].

Browser other questions tagged

You are not signed in. Login or sign up in order to post.