3

how can I make an empty DIV or SPAN to be shown and grow or shrink according to the content of the others?

This is what I have until now:

.text{	float:left;	display:inline-block; } .borda{	display:inline-block;	background-image: url('borda.png');	background-repeat:repeat-x;	background-position:center bottom;	float:left;	margin:30px 0 0 5px;	empty-cells: show;" } .numbers{	float:right;	display:inline-block; }
<div> <span class="text">Text Text Text</span><span class"borda"></span><span class="numbers">Numbers</span> </div>

8
  • This may be help you stackoverflow.com/questions/4171286/… Commented Aug 14, 2015 at 16:44
  • Do you want to make a "borda" grow because of "numbers" ? Commented Aug 14, 2015 at 16:47
  • empty-cells: show;" what's that "? Commented Aug 14, 2015 at 16:50
  • class"borda" should be class="borda" Commented Aug 14, 2015 at 16:53
  • @RokoC.Buljan about empty-cells take a look at this w3schools.com/cssref/pr_tab_empty-cells.asp Commented Aug 14, 2015 at 17:45

1 Answer 1

2

You can use the CSS3 flexbox specifications. Simply allow the .borda container to grow, i.e. flex-grow: 1. I have changed the background colours to show contrast. There is some error with your markup, including the missing = for the class assignment for .borda.

div { display: flex; } .text { background-color: #eee; } .borda { background-color: #333; flex-grow: 1; } .numbers { background-color: #eee; }
<div> <span class="text">Text Text Text</span><span class="borda"></span><span class="numbers">Numbers</span> </div>

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.