0

私はここで見てみましたコンテンツが広すぎる場合、HTMLタグに省略記号(...)を挿入しますが、クロムで機能することができませんでした。すべてのブラウザで複数行の解決策がありますか??

4

2 に答える 2

0

テーブルでも機能する JavaScript ハックを紹介します。

    <html>
      <table>
    <tr>
    <td>
        <div class="at">
            <p class="multi-lines-style">Hitler was a decorated veteran of World War I. He joined the German Workers' Party (precursor of the NSDAP) in 1919, and became leader of the NSDAP in 1921. In 1923, he attempted a coup in Munich to seize power. The failed coup resulted in Hitler's imprisonment, during which time he wrote his memoir, Mein Kampf (My Struggle). After his release in 1924, Hitler gained popular support by attacking the Treaty of Versailles that had been forced on Germany and promoted nationalism, Pan-Germanism, and antisemitism with charismatic oratory and Nazi propaganda. Hitler frequently denounced international capitalism and communism as being part of a Jewish conspiracy. Hitler's Nazi Party became the largest democratically elected party in the German Reichstag, leading to his appointment as chancellor in 1933. Following fresh elections won by his coalition, the Reichstag passed the Enabling Act, which began the process of transforming the Weimar Republic into the Third Reich, a single-party dictatorship based on the totalitarian and autocratic ideology of National Socialism. Hitler aimed to eliminate Jews from Germany and establish a New Order to counter what he saw as the injustice of the post-World War I international order dominated by Britain and France. His first six years in power resulted in rapid economic recovery from the Great Depression, the denunciation of restrictions imposed on Germany after World War I, and the annexation of territories that were home to millions of ethnic Germans, actions which gave him significant popular support.</p>
        </div>
    </td>
    <td>
        <div class="at">
            <p class="multi-lines-style">For 16 years Putin served as an officer in the KGB, rising to the rank of Lieutenant Colonel before he retired to enter politics in his native Saint Petersburg in 1991. He moved to Moscow in 1996 and joined President Boris Yeltsin's administration where he rose quickly, becoming Acting President on 31 December 1999 when Yeltsin resigned unexpectedly. Putin won the subsequent 2000 presidential election and was re-elected in 2004. Because of constitutionally mandated term limits, Putin was ineligible to run for a third consecutive presidential term in 2008. Dmitry Medvedev won the 2008 presidential election and appointed Putin as Prime Minister, beginning a period of so-called "tandemocracy".[1] In September 2011, following a change in the law extending the presidential term from four years to six,[2] Putin announced that he would seek a third, non-consecutive term as President in the 2012 presidential election, an announcement which led to large-scale protests in many Russian cities. He won the election in March 2012 and is serving a six-year term.[3][4] Many of Putin's actions are regarded by the domestic opposition and foreign observers as undemocratic.[5] The 2011 Democracy Index stated that Russia was in "a long process of regression [that] culminated in a move from a hybrid to an authoritarian regime" in view of Putin's candidacy and flawed parliamentary elections.[6] In 2014 Russia was excluded from the G8 group as a result of what the group called Putin's "illegal" invasion and annexation of Crimea.[7]</p>
        </div>
    </td>
    <td>
        <div class="at">
            <p class="multi-lines-style">Robert Gabriel Mugabe is a Zimbabwean revolutionary and politician who is the President of Zimbabwe. As one of the leaders of the rebel groups against white minority rule, he was elected as Prime Minister, head of government, in 1980, and served in that office until 1987, when he became the country's first executive head of state.[1] Having been repeatedly re-elected, he retains this post to this day. He has led the Zimbabwe African National Union – Patriotic Front (ZANU–PF) since 1975. Robert Mugabe rose to prominence in the 1960s as the Secretary General of ZANU during the conflict against the conservative white minority government of Rhodesia. Mugabe was a political prisoner in Rhodesia for more than 10 years between 1964 and 1974. Upon release Mugabe, along with Edgar Tekere, left Rhodesia in 1975 to re-join the fight during the Rhodesian Bush War from bases in Mozambique. At the end of the war in 1979, Mugabe emerged as a hero in the minds of many Africans.He won the general elections of 1980 after calling for reconciliation between the former belligerents, including white Zimbabweans and rival political parties, and thereby became Prime Minister on Zimbabwe's independence in April 1980. Soon after independence Mugabe set about establishing a one-party state run by his political party, the Zanu-PF, establishing a North Korean trained security force, the Fifth Brigade, in August 1981 designed to deal with internal dissidents. Mugabe attacked former allies ZAPU in which the Fifth Brigade crushed an armed rebellion by fighters loyal to his rival Joshua Nkomo, leader of the minority Ndebele tribe, in the province of Matabeleland. Between 1982 and 1985 at least 20,000 people died in ethnic cleansing and were buried in mass graves. Mugabe consolidated his power in December 1987, when he was declared executive president by parliament, combining the roles of head of state, head of government, and commander-in-chief of the armed forces, with powers to dissolve parliament and declare martial law. In August 2008, Robert Mugabe suffered a narrow defeat in the first round of a presidential election but he subsequently won the run-off elections in a landslide after opposition rival Morgan Tsvangirai withdrew from the race, and extended a hand to the opposition with the signing of a power-sharing deal with opposition leaders Morgan Tsvangirai and Arthur Mutambara of the MDC-T and MDC-M opposition party. On 3 August 2013, the Zimbabwe Election Commission said Mugabe won his seventh term as President, defeating Tsvangirai with 61 percent of the vote in a disputed election in which there were numerous accounts of vote-rigging and fraud.</p></div>
    </td>
</tr>

    <script>
           var ellipsis = document.getElementsByClassName('multi-lines-style');
         for (var i = 0; i < ellipsis.length; ++i)
            {
               var item = ellipsis[i];
               if (item.parentNode.clientHeight > 50) {
               item.innerHTML = item.innerHTML.substr(0, 500) + ' ...';
            }
    </script>

CSS

    .multi-lines-style 
       {
          text-overflow: ellipsis;
          overflow: hidden;
          text-align:justify;
          font-family:"Times New Roman", Georgia, Serif;
       }
    .at {
         width:230px;
         padding:5px;
        }

http://jsfiddle.net/BPRwW/10/

于 2014-04-01T09:44:17.140 に答える