Jump to content

Upomoc


milkokv

Recommended Posts

imam problem sa displey:inline-block.Hocu dva div-a jedan pored drugog i oba da zauzimaju po polovinu ekrana

#pola1

{

background-color:red;

height:50px;

width:50%;

display:inline-block;

}

#pola2

{

background-color:black;

height:50px;

width:50%;

display:inline-block;

 

<body>

 

<div id="pola1">

</div

<div id="pola2">

</div>

 

</body>

 

stvarno ne znam sto ovo nece da radi

Link to comment
Share on other sites

Inline-block elementi su i dalje inline elementi i ukoliko u html-u nisu odmah jedan iza drugog, renderuje se space izmedju njih, tako da 50% ne radi posao.

Postoji vise nacina da se resi ovaj "problem" (u principu povo nije problem vec neadekvatno koriscenje css-a). Neke mozes da pogledas ovde:

https://davidwalsh.name/remove-whitespace-inline-block

Ali u konkretnoj situaciji, ispravnije je koristiti float nego inline-block, ili ukoliko browser support nije problem, koristiti flexbox

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...
powered by