簡體   English   中英

使用C#從html文本內容中查找和替換字符串格式的最佳方法

[英]Best way to find and replace a string format from the html text content using c#

我正在創建一個Windows phone應用程序,該應用程序在Web瀏覽器上呈現html內容。
我有一個CSS文件,在這里我需要更改一些特殊格式的值。 以下是我的數據示例,您可以在其中看到多個'.position-page{n}-{n}'樣式標簽,其中每個標簽的margin left ,right & top包含3個屬性。

</style><style type='text/css'>
 .position-page2-1 {
margin-right: 180px;
margin-left: 180px;
margin-top: 280px;
    }
    .position-page2-2 {
margin-right: 350px;
margin-left: 150px;
margin-top: 20px;
    }
    .position-page2-3 {
margin-right: 180px;
margin-left: 220px;
margin-top: 80px;
    }
    .position-page2-4 {
margin-right: 180px;
margin-left: 220px;
margin-top: -20px;
    }
    .position-page2-5 {
margin-right: 350px;
margin-left: 140px;
margin-top: -10px;
color: #5ED6FB;
    }
      .page2-2 {
font-size: 20px;
text-align: justify;
line-height: 25px;
    }
      .page2-3 {
font-size: 15px;
text-align: justify;
line-height: 20px;

     }
     .page2-4 {
font-size: 15px;
text-align: justify;
line-height: 20px;
     }
      .page2-5 {
font-size: 20px;
text-align: justify;
line-height: 25px;
     }
</style>

我們從第三方服務獲得此樣式文本作為響應。

根據我們的要求,我需要將保證金的價值降低至一定百分比。 假設如果150px是我要用30px替換的邊距,則需要將每個邊距值替換為currentmargin / 5 px。

做這個的最好方式是什么?

您可以使用視口比例嗎?

在這種情況下,您根本不應更改CSS中的任何內容。

<meta name="viewport" content="width=320, initial-scale=1">

這是Microsoft提供的有關設計適應性的更多信息:

管理Windows Phone瀏覽器視口

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM