How can I make text that is wider than its container's width move left instead of right in IE 11?


Dmitryosipow

I have text in a div with a 5px right margin. If the container div gets narrower, the text will move out of the container and there will no longer be 5px of white space. Is it possible to keep this margin from the right and have the text output from the left of the container instead of the right? Add display: flex;justify-content: flex-end;to box element works in Chrome but not IE 11

Here is the sample

.box {
  margin-bottom: 15px;
  margin-left: 30px;
  background-color: red;
  width: 170px;
  white-space: nowrap;
  text-align: right;
}

.text {
  margin-right: 5px;
}

.box2 {
  width: 50px;
}
<div class="box box1">
  <div class="text">Sample text</div>
</div>
<div class="box box2">
  <div class="text">Sample text2</div>
</div>

Alex

IE 11 doesn't support flexbox , so it's no surprise that it doesn't work. You can float your .textpermissions inside yourself .boxand then apply a clearfix on that box .

IE has poor support in general because if I remember correctly it's no longer maintained and doesn't need any support unless your project requires it.

See example:

.box {
  margin-bottom: 15px;
  margin-left: 30px;
  background-color: red;
  width: 170px;
  white-space: nowrap;
  text-align: right;
}

/* clearfix */
.box::after {
  content: "";
  clear: both;
  display: table;
}

.text {
  margin-right: 5px;
  float: right;
}

.box2 {
  width: 50px;
}
<div class="box box1">
  <div class="text">Sample text</div>
</div>
<div class="box box2">
  <div class="text">Sample text2</div>
</div>

Related


How can I expand the text to the width of its container?

Joe Morano I have a div that contains some text that I want to expand into the div itself. In other words, the word spacing should automatically stretch until the last word reaches the edge of the div. From reading about text-align: justify, I think this is ex

How can I expand the text to the width of its container?

Joe Morano I have a div that contains some text that I want to expand into the div itself. In other words, the word spacing should automatically stretch until the last word reaches the edge of the div. From reading about text-align: justify, I think this is ex

How can I expand the text to the width of its container?

Joe Morano I have a div that contains some text that I want to expand into the div itself. In other words, the word spacing should automatically stretch until the last word reaches the edge of the div. From reading about text-align: justify, I think this is ex

flutter. How can I make the container wider than the screen?

Constantine I am trying to create a parallax background for a page controller. For this, I need to create a background image that is wider than the screen. I put it in a container like this: @override Widget build(BuildContext context) { return Material

How can I make the image bigger than its container?

tsunami I have an image grid like this: However, the png has a lot of white space around it, so I want to enlarge the image so that the white space is cut out of the container. How can I do this? What I currently have: body: new Container( child: Gri

How can I expand the text to the width of its container?

Joe Morano I have a div that contains some text that I want to expand into the div itself. In other words, the word spacing should automatically stretch until the last word reaches the edge of the div. From reading about text-align: justify, I think this is ex

How can I make my edit text type right to left?

Abbie I actually want to type in Arabic, is that ok? I am creating an android application. I am a novice. Please help. I tried these codes but it didn't work. if(UTILSSessionVariables.LCID==2057) { setContentView(R.layout.passportdocumentfields

How can I expand the text to the width of its container?

Joe Morano I have a div that contains some text that I want to expand into the div itself. In other words, the word spacing should automatically stretch until the last word reaches the edge of the div. From reading about text-align: justify, I think this is ex

flutter. How can I make the container wider than the screen?

Constantine I am trying to create a parallax background for a page controller. For this, I need to create a background image that is wider than the screen. I put it in a container like this: @override Widget build(BuildContext context) { return Material