I recently added multilanguage support to my blog using the RTL attribute. However, I noticed that when users switch to another language, the page content shifts from LTR to RTL.
Everything was working fine until I encountered an issue with a toggle tab on one of the pages in mobile view. The toggle tab and its content do not display in full width, resulting in a poor layout as illustrated below:
Here is how it should look like:
Below is the HTML code for reference:
<div class="&row d-flex">
<div class='col pl-md-5 py-md-5 '>
<div class='row justify-content-start pt-3 pb-3 '>
<div class='col heading-section ftco-animate '>
<h2><?php echo $lang['get-in-touch']; ?></h2>
<h2 class='mb-4'></h2>
<div class='tabulation-2 mt-4 '>
<ul class='nav nav-pills nav-fill d-md-flex d-block'>
<li class='nav-item'>
<a class='nav-link active py-2' data-toggle='tab'
href='#home4'><?php echo $lang['contact us']; ?></a>
</li>
<li class='nav-item'>
<a class='nav-link py-2 mb-md-0 mb-2' data-toggle='tab'
href='#home2'><?php echo $lang['register']; ?></a>
</li>
</ul>
<div class='tab-content bg-light rounded mt-2'>
<div class='tab-pane container p-0 fade' id='home4'>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method='POST'>
<h5 class="card-title"><?php echo $lang['contact us desc']; ?></h5>
<div class='form-group'>
<input type='text' name='name' class='form-control'
placeholder='<?php echo $lang['name'];?>'>
</div>
<div class='form-group'>
<input type='text' name='email' class='form-control'
placeholder='<?php echo $lang['email'];?>'>
</div>
<div class='form-group'>
<input type='text' name='phone' class='form-control'
placeholder='<?php echo $lang['phone'];?>'>
</div>
<div class='form-group'>
<input type='text' name='subject' class='form-control'
placeholder='<?php echo $lang['title'];?>'>
</div>
<div class='form-group'>
<textarea name='message' id='' cols='30' rows='7' class='form-control'
placeholder='<?php echo $lang['message'];?>'></textarea>
</div>
<div class="parentElement">
<input type='submit' name='submit-message'
value='<?php echo $lang['send-m'];?>' class='btn btn-primary btns'>
</div>
</div>
</form>
</div>
<div class='tab-pane container p-0 fade' id='home2'>
<p> </p>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method='POST'
class='bg-light p-4 p-md-5 contact-form'>
<h5 class="card-title"><?php echo $lang['register desc']; ?></h5>
<br>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
and here is the CSS code snippet:
[lang="ar"], [lang="ar"] * {
direction: rtl;
text-align: right !important;
width: 100%;
font-family: "Changa", sans-serif;
.container {
width: 100%;
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
.d-flex {
display: -webkit-box !important;
display: -ms-flexbox !important;
display: flex !important;
}
.row {
display: flex;
flex-wrap: wrap;
margin-right: -15px;
margin-left: -15px;
}
.col {
flex-basis: 0;
-webkit-box-flex: 1;
flex-grow: 1;
max-width: 100%;
}
.justify-content-start {
-webkit-box-pack: start !important;
-ms-flex-pack: start !important;
justify-content: flex-start !important;
}
.pb-3, .py-3 {
padding-bottom: 1rem !important;
}
.pt-3, .py-3 {
padding-top: 1rem !important;
}
.ftco-animate {
opacity: 1;
visibility: visible;
}
.col {
-ms-flex-preferred-size: 0;
flex-basis: 0;
-webkit-box-flex: 1;
-ms-flex-positive: 1;
flex-grow: 1;
max-width: 100%;
}
If anyone has a solution or advice, please feel free to share. Your help is much appreciated!