Techzone/CSS - Cascading Style Sheets

CSS - Cascading Style Sheets

2 min readArticle

CSS controls the visual presentation of HTML documents. Knowing CSS is useful if you're building phishing pages, captive portals, evil twin login pages, or just need to clone a website for a social engineering engagement. Also useful for web app pentesting to understand how front-ends are built.

Core Concepts

  • Selectors - target which HTML elements to style
  • Properties - what aspect to change (color, size, position)
  • Values - what to set it to
  • Cascade - rules can conflict; specificity and order determine which wins
  • Box Model - every element is a box: content, padding, border, margin

Basic Syntax

css
/* Select by element type */
h1 {
    color: #333333;
    font-size: 2rem;
    font-family: Arial, sans-serif;
}

/* Select by class */
.login-box {
    width: 400px;
    margin: 0 auto;
    padding: 30px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Select by ID */
#submit-btn {
    background-color: #0078d4;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
}

/* Hover state */
#submit-btn:hover {
    background-color: #005a9e;
}

Flexbox (Most Useful Layout Method)

css
.container {
    display: flex;
    justify-content: center;  /* horizontal alignment */
    align-items: center;      /* vertical alignment */
    min-height: 100vh;        /* full viewport height */
    flex-direction: column;   /* stack vertically */
    gap: 20px;
}

Cloning a Login Page (Phishing Context)

When cloning a site for social engineering demos, use browser DevTools (F12) to copy CSS. Key things to grab:

  • Font families and sizes
  • Color scheme (inspect body, main containers)
  • Button styles
  • Input field styling
  • Logo/image paths
css
/* Make page look like Microsoft login */
body {
    font-family: 'Segoe UI', sans-serif;
    background: #f2f2f2;
    margin: 0;
}

Responsive Design

css
/* Mobile-friendly */
@media (max-width: 768px) {
    .login-box {
        width: 90%;
        padding: 20px;
    }
}

CSS for Captive Portals

Evil twin captive portals need CSS to look convincing. Key patterns:

  • Center a card on screen using flexbox
  • Match the target's brand colors
  • Make input fields look native
  • Match button styling exactly

Common Properties Quick Ref

Property Example
color #ff0000, red, rgb(255,0,0)
background-color #ffffff
font-size 16px, 1.2rem
padding 10px 20px (top/bottom left/right)
margin 0 auto (center horizontally)
display flex, block, none
position fixed, absolute, relative

See Also

  • html-web-development-guide - The structure CSS styles
  • php-programming-guide - Backend for capturing form submissions
techzonesite.comUnlock Your IT Potential