Showing posts with label CSS. Show all posts
Showing posts with label CSS. Show all posts

26 February 2026

How can i use a special character as the HTML list item marker?

HTML 

<ul class="special-bullets">
  <li>Item one</li>
  <li>Item two</li>
  <li>Item three</li>
</ul>


CSS

.special-bullets {
  list-style-type: none;      /* remove default bullet */
  padding-left: 1.4em;        /* adjust indent as needed */
}

.special-bullets li::marker {
  content: "★ ";              /* ← your special character + space */
  /* content: "✔ "; */
  /* content: "➜ "; */
  /* content: "🚀 "; */        /* emoji also works */
  color: #e91e63;             /* optional: color the marker */
  font-size: 1.1em;           /* optional: size */

 

You can also style the number in the same way:

ol.fancy-numbers li::marker {
  content: counter(list-item) ". ";   /* default is "1. " */
  color: navy;
  font-weight: bold;

 

01 November 2025

cssUniversal.html

<style>
    body {
        margin: 0;
        background-color: rgba(0, 0, 0, 0.09);
        color: rgba(0, 0, 0, 0.6);
        font-family: sans-serif;
    }

    div.container {
        display: flex;
        justify-content: center;
        min-height: 100vh;
        padding: 1rem;
    }

    div.card {
        background-color: rgba(255, 255, 255, 1);
        max-width: 585px;
        width: 100%;
        box-shadow:
            0 4px 8px 0 rgba(0, 0, 0, 0.2),
            0 6px 20px 0 rgba(0, 0, 0, 0.19);
        padding: 1rem;
        border-radius: 4px;
    }

    h1,
    h2,
    h3 {
        margin: 1.5rem 0 0.75rem 0;
    }

    div.card {
        padding-bottom: 3rem;
    }

    .contact {
        text-align: center;
    }

    table {
        font-family: Arial, Helvetica, sans-serif;
        border-collapse: collapse;
        width: 100%;
    }
    
    td, th {
        border: 1px solid #ddd;
        padding: 8px;
    }
    
    tr:nth-child(even){background-color: #f2f2f2;}
    
    tr:hover {background-color: #ddd;}
    
    th {
        padding-top: 12px;
        padding-bottom: 12px;
        text-align: left;
        background-color: #04AA6D;
        color: white;
    }

    @media print {
        body {
            background: white !important;
        }

        .container {
            display: block;
            min-height: auto;
            padding: 0;
            margin: 0;
        }

        .card {
            box-shadow: none !important;
            border: none;
            background: white !important;
            max-width: 100%;
            padding: 1in;
        }

        body, p, li, h1, h2, h3 {
            color: black; !important;
            font-family: "Arial", sans-serif;
        }

        nav, footer, .no-print {
            display: none !important;
        }

        a {
            color: black;
            text-decoration: none;
        }
    }
</style>

<body>
    <div class="container">
        <div class="card">
            <div class="contact">...</div>
            ...
        </div>
    </div>
</body>

28 October 2025

Beautiful Letter with Shadow

<style>
    body {
        margin: 0;
        background-color: rgba(0, 0, 0, 0.09);
        color: rgba(0, 0, 0, 0.6);
        font-family: sans-serif;
    }

    div.container {
        display: flex;
        justify-content: center;
        min-height: 100vh;
        padding: 1rem;
    }

    div.card {
        background-color: rgba(255, 255, 255, 1);
        max-width: 585px;
        width: 100%;
        box-shadow:
            0 4px 8px 0 rgba(0, 0, 0, 0.2),
            0 6px 20px 0 rgba(0, 0, 0, 0.19);
        padding: 1rem;
        border-radius: 4px;
    }

    h1,
    h2,
    h3 {
        margin: 1.5rem 0 0 0;
    }

    div.card {
        padding-bottom: 3rem;
    }

    .contact {
        text-align: center;
    }

    @media print {
        body {
            background: white !important;
        }

        .container {
            display: block;
            min-height: auto;
            padding: 0;
            margin: 0;
        }

        .card {
            box-shadow: none !important;
            border: none;
            background: white !important;
            max-width: 100%;
            padding: 1in;
        }

        body, p, li, h1, h2, h3 {
            color: black; !important;
            font-family: "Arial", sans-serif;
        }

        nav, footer, .no-print {
            display: none !important;
        }

        a {
            color: black;
            text-decoration: none;
        }
    }
</style>

<body>
    <div class="container">
        <div class="card">
            <div class="contact">...</div>
            ...
        </div>
    </div>
</body>

08 September 2025

How to Install and Use Prettier on Ubuntu?

# npm install -g prettier
 
How to make html and css and javaScript files
prettier?
 
$ prettier --tab-width 4 --write test.html 

How to update prettier

# npm update -g prettier

Note: -g means global

11 January 2023

vertical-align middle not working

 https://christopheraue.net/design/why-vertical-align-is-not-working

 

  1 <style>
  2 .container {
  3     width: 100%;
  4     text-align: center;
  5     border: 1px solid rgba(0,0,0,1);
  6     color: #666666;
  7     background-color: rgba(255,255,0,1);
  8     font-weight: bold;
  9 }
 10     .middle {vertical-align: middle; }
 11 </style>
 12
 13 <div class="container">
 14     <br>
 15     <span class="tall-bar middle"></span>
 16     <span class="top"></span>
 17     <span class="middle">Year2021/2022 Volunteer Recognition Event</span>
 18     <span class="bottom"></span>
 19     <br>
 20     <br>
 21 </div>

10 July 2022

How to limit width of table to within screen width with html and css?

How to limit width of a wide table to within screen width with html and css?

Solution: Do the following 2 things

1. <table style='table-layout: fixed'>

2. Set width for every columns in the first row (you can leave the last column, or any one column of all)

<thead>
  <tr>
    <th style='width: 5%; >blah...</th>
    <th style='width: 10%; >blah...</th>
    <th style='width: 25%; >blah...</th>
    <th style='width: 25%; >blah...</th>
    <th>blah...</th>
  </tr>
</thead>

That is all.

16 August 2021

export pandas dataframe to html and appy css styles

 export pandas dataframe to html and appy css styles

 

 Ku Tang Pan

I found the most precise, and frankly the easiest way of doing it is skipping the styling, to_html() etc. and converting the DF to a dictionary using the df.to_dict() method.

Specifically what gave me trouble, was displaying the styled pandas html in an outlook email, as it just wouldn't render properly with the css mess that pandas was producing.

iterate over the dict and generate the html there by simply wrapping keys/values in the tags that you need, adding classes etc. and concatenate this all into one string. Then paste this str into a prepared template with a predefined css.

For convenience I found it's useful to export the same df twice, using .to_dict() and to_dict('index') to first fill in the columns and then work your way down row by row. Alternatively just have a list of relevant column names.

dict_data = [df.to_dict(), df.to_dict('index')]

return_str = '<table><tr>'

for key in dict_data[0].keys():
    return_str = return_str + '<th class="header">' + key + '</th>'

return_str = return_str + '</tr>'

for key in dict_data[1].keys():
    return_str = return_str + '<tr><th class="index">' + key + '</th>'
    for subkey in dict_data[1][key]:
        return_str = return_str + '<td>' + dict_data[1][key][subkey] + '</td>'

return_str = return_str + '</tr></table>'

and then return_str goes into the template.

 

27 July 2021

How to set pseudo class attributes within the body part of a web page?

 How to set pseudo class attributes within the body part of a web page?

https://stackoverflow.com/questions/1033156/how-to-write-ahover-in-inline-css


html


<a href="https://www.google.com/" class="one">Hello World</a>


css


.one {

text-decoration: none;
}

.one:link {
text-decoration: none;
}

.one.visited {
text-decoration: none;

.one:hover{
text-decoration: none;
}

.one:active{
text-decoration: none;
}

29 June 2021

CSS for 5 Typical Media Query Break Points (Device Screen Sizes)

CSS for 5 Typical Media Query Break Points (Device Screen Sizes)


<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>

/* Typical device breakpoints - 5 groups */

/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {
  [class*="col-"] {width: 100%; }
}

/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {
  .col-min600-1 {width: 8.33%;}
  .col-min600-2 {width: 16.66%;}
  .col-min600-3 {width: 25%;}
  .col-min600-4 {width: 33.33%;}
  .col-min600-5 {width: 41.66%;}
  .col-min600-6 {width: 50%;}
  .col-min600-7 {width: 58.33%;}
  .col-min600-8 {width: 66.66%;}
  .col-min600-9 {width: 75%;}
  .col-min600-10 {width: 83.33%;}
  .col-min600-11 {width: 91.66%;}
  .col-min600-12 {width: 100%;}
}

/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {
  .col-min768-1 {width: 8.33%;}
  .col-min768-2 {width: 16.66%;}
  .col-min768-3 {width: 25%;}
  .col-min768-4 {width: 33.33%;}
  .col-min768-5 {width: 41.66%;}
  .col-min768-6 {width: 50%;}
  .col-min768-7 {width: 58.33%;}
  .col-min768-8 {width: 66.66%;}
  .col-min768-9 {width: 75%;}
  .col-min768-10 {width: 83.33%;}
  .col-min768-11 {width: 91.66%;}
  .col-min768-12 {width: 100%;}
}

/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {
  .col-min992-1 {width: 8.33%;}
  .col-min992-2 {width: 16.66%;}
  .col-min992-3 {width: 25%;}
  .col-min992-4 {width: 33.33%;}
  .col-min992-5 {width: 41.66%;}
  .col-min992-6 {width: 50%;}
  .col-min992-7 {width: 58.33%;}
  .col-min992-8 {width: 66.66%;}
  .col-min992-9 {width: 75%;}
  .col-min992-10 {width: 83.33%;}
  .col-min992-11 {width: 91.66%;}
  .col-min992-12 {width: 100%;}
}

/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {
  .col-min1200-1 {width: 8.33%;}
  .col-min1200-2 {width: 16.66%;}
  .col-min1200-3 {width: 25%;}
  .col-min1200-4 {width: 33.33%;}
  .col-min1200-5 {width: 41.66%;}
  .col-min1200-6 {width: 50%;}
  .col-min1200-7 {width: 58.33%;}
  .col-min1200-8 {width: 66.66%;}
  .col-min1200-9 {width: 75%;}
  .col-min1200-10 {width: 83.33%;}
  .col-min1200-11 {width: 91.66%;}
  .col-min1200-12 {width: 100%;}
}

</style>
</head>

<body>

</body>

</html>

12 May 2021

Several Issues about Responsive Web Pages and HTTPS

Several Issues about Responsive Web Pages and HTTPS


1. Texts and images are not aligned to HTML5 animations viewed on phones

They are aligned on computer monitors.

Cause: width of text and images are '100%', but that of the animation is '1140px'.

Solution: After I changed width into '100%' and height into 'auto' in -

(1) 'animation_container' div;

(2) canvas;

(3) 'dom_overlay_container' div,

the text and images have become aligned to the html5 animation now.

(Got help from 'Cypher- Entrepreneur')


2. There is a link on the image banner, but when viewed in browser, there is no link.

Cause: '>' is missing in <div> of <div><a href=""><img ...></a></div>

Solution: Inserted the missing '>', then the link on the image banner works now.

Note: (1) Better use 'Sublime Text' software to edit code files.

        (2) Better use https://www.aliciaramirez.com/closing-tags-checker/ to check if any closed tag is missing. 

(Got help from 'Cypher- Entrepreneur')


3. Website completely normal visited outside of our company LAN network, but can not open at all in LAN

Cause: IP of CloudFlare has changed.

Handling: The IP on our LAN DNS server which is mapped to our website domain was 104.28.30.95, which is an IP of CloudFlare.

Since we can not open our website at all, I changed IP on our LAN DNS into 64.91.250.231, which is the IP when we ftp and upload our website files. After the change, we can open our website, but (1) it is http, not https, 'not secure' shows. (2) none of our html5 animations show up, and some of the images do not show.

Pinging website domain name from out of LAN, IP addresses are (1) 172.67.133.250 (2) 104.21.25.97. Pinging website domain name from within LAN, IP is 64.91.250.231, of course.

Solution: changed the IP on LAN DSN from 64.91.250.231. The problem is gone. Website becomes normal viewed whether from out of LAN, or in LAN.

(Got help from 'Benjamin Gao)


4. On home page of website, there are two html5 animations. The first animation shows up fine, but the second one does not show.

If I remove the first animation, then the second animation shows.

Cause: </iframe> for the second animation is missing.

Solution: Added </iframe>. The second animation shows.


5. The distance between the two animations is too far away.

Cause: 'vh' in 'min-height:98vh' cause the distance.

Solution: Removed 'min-height:98vh'. The space in vertical direction disappeared. But there is a big blank space horizontally.

Using responsive iframe solved the problem of the problem of big blank space horizontally.

(Got help from 'Cypher Entrepreneur') 

13 September 2017

How to convert css in head to inline css?

How to convert css in head to inline css?

Solution:

Paste the whole html/css code into -

http://premailer.dialect.ca/


30 June 2014

Wrap text around an image with CSS

http://www.homeandlearn.co.uk/WD/wds4p6.html

Let's see how to get the following style:
Browser showing text wrapped around an image
As you can see, the image is on the right and the text flows around it. There is also space between the image and the text.
The first thing to do is to set up a STYLE in the HEAD section of the HTML. Add the highlighted code to your own HTML:
CSS style for text wrapping
The style we've set up is called TextWrap. In between the two curly brackets we have this:
float: right;
margin: 10px;
The CSS property we need in order to move the image is called float. The float property can take three values: left, right and none. To get some space between the image and the text we can use the margin property. We've set it to 10 pixels. This will give you space around the entire image. If you only want space on specific sides of the image you can use these:
margin-left
margin-right
margin-top
margin-bottom
So we could have done this:
margin-left: 10px;
margin-bottom: 10px;
That would get us a 10 pixels margin on the left of the image and 10 pixels at the bottom.
To apply the style to the image, you need to add the CLASS attribute to the IMG tag:
<IMG SRC="york_images/york_minster_2.gif" CLASS="TextWrap">
The CLASS attribute doesn't have to go at the end. If you prefer, you can put it after the IMG tag:
<IMG CLASS="TextWrap" SRC="york_images/york_minster_2.gif" >
Just take note of where all the spaces are in the code above.
Amend your own IMG tag and add CLASS="TextWrap" to your own IMG code. Before you try it out, add a paragraph of text below the image:
<IMG class="TextWrap" SRC="york_images/york_minster_2.gif">
<P>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed at ante. Mauris eleifend, quam a vulputate dictum, massa quam dapibus leo, eget vulputate orci purus ut lorem. In fringilla mi in ligula. Pellentesque aliquam quam vel dolor. Nunc adipiscing. Sed quam odio, tempus ac, aliquam molestie, varius ac, tellus. Vestibulum ut nulla aliquam risus rutrum interdum. Pellentesque lorem. Curabitur sit amet erat quis risus feugiat viverra.
</P>
You can, of course, use your own text, and not just the Lorem ipsum text. Make sure your IMG code is above the first P tag, however.
Save your work and view the results in your browser.
There is, however, a problem with the above code. Suppose we want a second paragraph of text with another image floated on the left. We want to do this:
Browser showing text wrapped around two images
Here, the second image is nicely aligned below and to the left of the first image. The text is in the right place, too.
To achieve this, you might think of adding a second style and then applying it to the second image. Like this:
CSS code that wraps text to the left and right of two images
In the second style, we've used float: left and added a 10 pixel margin as before. In the second IMG tag, we've used the new TextWrapLeft class.
However, saving the work and refreshing gives you this in the browser:
Browser showing badly aligned text wrapping
In this version, the second image starts two thirds of the way down the first image. The text doesn't flow as we want it, as well.
The way to correct this is to use a CSS property called clear. This clears any floating elements and gets you back to the normal, default flow for browsers. The clear property can take four values: left, right, both, none. Because our first image was floated to the right, we want to clear to the right. We can add this to the second style:
CSS code that clears text wrapping
If our first image had been on the left, we would have used clear: left.

23 January 2012

Web front-end technology

http://forum.canadameet.me/showthread.php?t=247068


现在的应用开发,基本上已经完全被web统治了,也就是客户端完全browser based.

技术上, Web开发的前端Javascript , CSS越来越重要。 Javascript 远远超出了任何人对它的期许,而且势不可当, 开源Javascript framework ( Prototype, JQuery, YUI,Extjs 等),取得了无比辉煌和耀眼的成功。 而CSS在网页风格设计和布局开发里成为王者,任何serious的web开发都会使用CSS stylesheet.

与此同时,客户服务端混合编程模型一直是主流的开发平台。Java 和PHP, Ruby等程序语言世界 , MVC frameworks(Model-view-controller frameworks) 盛行,Struts / JFaces , Sprint MVC , Ruby on Rails , Django, Symfony 等等。

.NET方面, 一直以来,以Web form模型为主,占据企业级市场不少份额。 最近也发布了ASP.NET MVC Framework 加入MVC frameworks潮流。

另外,实践中,基于大型服务软件平台进行定制开发,一直是企业级应用的主要选择之一。 整体上说, IBM的Lotus notes 和 Microsoft 的SharePoint正在拉锯这个市场。

在Java 服务端世界,IBM Websphere占据了主要份额 开源的Tomcat, JBOSS等也非常流行

04 November 2010

How to set table borders as thin lines on a web page?

<table width="64%" cellpadding="5" style="border-collapse: collapse">
              <tr>
                <th width="46%" style="border-width: 1px; border-color: #000000; border-style: solid">Household Size</th>
                <th width="54%" style="border-width: 1px; border-color: #000000; border-style: solid">Household Income</th>
              </tr>
              <tr>
                <td style="border-width: 1px; border-color: #000000; border-style: solid">1 Person</td>
                <td style="border-width: 1px; border-color: #000000; border-style: solid">$22,229 </td>
              </tr>
</table>