asked    Baldwin     2018-10-22       html       99 view        1 Answer

[SOLVED] How can I put two divs alongside each other keeping the second one centered using flexbox?

This question already has an answer here:

  1 Answer  

        answered    Lucy     2018-10-22      

Children of flex container will follow his parent alignment rules. As you said, you need the left element to be sticked on the left of the centered one. So le left element should not be related to the container, but instead, to the centered element.

.Container {
  display: flex;
  justify-content: center;
}

.Left {
  background-color: red;
  position: absolute;
  right: 100%;
  top: 0;
}

.Centered {
  background-color: cyan;
  position: relative;
}













/* Demo only */

.Centered, .Left {
  border-radius: 4px;
  padding: 8px 24px;
}
<div class="Container"> 
  <div class="Centered">
    <div class="Left">Left</div>
    Centered
  </div>
</div>




Your Answer





 2018-10-22         Winifred

How do I create ArrayList of Objects (string car model, int count, string percentage) in a loop?

So I need to create Object for example called Car containing - String car model- int count- String percentageAfter getting this data how do I put all Car Objects into for-loop of Objects to get Arraylist of all Car objects? You could do: List<Car> carList = new ArrayList();for(int i = 0; i < numberOfDesiredCars; i++){ Car c = new Car(arguments); carList.add(c);} [XXX]I don't understand what the question is? Can you be a little more specific? Are you saying you want all your objects into a list? If so, you'd either add each one individually or you coul...
 java                     3 answers                     74 view
 2018-10-22         Kelly

How to protect my code from "Index out of range" errors

I've been trying to build a simple calendar as coding exercise in my free time. However, I can't seem to be able to sort out this problem:How do I return to item 0 in a list? My idea was to, whenever dayoftheweek is longer than the length of the list, it returns to days[0], but I can't seem to be able to get it to work. days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]dayoftheweek = days[0]userchoice = int(input("Please add a number to days: "))dayoftheweek = days[userchoice]If the user input 8, I got a Index out of range error.How can I catc...
 python                     1 answers                     76 view
 2018-10-22         Dylan

How to get last item view from RecyclerView after adding new item and notifyDataSetChanged?

Not able to get last item view after adding new item into adapter and notifyDataSetChanged.Getting null item view when I am going to get last item view from RecyclerView after calling notifyDataSetChanged().Following some scenario for getting item view object but not able to get exact view object but size and item count is correct.Scenario 1:mListItem.add("Hello Data");mAdapter.notifyDataSetChanged();mRecyclerView.scrollToPosition(mAdapter.getItemCount() - 1);View itemView= mRecyclerView.getChildAt(mAdapter.getItemCount()-1);above itemView is always getting null value.Scena...
 android                     1 answers                     76 view