Reputation: 15742
I have following document structure ,
<div style="background:#000000;">
<input type="button" style="float:right" value="click here"/>
<input type="button" style="float:right" value="click here"/>
</div>
but dont give me result I want.I want the background to be repeated over div body like in shown in image
Any help would be highly appreciated
Upvotes: 0
Views: 95
Reputation: 8981
Like this
css
.divbg{
background-color:black;
height:22px;
padding:5px;
}
.divbg input{
float:right;
}
Upvotes: 0
Reputation: 2874
Add to parent div haslayout:
overflow:hidden
div:after{content:''; display:block;
clear:both;}
Upvotes: 1
Reputation: 562
<div style="background:#000; overflow: hidden">
<input type="button" style="float:right" value="click here"/>
<input type="button" style="float:right" value="click here"/>
</div>
Try this. Your Container includes floated divs so its rendered with 0 height.
Upvotes: 3
Reputation: 5451
<div style="width:100%;padding:3px;background:#000;text-align:right;">
<input type="button" value="Click" />
<input type="button" value="Cancel" />
</div>
Upvotes: 0
Reputation: 128791
Firstly, you're missing a 0. #00000
isn't a valid hex colour code. Hex colour codes must either contain 3 or 6 hexadecimal digits. To resolve this, simply add a 0 (or remove two of the 0s):
<div style="background:#000000;">
...
</div>
From the CSS Color Module specification:
The format of an RGB value in hexadecimal notation is a ‘#’ immediately followed by either three or six hexadecimal characters. The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00. This ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display.
Secondly, when floating elements you need to clear them afterwards, as floating takes them out of the page's context. For this we can refer to What methods of ‘clearfix’ can I use?.
Upvotes: 3