<div class="controls"> 
  <label for="writingmode">writing-mode:</label>
  <select id="writingmode">
    <option value="horizontal-tb">horizontal-tb</option>
    <option value="vertical-lr">vertical-lr</option>
    <option value="vertical-rl">vertical-rl</option>
  </select>
</div>

<div id="wrapper">
  <div class="media" dir="ltr">
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/182774/blueberry-cheesecake.jpg" alt="蓝莓芝士蛋糕" class="media__object">
  <div class="media__body">
    <h3 class="media__heading">蓝莓芝士蛋糕</h3>
    <p>食谱描述的地方。</p>
  </div>
</div>

<div class="media" dir="rtl">
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/182774/blueberry-cheesecake.jpg" alt="فطيرة الجبن بالتوت البري" class="media__object">
  <div class="media__body">
    <h3 class="media__heading">فطيرة الجبن بالتوت البري</h3>
          <p>هنا سيكون شرح معين عن هذه الوصفة.</p>
  </div>
</div>
</div>
:root {
  --bgcolor: #fff;
  --color: #333;
}
/* Dark mode */
@media screen and (prefers-color-scheme: dark) {
  :root {
    --color: #fff;
    --bgcolor: #101010;
  }
  a:link, a:visited {
    color: #0ff;
  }
}
body {
   color: #fff;
   background-color: #101010;
   width: 100vw;
   min-height: 100vh;
   display: flex;
   flex-direction: column;
   align-items: center;
   padding: 6vh;
    margin: 0;
    box-sizing: border-box;
 }

.controls {
  margin: 0;
  padding: .5em 2em 1em 2em;
  border-bottom: 1px solid #666;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bgcolor);
  color: var(--color)
}
.controls select {
  margin-right: 1.25rem;
  color: #2f4f4f;
  font-size: 1.2rem;
}

#wrapper {
  padding-top: 40px;
}

.media {
  background: #2196F3;
  box-shadow: 0 3px 10px 0 rgba(33, 149, 243, 0.64);
  padding: 2vh;
  margin-bottom: 2.5rem;
  border-radius: 10px;
  min-width: 50vw;
  display: grid;
  grid-template-columns: 10vw 1fr;
  gap: 2vw;
  position: relative;
  
  h3 {
    font-size: 24px;
    font-weight: bold;
    margin-top: 0;
    margin-bottom: 0.5rem;
  }
  
  img {
    width: 10vw;
    height: 10vw;
    border-radius: 50%;
    border: 1px solid #a0161694;
    box-shadow: inset 2vh 2vh 2vh rgba(203, 32, 32, 0.75);
  }
  
  &::before {
    content: attr(dir);
    font-size: 2vw;
    padding: 2vh 4vh;
    background: rgba(201, 236, 24, 0.5);
    border-radius: 8px 0 0 8px;
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translate(0, -50%);
  }
}
View Compiled
const writingModeSelector = document.getElementById('writingmode');
const wrapper = document.getElementById('wrapper')

writingModeSelector.addEventListener('change', (e) => {
  console.log('====> writing-mode:', e.target.value)
  wrapper.style.writingMode=e.target.value
})

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.