html - 需要帮助找到哪个 div element.style 归因于

标签 html css

我在 SaaS 程序中工作,该程序允许您输入带有一些 html 的自定义 CSS 文件。这意味着我无法从他们的代码中删除任何内容,只能覆盖它。我在他们的代码中找到了一个 element.style 但我不知道如何覆盖它,因为我找不到它附带的 div 或类。有问题的行是 <div style="margin:5px; width:140px; height:20px; float:right;" align="right"> .我要换width: 140px200px

  <div class="boxcontent">
    <div style="width:100%; height:42px;">
      <div style="margin:5px; width:400px; height:30px; float:left;">
        <div class="dashboard_dropdown_btn" id="metric_drop_0">
          <div class="color_image">
            &nbsp;
          </div>

          <div class="text">
            <span id="metric_type_0">Ideas</span>
          </div>
        </div>

        <div class="dashboard_dropdown_btn" id="metric_drop_1" style=
        "display:none; margin-left:5px;">
          <div class="color_image">
            &nbsp;
          </div>

          <div class="text">
            <span id="metric_type_1">Ideas</span>
          </div>
        </div>

        <div class="dashboard_dropdown_btn" id="metric_drop_2" style=
        "display:none; margin-left:5px;">
          <div class="color_image">
            &nbsp;
          </div>

          <div class="text">
            <span id="metric_type_2">Ideas</span>
          </div>
        </div>

        <div class="dashboard_edit_div">
          <a href="javascript:void(0);" id="dashboard_edit_btn">Edit</a>
        </div>
      </div>

      <div style="margin:5px; width:140px; height:20px; float:right;" align="right">
        <div style="float:left; margin-right:5px; line-height:20px;">
          View by:
        </div>

        <div onclick="selectView('d');" class="select_icon" id="select_day" style=
        "float:left;" rel="on" title="Day"></div>

        <div onclick="selectView('w');" class="select_icon" id="select_week" style=
        "float:left;" title="Week"></div>

        <div onclick="selectView('m');" class="select_icon" id="select_month" style=
        "float:left;" title="Month"></div>
      </div>

最佳答案

.boxcontent>div>div:nth-child(2) {
  background-color: red;
  width: 200px !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="boxcontent">
  <div style="width:100%; height:42px;">
    <div style="margin:5px; width:400px; height:30px; float:left;">
      <div class="dashboard_dropdown_btn" id="metric_drop_0">
        <div class="color_image">
          &nbsp;
        </div>

        <div class="text">
          <span id="metric_type_0">Ideas</span>
        </div>
      </div>

      <div class="dashboard_dropdown_btn" id="metric_drop_1" style="display:none; margin-left:5px;">
        <div class="color_image">
          &nbsp;
        </div>

        <div class="text">
          <span id="metric_type_1">Ideas</span>
        </div>
      </div>

      <div class="dashboard_dropdown_btn" id="metric_drop_2" style="display:none; margin-left:5px;">
        <div class="color_image">
          &nbsp;
        </div>

        <div class="text">
          <span id="metric_type_2">Ideas</span>
        </div>
      </div>

      <div class="dashboard_edit_div">
        <a href="javascript:void(0);" id="dashboard_edit_btn">Edit</a>
      </div>
    </div>

    <div style="margin:5px; width:140px; height:20px; float:right;" align="right">
      <div style="float:left; margin-right:5px; line-height:20px;">
        View by:
      </div>

      <div onclick="selectView('d');" class="select_icon" id="select_day" style="float:left;" rel="on" title="Day"></div>

      <div onclick="selectView('w');" class="select_icon" id="select_week" style="float:left;" title="Week"></div>

      <div onclick="selectView('m');" class="select_icon" id="select_month" style="float:left;" title="Month"></div>
    </div>
  </div>
</div>

关于html - 需要帮助找到哪个 div element.style 归因于,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54148634/

相关文章:

Javascript - 通用函数的多种使用

html - 减少 css 和 html 中的行长度

html - @media screen CSS 规则不适用于智能手机

javascript - 隐藏超过 720px 的内容并在点击时显示隐藏区域?

html - 我应该使用设备工具栏还是增加和减少视口(viewport)宽度?

jquery - 我无法将一个 div 叠加在另一个上

HTML - 在同一行链接文本和图像?

javascript - 在(IE 和 Chrome)中使用双显示器时查找显示器的分辨率

jQuery 将 padding-top 计算为 px 中的整数

javascript - 在 JavaScript 中解码 HTML 实体?