<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sadeepa Herath on Medium]]></title>
        <description><![CDATA[Stories by Sadeepa Herath on Medium]]></description>
        <link>https://medium.com/@sadeepanithushika?source=rss-02ead828554b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lMZGlV258ipqBQ1dbHoJsg.png</url>
            <title>Stories by Sadeepa Herath on Medium</title>
            <link>https://medium.com/@sadeepanithushika?source=rss-02ead828554b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 05:23:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sadeepanithushika/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why Does Microsoft AutoGen Have Three Packages?]]></title>
            <link>https://medium.com/@sadeepanithushika/why-does-microsoft-autogen-have-three-packages-98c93ebe5243?source=rss-02ead828554b------2</link>
            <guid isPermaLink="false">https://medium.com/p/98c93ebe5243</guid>
            <category><![CDATA[autogen]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[agent-systems]]></category>
            <dc:creator><![CDATA[Sadeepa Herath]]></dc:creator>
            <pubDate>Wed, 12 Aug 2026 19:03:45 GMT</pubDate>
            <atom:updated>2026-08-12T19:03:45.352Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xv2f7ijG3Mi1HNs1uMpGEQ.png" /></figure><h3>Understanding AgentChat, Core, and Extensions</h3><p>In this article, we are going to understand one thing that confuses many beginners: why AutoGen has three main packages and what each one does.</p><p>When people first open the AutoGen documentation, they usually see three package names again and again:</p><ul><li>autogen-agentchat</li><li>autogen-core</li><li>autogen-ext</li></ul><p>At first, this can feel confusing. Why are there three packages? Which one should we use? Do we need all of them?</p><p>The short answer is: they all play different roles. AutoGen is designed in layers, so developers can start simple and grow later. That is one of the reasons it is so useful for real projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*unyI5fhRtdBmQXeTZ8EVfA.png" /></figure><h3>The simple idea behind AutoGen</h3><p>A good way to understand AutoGen is to think about building a house.</p><ul><li><strong>AgentChat</strong> is the part that helps us start using the house quickly.</li><li><strong>Core</strong> is the structure underneath.</li><li><strong>Extensions</strong> are the extra things that make the house useful, like electricity, internet, furniture, and tools.</li></ul><p>So AutoGen is not one giant package that does everything. It is split into parts so that beginners can start easily and advanced users can go deeper later.</p><p>This is very useful for us because we are building a multi-agent shopping platform. We do not want to spend too much time on low-level setup before we even have a working prototype.</p><h3>1. What is autogen-agentchat?</h3><p>autogen-agentchat is the easiest place to begin.</p><p>It is the high-level part of AutoGen. It gives us ready-made pieces for creating agents, teams, and conversations.</p><p>If Core is the engine, AgentChat is the dashboard we use to drive the car.</p><p>With AgentChat, we do not need to build everything from scratch. We can use things like:</p><ul><li>AssistantAgent</li><li>team-based chat patterns</li><li>handoffs between agents</li><li>termination rules</li><li>streaming replies</li></ul><p>This is very helpful when we want to build something quickly.</p><p>For example, if we want to create a shopping assistant, AgentChat lets us focus on the conversation itself:</p><ul><li>What should the agent say?</li><li>When should it ask for more details?</li><li>When should it hand the task to another agent?</li><li>When should the workflow stop?</li></ul><p>That is why AgentChat is so beginner friendly.</p><p>For our shopping platform, AgentChat is especially useful because we need a system that can do many things:</p><ul><li>understand the user’s request</li><li>search for products</li><li>check stock</li><li>manage the cart</li><li>place the order</li><li>track the order</li><li>handle support and refunds</li></ul><p>AgentChat helps us organize these tasks into separate agents without making the first version too complicated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2RlcKcsTaA-PHzv9VTMCLg.png" /></figure><h3>2. What is autogen-core?</h3><p>autogen-core is the foundation of AutoGen.</p><p>If AgentChat is the easy-to-use front layer, Core is the deeper layer underneath.</p><p>Core handles the basic building blocks that make agent systems work.</p><p>It deals with things like:</p><ul><li>agent communication</li><li>message passing</li><li>runtime management</li><li>workflows based on events</li><li>custom agent behavior</li><li>lower level control</li></ul><p>This means Core is more flexible, but also more advanced.</p><p>It is useful when we want to design the system ourselves instead of using ready-made chat patterns.</p><p>For example, imagine a company wants agents to run across multiple services or different machines. In that case, we may want deeper control over how messages move, how agents are started, and how tasks are processed.</p><p>That is where Core becomes useful.</p><p>It gives developers more freedom.</p><p>But that freedom also comes with more work.</p><p>So if AgentChat is “easy to start,” Core is “powerful but more advanced.”</p><p>For beginners, it is enough to remember this:</p><ul><li>AgentChat is built on top of Core.</li><li>Core is the base layer.</li><li>Core gives the framework its flexibility and structure.</li></ul><p>We do not need to master every Core detail right away. We can learn those parts later, after we build our first working system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PiWWaeJ6V__15oRQq-7RjQ.png" /></figure><h3>3. What is autogen-ext?</h3><p>autogen-ext is where AutoGen connects to the outside world.</p><p>This package contains extra implementations and integrations that help AutoGen work with real tools and services.</p><p>In simple English, this means AutoGen can talk to things outside itself.</p><p>For example:</p><ul><li>If we want to use a model provider, Extensions can help.</li><li>If we want to connect to a tool, Extensions can help.</li><li>If we want to run code safely, Extensions can help.</li><li>If we want to connect to an MCP server, Extensions can help.</li></ul><p>This matters because a multi-agent platform is not useful unless it can do real work.</p><p>Our shopping system will need to:</p><ul><li>search products</li><li>check inventory</li><li>save data</li><li>access tools</li><li>connect to APIs</li><li>maybe use memory</li><li>maybe interact with external services later</li></ul><p>That is exactly the kind of job autogen-ext is for.</p><p>So while Core gives structure, Extensions gives practical power.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u4XsMSo5vgySJoXHtyLq1Q.png" /></figure><h3>How do these three packages work together?</h3><p>Now let’s connect everything in one simple picture.</p><p>A normal AutoGen project can look like this:</p><pre>                 Your Application<br>                       |<br>                       |<br>                autogen-agentchat<br>                       |<br>                       |<br>                autogen-core<br><br><br>                autogen-ext<br>                    |<br>        ----------------------------<br>        |            |             |<br>     Models       Tools          Services</pre><p>But the best way to understand it is not to think of them as completely separate things.</p><p>They work together.</p><p>Suppose a user says:</p><blockquote><em>“Find me a phone under $500.”</em></blockquote><p>Here is what may happen:</p><ol><li><strong>AgentChat</strong> handles the conversation and the agent setup.</li><li><strong>Core</strong> manages the message flow and agent behavior underneath.</li><li><strong>Extensions</strong> help the agent use a model, search tools, or external services.</li></ol><p>So the user sees one smooth conversation, but behind the scenes, different parts of AutoGen are doing different jobs.</p><p>That is the main reason the framework is split into layers.</p><p>It keeps the system clean.</p><p>It also lets developers choose the right level of complexity for the job.</p><h3>Which package should we use first?</h3><p>For our first version, the answer is simple:</p><p><strong>Start with AgentChat.</strong></p><p>Here is why.</p><h3>AgentChat is easier to learn</h3><p>It gives us useful building blocks without too much low-level code.</p><p>That is very helpful when we are still learning AutoGen.</p><h3>AgentChat is faster for building prototypes</h3><p>We want to build a real working platform as soon as possible.</p><p>AgentChat helps us do that.</p><h3>AgentChat is enough for many early projects</h3><p>For a first version of a multi-agent shopping platform, we do not need to build a full custom runtime from scratch.</p><p>We only need:</p><ul><li>agents</li><li>teams</li><li>handoffs</li><li>tools</li><li>a clear workflow</li></ul><p>AgentChat is good for that.</p><h3>Core can come later if needed</h3><p>If the project grows and we need more control, then we can go deeper into Core.</p><p>So the path is:</p><pre>Start simple with AgentChat<br>        ↓<br>Build the first working product<br>        ↓<br>Use Core later if we need more control</pre><p>That is a practical way to build.</p><h3>A simple comparison</h3><p>Here is an easy way to remember the difference:</p><ul><li><strong>AgentChat</strong> = easy way to build agent conversations</li><li><strong>Core</strong> = the deep foundation and message system</li><li><strong>Extensions</strong> = extra integrations and real-world connections</li></ul><p>Or even shorter:</p><ul><li><strong>AgentChat</strong> helps us build quickly.</li><li><strong>Core</strong> gives us control.</li><li><strong>Extensions</strong> connect us to tools and services.</li></ul><p>That is the main idea.</p><h3>Why this structure is good for our project</h3><p>Our project is a multi-agent shopping platform.</p><p>That means we need a system that can handle different tasks without becoming messy.</p><p>If everything is packed into one giant agent, the code will become hard to manage.</p><p>But if we separate the work into layers and specialized agents, the project becomes easier to understand.</p><p>For example:</p><ul><li>one agent can identify the user’s intent</li><li>one agent can search products</li><li>one agent can check inventory</li><li>one agent can manage the cart</li><li>one agent can handle orders</li><li>one agent can track shipments</li><li>one agent can support returns and refunds</li></ul><p>This kind of structure is exactly why AutoGen is useful.</p><p>And this layered package design helps make that structure easier to build.</p><h3>What we should remember</h3><p>If you only remember three things from this article, remember these:</p><ol><li><strong>autogen-agentchat</strong> is the high-level package for building agents and teams.</li><li><strong>autogen-core</strong> is the foundation that handles the lower-level agent system.</li><li><strong>autogen-ext</strong> adds useful integrations for models, tools, memory, and external systems.</li></ol><p>For beginners and for our first project version, <strong>AgentChat is the best place to start</strong>.</p><p>It is simple, practical, and good for building a first working prototype.</p><p>Core and Extensions are still important, but they fit around AgentChat to make the full system stronger.</p><h3>Final thought</h3><p>AutoGen may look confusing at first because it has multiple packages.</p><p>But once you understand the idea behind the layers, it becomes much easier.</p><ul><li>AgentChat helps us build the application.</li><li>Core supports the system from underneath.</li><li>Extensions connect the system to the real world.</li></ul><p>That is the cleanest way to think about AutoGen.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98c93ebe5243" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Your First REST API with FastAPI: A Complete Beginner’s Guide to CRUD]]></title>
            <link>https://medium.com/@sadeepanithushika/building-your-first-rest-api-with-fastapi-a-complete-beginners-guide-to-crud-7c0d760fd047?source=rss-02ead828554b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c0d760fd047</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[crud]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[fastapi]]></category>
            <dc:creator><![CDATA[Sadeepa Herath]]></dc:creator>
            <pubDate>Wed, 12 Aug 2026 18:00:15 GMT</pubDate>
            <atom:updated>2026-08-12T18:00:15.873Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l0lm0KrybW7azm0jTHguUA.png" /><figcaption>Building Your First REST API with FastAPI</figcaption></figure><p>So you want to learn how to build APIs with Python? You have probably heard people talk about Flask, Django, and FastAPI. Let me tell you something: if you are starting fresh in 2026, <strong>FastAPI is the way to go.</strong> It is fast, modern, and honestly, it just makes sense once you get the hang of it.</p><p>In this article, I am going to walk you through building a fully working Book Management API from scratch. By the end of it, you will have an API that can create books, read them, update them, and delete them. That is what we call <strong>CRUD</strong>, and it is the foundation of almost every backend application you will ever build.</p><p>I actually built the companion GitHub repository for this project a long time ago. Recently, I realized that the code could be a great starting point for beginners, so I decided to dust it off, add heavy comments to explain every single line, and share my learnings with you all today! I will drop the link to the repo at the end.</p><p>Let’s get into it.</p><h3><strong>Before We Start: What Even Is an API?</strong></h3><p>Think of an API like a waiter at a restaurant. You (the client) tell the waiter what you want. The waiter goes to the kitchen (the server/database), gets your food, and brings it back to you. You never have to step into the kitchen yourself.</p><p>In our case, the “client” could be a mobile app, a website, or even another server. The “kitchen” is our database where we store book information. And the API? That is the waiter who handles all the communication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UaQ-cLy6iOMMP_TNt2LihA.png" /><figcaption><em>Client sending a request to an API which , talks to a Database and returns a response</em></figcaption></figure><h3><strong>What is CRUD?</strong></h3><p>CRUD stands for four things:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iIy-YzMzVZv3iQPFQORwUg.png" /><figcaption>CRUD</figcaption></figure><p>Every app you use does CRUD in some form. Instagram? You <strong>create</strong> posts, <strong>read</strong> your feed, <strong>update</strong> your bio, and <strong>delete</strong> photos. Same concept here, just with books instead.</p><h3><strong>What Tools Are We Using?</strong></h3><p>Here is our tech stack for this project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R1cX01NDDXXC8IRVvgK4Iw.png" /><figcaption>tech stack</figcaption></figure><h3><strong>Setting Up the Project</strong></h3><p>First things first. Open your terminal, create a project folder, and set up a virtual environment:</p><pre>mkdir FastAPI-CRUD<br>cd FastAPI-CRUD<br>python3 -m venv .venv<br>source .venv/bin/activatemkdir FastAPI-CRUD</pre><p>If you are on Windows, replace that last line with `.venv\Scripts\activate`.</p><p>Now install the dependencies:</p><pre>pip install fastapi uvicorn[standard] sqlalchemy pydantic</pre><p>Our project will have three Python files. That’s it. Nice and simple:</p><pre>FastAPI-CRUD/<br>├── database.py # Connects to the database<br>├── models.py # Defines our data structure (the Books table)<br>└── books.py # The main app with all our API routes</pre><h4><strong>Step 1: Connecting to the Database (<em>database.py</em>)</strong></h4><p>Before we can store any books, we need to set up our database connection. This is where SQLAlchemy comes in.</p><p>Now, you might be wondering: “Why can’t I just write SQL queries directly?” Well, you can. But using an ORM like SQLAlchemy lets you write Python code instead of SQL. Instead of writing <em>SELECT * FROM books</em>, you write <em>db.query(Books).all()</em>. It feels much more natural when you are already writing Python.</p><p>Here is our <em>database.py</em> file:</p><pre>from sqlalchemy import create_engine<br>from sqlalchemy.orm import sessionmaker<br>from sqlalchemy.ext.declarative import declarative_base<br>SQLALCHEMY_DATABASE_URL = &quot;sqlite:///./books.db&quot;<br>engine = create_engine(<br>  SQLALCHEMY_DATABASE_URL, connect_args={&quot;check_same_thread&quot;: False}<br>)<br>SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)<br>Base = declarative_base()</pre><p>Let me break this down:</p><p><strong>The connection string</strong> (<em>sqlite:///./books.db</em>) tells SQLAlchemy to use SQLite and store the data in a file called `books.db` right in our project folder. You do not need to install anything extra. SQLite comes built into Python.</p><p><strong>The engine</strong> is basically the bridge between your Python code and the actual database. That <em>check_same_thread=False</em> part is important because SQLite normally only allows one thread at a time, but FastAPI handles multiple requests using different threads. Without this setting, you would get errors.</p><p><strong>SessionLocal</strong> is a factory that creates database sessions. Think of a session like a conversation with the database. You open it, do your work (read, write, delete), and then close it. We set `autocommit=False` because we want to decide exactly when to save our changes.</p><p><strong>Base</strong> is the parent class that all our database models will inherit from. It is how SQLAlchemy knows which classes should be treated as database tables.</p><h4><strong>Step 2: Defining the Data Model (models.py)</strong></h4><p>Now we need to tell the database what a “Book” looks like. What columns should the table have? What type of data goes in each column?</p><pre>from sqlalchemy import Column, Integer, String<br>from database import Base<br>class Books(Base):<br>  __tablename__ = &quot;books&quot;<br>  id = Column(Integer, primary_key=True, index=True)<br>  title = Column(String)<br>  author = Column(String)<br>  description = Column(String)<br>  rating = Column(Integer)</pre><p>This is pretty straightforward. We are creating a Python class called <em>Books</em> that inherits from <em>Base</em> (the one we just created in <em>database.py</em>).</p><p><em>__tablename__ = “books”</em> tells SQLAlchemy what to name the actual table in the database.</p><p>Each attribute (<em>id</em>, <em>title</em>, <em>author</em>, etc.) becomes a column in that table. The <em>id</em> column is special: primary_key=True means every row will have a unique ID, and <em>index=True</em> makes searching by ID faster.</p><p>Here is what the resulting table looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*izYBuMv1iGCKEBQpNbaGrw.png" /></figure><h4><strong>Step 3: Building the API (books.py)</strong></h4><p>Alright, this is where everything comes together. Let me walk you through the entire file piece by piece.</p><p><strong>Setting Up the App</strong></p><pre>from fastapi import FastAPI, HTTPException, Depends<br>from pydantic import BaseModel, Field<br>import models<br>from database import engine, SessionLocal<br>from sqlalchemy.orm import Session<br>app = FastAPI()<br>models.Base.metadata.create_all(bind=engine)</pre><p>We import everything we need, create our FastAPI app, and then call <em>create_all()</em>. That last line is really important because it tells SQLAlchemy to actually go and create the <em>books</em> table in the database if it does not exist yet. Without it, you would have a model definition but no actual table.</p><p><strong>Managing Database Sessions</strong></p><pre>def get_db():<br>  try:<br>    db = SessionLocal()<br>    yield db<br>  finally:<br>    db.close()</pre><p>This function might look a bit unusual if you have not seen <em>yield</em> before. Here is what is happening: every time an API request comes in, this function opens a new database session. The <em>yield</em> keyword pauses the function and hands that session over to the route handler. Once the request is done, the <em>finally</em> block runs and closes the session.</p><p>This pattern is called <strong>Dependency Injection</strong> in FastAPI. Instead of manually creating and closing database sessions inside every single route, we let FastAPI handle it for us. It is cleaner and it prevents database connection leaks.</p><p><strong>Validating Data with Pydantic</strong></p><pre>class Book(BaseModel):<br>  title: str = Field(min_length=1)<br>  author: str = Field(min_length=1, max_length=100)<br>  description: str = Field(min_length=1, max_length=100)<br>  rating: int = Field(gt=-1, lt=101)</pre><p>This is one of my favorite things about FastAPI. This `Book` class defines the exact shape of data we expect when someone tries to create or update a book.</p><p>If someone sends a request with an empty title? Rejected. A rating of 150? Rejected. An author name that is 200 characters long? Rejected. FastAPI and Pydantic handle all of this validation automatically and send back a clear error message to the user. You do not have to write a single <em>if</em> statement for it.</p><h3><strong>Now Let’s Build the CRUD Endpoints</strong></h3><p>This is the fun part. Four endpoints, four operations.</p><p><strong>📖 READ: Get All Books</strong></p><pre>@app.get(&quot;/&quot;)<br>async def read_api(db: Session = Depends(get_db)):<br>  return db.query(models.Books).all()</pre><p>This is the simplest one. When someone sends a <em>GET</em> request to <em>/</em>, we query the database for all books and return them. The Depends(get_db) part is our dependency injection at work. It automatically provides a database session to this function.</p><p><strong>➕ CREATE: Add a New Book</strong></p><pre>@app.post(&quot;/&quot;)<br>async def create_book(book: Book, db: Session = Depends(get_db)):<br>  book_model = models.Books()<br>  book_model.title = book.title<br>  book_model.author = book.author<br>  book_model.description = book.description<br>  book_model.rating = book.rating<br>  db.add(book_model)<br>  db.commit()<br>  return book</pre><p>When a user sends a <em>POST</em> request with book data (in JSON format), FastAPI first validates it against our Pydantic <em>Book</em> model. If the data is valid, we create a new <em>Books</em> model instance, copy the data over, add it to the database session, and commit (save) it.</p><p><strong>✏️ UPDATE: Modify an Existing Book</strong></p><pre>@app.put(&quot;/{book_id}&quot;)<br>def update_book(book_id: int, book: Book, db: Session = Depends(get_db)):<br>  book_model = db.query(models.Books).filter(book_id == models.Books.id).first()<br>  if book_model is None:<br>    raise HTTPException(<br>      status_code=404,<br>      detail=f&quot;ID {book_id} :Does not exist&quot;<br>    )<br><br>  book_model.title = book.title<br>  book_model.author = book.author<br>  book_model.description = book.description<br>  book_model.rating = book.rating<br>  db.add(book_model)<br>  db.commit()<br>  return book</pre><p>Notice the <em>{book_id}</em> in the URL path. This is called a <strong>path parameter</strong>. When someone sends a <em>PUT</em> request to <em>/3</em>, FastAPI knows <em>book_id</em> is <em>3</em>.</p><p>We first search the database for that book. If it does not exist, we raise an <em>HTTPException</em> with a <em>404</em> status code (which means “Not Found”). If it does exist, we update its fields and save the changes.</p><p><strong>🗑️ DELETE: Remove a Book</strong></p><pre>@app.delete(&quot;/{book_id}&quot;)<br>def delete_book(book_id: int, db: Session = Depends(get_db)):<br>  book_model = db.query(models.Books).filter(book_id == models.Books.id).first()<br>  <br>  if book_model is None:<br>    raise HTTPException(<br>      status_code=404,<br>      detail=f&quot;ID {book_id} :Does not exist&quot;<br>    )<br><br>  db.query(models.Books).filter(book_id == models.Books.id).delete()<br>  db.commit()</pre><p>Same pattern as update. Check if the book exists, throw an error if it does not, and delete it if it does. Simple.</p><h3><strong>Running the Application</strong></h3><p>Time for the moment of truth. In your terminal, run:</p><pre>uvicorn books:app --reload</pre><p>This tells Uvicorn to look inside <em>books.py</em>, find the <em>app</em> object, and serve it. The <em>— reload</em> flag is super handy during development because the server will automatically restart whenever you save a change to your code.</p><p>You should see something like this:</p><pre>INFO: Uvicorn running on http://127.0.0.1:8000<br>INFO: Started reloader process</pre><p>Your API is now live! 🎉</p><h3><strong>Testing Your API (The Cool Part)</strong></h3><p>Here is something that blew my mind when I first discovered FastAPI: it automatically generates interactive documentation for your API. You do not have to set up Postman or write curl commands.</p><p>Open your browser and go to: <strong>http://127.0.0.1:8000/docs</strong></p><p>You will see a beautiful Swagger UI page that lists all your endpoints. You can test every single one of them right there in the browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1gqUlkyYZriwY_PpDVAP2Q.png" /><figcaption><em>Swagger UI dashboard</em></figcaption></figure><p><strong>Try creating a book:</strong></p><p>1. Click on the green <em>POST /</em> section</p><p>2. Click “Try it out”</p><p>3. Paste this into the request body:</p><pre>{<br>  &quot;title&quot;: &quot;The Great Gatsby&quot;,<br>  &quot;author&quot;: &quot;F. Scott Fitzgerald&quot;,<br>  &quot;description&quot;: &quot;A novel set in the Jazz Age&quot;,<br>  &quot;rating&quot;: 95<br>}</pre><p>4. Click “Execute”</p><p>You should get back a <em>200</em> response with your book data. Now click on the blue <em>GET /</em> section and execute it. You will see your book sitting right there in the database!</p><p>Try updating it, try deleting it, try sending invalid data (like a rating of 500) and see what happens. Play around with it. That is the best way to learn.</p><h3><strong>How Everything Connects</strong></h3><p>Let me give you the big picture of how all these pieces work together:</p><pre>User sends a request (e.g., POST / with book data)<br>          ↓<br>FastAPI receives the request<br>          ↓<br>Pydantic validates the data (rejects bad data automatically)<br>          ↓<br>get_db() provides a database session via Dependency Injection<br>          ↓<br>The route handler runs the business logic (create/read/update/delete)<br>          ↓<br>SQLAlchemy translates Python operations into SQL queries<br>          ↓<br>SQLite stores/retrieves the data from books.db<br>          ↓<br>FastAPI sends the response back to the user as JSON</pre><p>That is the entire flow. Every single request follows this exact path.</p><h3><strong>Quick Recap: What You Learned</strong></h3><p>Let me summarize the key concepts we covered:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PzC-v5s2hXBZ19w6FaKb3w.png" /><figcaption>Summary</figcaption></figure><h3><strong>Where to Go from Here</strong></h3><p>If you made it this far, congratulations! You now understand how a real backend API works. That is not a small thing.</p><p>Here are some ideas if you want to keep building on this:</p><p>1. <strong>Add a “get single book” endpoint</strong> (<em>GET /{book_id}</em>) that returns just one book instead of all of them</p><p>2. <strong>Add a genre field</strong> to the Book model and see how database changes work</p><p>3. <strong>Add search functionality</strong> so users can search books by title</p><p>4. <strong>Add pagination</strong> so the GET endpoint does not return thousands of books at once</p><p>5. <strong>Switch from SQLite to PostgreSQL</strong> when you are ready for something more production grade</p><h3><strong>Get the Full Source Code</strong></h3><p>I have put together the complete project with heavily commented source code so you can read through every line and understand exactly what is going on.</p><p>👉 <strong>GitHub Repository:</strong> <a href="https://github.com/SadeepaNHerath/FastAPI-CRUD">https://github.com/SadeepaNHerath/FastAPI-CRUD</a></p><p>Feel free to clone it, break it, fix it, and make it your own. That is honestly the best way to learn.</p><p>If this article helped you, feel free to share it with someone who is trying to get into backend development. And if you have any questions, reach out to me on LinkedIn. Happy coding! ✌️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c0d760fd047" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When Our Google Form Broke, We Learned the Real Fix Was the Link -Not the Form]]></title>
            <link>https://medium.com/@sadeepanithushika/when-our-google-form-broke-we-learned-the-real-fix-was-the-link-not-the-form-05a93d6f835b?source=rss-02ead828554b------2</link>
            <guid isPermaLink="false">https://medium.com/p/05a93d6f835b</guid>
            <category><![CDATA[google-forms]]></category>
            <category><![CDATA[google-form-flagged]]></category>
            <category><![CDATA[form-broken]]></category>
            <category><![CDATA[redirect-links]]></category>
            <dc:creator><![CDATA[Sadeepa Herath]]></dc:creator>
            <pubDate>Sun, 03 May 2026 17:40:39 GMT</pubDate>
            <atom:updated>2026-05-03T17:45:22.799Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G19Y81jcp6vpDpa3gnP7_w.png" /></figure><p>We were preparing for an event registration and did what most people do: we made a Google Form, put the link on the flyer, and shared it everywhere.</p><p>For about six hours, everything looked fine. Then the form got flagged. Suddenly, people started messaging us saying the link was not working. Since the flyer had already been shared widely, the problem spread fast. We needed a quick fix, not a long recovery process.</p><p>At first, the obvious answer was to remake the form and share a new link. But that did not feel safe enough. What if the new form also got flagged? That would leave us back at the same problem.</p><p>We also looked at other ideas. One suggestion was to add the registration link to the button on an old website we had made last year. That was not useful because the website had not been updated for this year’s event. Another suggestion was to build a custom form, but that also takes time, and we needed something fast.</p><p>So we started looking for a system that would give us control over the link itself.</p><h3>The idea: keep one stable link and change the destination later</h3><p>Instead of sharing the Google Form directly, we wanted one fixed link that we could place on the flyer, in WhatsApp, and in QR codes. That fixed link would send users to the current registration form. If the form changed later, we would only update the destination behind that link.</p><p>That is where using a domain helped. Since we had access to a domain, we used it to create a stable link and redirect users to the form. This kind of redirect setup can be done using different tools or hosting providers. In our case, we used Cloudflare because it was quick and easy. Cloudflare’s redirect system allows sending users from one URL to another using a redirect status code, and it also supports 302 temporary redirects, which are useful when the destination may change later. (<a href="https://developers.cloudflare.com/rules/url-forwarding/">Cloudflare Docs</a>)</p><p>So we created a subdomain such as:</p><p>register.example.com</p><p>Then we set up a redirect rule (using Cloudflare in our case) so that this subdomain points to the Google Form. We used an A record with a placeholder IP and kept the proxy on, then configured a redirect rule to send users to the form. The important part is that the flyer now only contains the subdomain, not the raw Google Form link.</p><p>If the form gets flagged again, we do not need to update the flyer. We only change the redirect target inside Cloudflare.</p><h3>Why this worked better?</h3><p>This gave us a simple but powerful structure:</p><p>Flyer or WhatsApp message → register.example.com → current Google Form</p><p>That means the public link stays the same, even if the form changes behind the scenes.</p><p>For us, that was the main win. We had already shared the flyer, and people kept asking why the registration page was broken. With the redirect setup, we had one stable front door and one replaceable backend.</p><h3>What if you do not have a domain?</h3><p>That is where things get harder.</p><p>Without a domain, you lose the cleanest option. You can still use third party short link tools, and some of them do allow editing the destination later. For example, TLDR Link says it is free, and includes short links, QR codes, UTM tracking, and click analytics. LinkSplit says it is a free URL shortener with editable destinations, and it says you can change the underlying destination at any time without creating a new link. (<a href="https://tldrlink.com/">TLDR</a>)</p><p>That sounds useful, and it is. But there is still a tradeoff: those are third party platforms. If their service changes, goes down, or puts limits on free usage, you do not fully control the link. That is the risk with any free outside tool. The method works, but it is not as solid as owning your own domain and using a redirect layer you control.</p><h3>What we learned</h3><p>The biggest lesson was simple: do not put all your trust in a form link that you cannot control.</p><p>If you have a domain, use it as a stable layer in front of the form. A redirect setup lets you control where users are sent, and a temporary redirect is a practical choice when you may need to swap the destination later. In our case, we used Cloudflare to implement this. (<a href="https://developers.cloudflare.com/rules/url-forwarding/single-redirects/settings/">Cloudflare Docs</a>)</p><p>If you do not have a domain, a free link shortener with editable destinations can still help, but it should be treated as a backup, not a perfect long term system. Tools like TLDR Link and LinkSplit can be useful, but they are still external services. (<a href="https://tldrlink.com/">TLDR</a>)</p><p>In our case, the redirect layer saved time, reduced confusion, and gave us a way to recover fast when the form broke.</p><p>That was the real solution: not just making another form, but building a link we could control.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05a93d6f835b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub’s “Time Travel” Trick: How Developers Can Legally Rewrite Their Coding History ]]></title>
            <link>https://medium.com/@sadeepanithushika/githubs-time-travel-trick-how-developers-can-legally-rewrite-their-coding-history-6450b4475f78?source=rss-02ead828554b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6450b4475f78</guid>
            <category><![CDATA[github-contribution]]></category>
            <category><![CDATA[git-history]]></category>
            <category><![CDATA[lifehacks]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Sadeepa Herath]]></dc:creator>
            <pubDate>Tue, 07 Apr 2026 12:20:46 GMT</pubDate>
            <atom:updated>2026-04-07T12:20:46.726Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G_bGYi1oE1xu654tNtuNlw.png" /></figure><p><em>How Git’s hidden timestamp system lets you commit to any date in history and what that means for your green squares.</em></p><blockquote>You’re staring at your GitHub contribution graph. A sea of green except for that ugly grey gap last month when you were on vacation, sick, or just burned out. What if I told you that gap doesn’t have to exist? And more importantly, what if I told you this isn’t a hack, a vulnerability, or even frowned upon by Git itself?</blockquote><p>Welcome to one of Git’s most overlooked features: <strong>backdating commits</strong>.</p><h3>Wait, Is This Actually Possible?</h3><p>Yes. And the reason goes back to how Git was designed from the very beginning.</p><p>Git stores <strong>two separate timestamps</strong> on every single commit you make:</p><ul><li><strong>Author Date</strong> — when the code change was originally written</li><li><strong>Committer Date</strong> — when the commit was recorded into the repository</li></ul><p>This was an intentional design decision. Git was built to be a <em>distributed</em> version control system, meaning teams could work offline, apply old patches, or migrate entire repositories from other systems — all of which require the freedom to set any date you want.</p><p>GitHub’s contribution graph simply reads whatever date the commit carries. It doesn’t verify whether that date is “real.”</p><h3>Method 1: The Full Control Way (Recommended)</h3><p>This method sets <strong>both</strong> the author date and the committer date — which is important because GitHub’s contribution graph reads the <strong>committer date</strong>, not just the author date.</p><p><strong>Step 1:</strong> Navigate to your repository in the terminal.</p><pre>cd your-repository</pre><p><strong>Step 2:</strong> Make a change to any file (or create one).</p><pre>git add .</pre><p><strong>Step 3:</strong> Commit with a custom date using environment variables.</p><pre>GIT_AUTHOR_DATE=&quot;2025-01-12T10:00:00&quot; \<br>GIT_COMMITTER_DATE=&quot;2025-01-12T10:00:00&quot; \<br>git commit -m &quot;Your commit message&quot;</pre><p><strong>Step 4:</strong> Push to GitHub.</p><pre>git push origin main</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AHVTXiBSH6fcQIe9Jw4GUg.png" /></figure><h3>Method 2: The Quick -date Flag</h3><p>Git’s commit command has a built-in --date flag:</p><pre>git commit --date=&quot;2025-01-13T14:30:00&quot; -m &quot;Your commit message&quot;</pre><p><strong>Important caveat:</strong> This flag only sets the <strong>author date</strong>. The committer date will still be today’s date. This means the commit will show in the log with the old date, but it may <strong>not</strong> affect your GitHub contribution graph the way you expect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vZxydY2Tl5e1OLRisJtU2g.png" /></figure><h3>Method 3: Rewriting an Existing Commit’s Date</h3><p>Already made a commit but want to change its date? Use --amend:</p><pre>git commit --amend --no-edit \<br>  --date=&quot;2025-01-13T19:00:00&quot;</pre><p>Then force-push (only safe on your own branches):</p><pre>git push --force origin main</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Njdy07tMnD_G9LeVElNELQ.png" /></figure><h3>Will It Actually Show on the GitHub Contribution Graph?</h3><p>For the backdated commit to appear on your contribution graph, <strong>all of the following</strong> must be true:</p><ol><li>✅ The commit is on your <strong>default branch</strong> (usually main or master)</li><li>✅ The <strong>committer email</strong> matches a verified email on your GitHub account</li><li>✅ The date falls <strong>within the past year</strong> displayed on the profile graph</li><li>✅ Both GIT_AUTHOR_DATE and GIT_COMMITTER_DATE are set</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LEU_mqXhb_YuBIXDZaHvxA.png" /></figure><h3>Is Anyone Going to Know?</h3><p>Yes, anyone who looks closely enough. Git is transparent by design.</p><p>Running this command on any repository will expose both timestamps for every commit:</p><pre>git log --format=fuller</pre><p>If both dates are suspiciously identical and fall on a weekend you claimed to be offline, an experienced developer will notice. There’s no way to hide this from someone who knows what to look for.</p><h3>Legitimate Uses</h3><p>Before you feel guilty, here’s why Git was designed this way in the first place:</p><ul><li><strong>Migrating old projects</strong> to GitHub while preserving their original history</li><li><strong>Applying patches</strong> that were written at a specific time but committed later</li><li><strong>Offline development</strong> — committing a week’s worth of work when you finally reconnect</li><li><strong>Fixing a missed commit</strong> — you genuinely wrote the code on that day but forgot to commit</li><li><strong>Open source contributions</strong> — receiving a patch via email and applying it with the original author’s date</li></ul><h3>The Ethics Line</h3><p>This is where things get nuanced. Using backdated commits to:</p><ul><li>✅ Preserve genuine history when migrating a project → <strong>Totally fine</strong></li><li>✅ Commit work you actually did on that day → <strong>Totally fine</strong></li><li>⚠️ Fill in a contribution graph to look more active to employers → <strong>Ethically grey</strong></li><li>❌ Fabricate open source contributions for a job application → <strong>Dishonest</strong></li></ul><p>GitHub’s Terms of Service don’t explicitly ban backdated commits, they’re a Git feature after all. But misrepresenting your activity to deceive someone crosses a clear ethical line, and in a job context, it’s the kind of thing that can come back to haunt you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6450b4475f78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS For Beginner]]></title>
            <link>https://medium.com/@sadeepanithushika/css-for-beginner-3ed12d6400ef?source=rss-02ead828554b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ed12d6400ef</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[sinhala]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[css3]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Sadeepa Herath]]></dc:creator>
            <pubDate>Tue, 13 May 2025 05:52:08 GMT</pubDate>
            <atom:updated>2025-05-13T05:52:08.519Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8yd6j7nfH9qpi2tIMGvNFg.jpeg" /><figcaption>CSS for Beginner</figcaption></figure><h3>1. CSS හැඳින්වීම</h3><p>ආයුබෝවන්! අපි බලමු <strong>CSS</strong> ගැන, වෙබ් පිටු හදනකොට ඒවා ලස්සන කරන්න උදව් වෙන තාක්ෂණයක්.</p><p>CSS (Cascading Style Sheets) කියන්නේ HTML එකේ elements (අංග) කොහොමද පෙනෙන්න ඕනේ කියලා අපිට decide කරන්න ඉඩ දෙන එකක්. උදාහරණයක් විදිහට, වර්ණ (colors), ෆොන්ට් (fonts), layouts (පිරිසැලසුම්), සහ animations (සජීවිකරණ) එකතු කරන්න පුළුවන්. HTML එකෙන් වෙබ් පිටුවේ structure එක හදනවා නම්, CSS එකෙන් ඒකට style එකක් දෙනවා. එන්න, මේක ගැන ඉගෙන ගමු!</p><h3>CSS Syntax Structure</h3><p>CSS rule එකක් හදන්න ඕන basic කොටස් තුනක් තියෙනවා:</p><ul><li><strong>Selector :</strong> ස්ටයිල් කරන්න ඕන HTML element එක තෝරනවා.</li></ul><p>උදාහරණයක් විදිහට, h1, .class, #id.</p><ul><li><strong>Property :</strong> Style කරන්න ඕන දේ මොකක්ද කියනවා.</li></ul><p>උදාහරණයක් විදිහට, color, font-size, margin.</p><ul><li><strong>Value (:</strong> ඒ property එකට දෙන specific අගය.</li></ul><p>උදාහරණයක් විදිහට, red, 24px.</p><pre>selector {<br>    property: value;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/0*buoN_lS2TI2l_WPo" /><figcaption>CSS Syntax Structure</figcaption></figure><h3>CSS යොදාගන්න පුළුවන් විදි</h3><p>CSS එක HTML එකට apply කරන්න 3 තියෙනවා</p><ul><li><strong>External CSS</strong></li><li><strong>Internal CSS</strong></li><li><strong>Inline CSS</strong></li></ul><h4>1. External CSS</h4><p><strong>External CSS</strong> කියන්නේ වෙනම .css file එකක් හදලා, ඒක HTML එකට link කරන එක. large scale web site හදනකොට මේක recommend කරනවා, මොකද maintain කරන්න ලේසියි.</p><p>මෙන්න code එක:</p><pre>&lt;!-- In HTML file --&gt;<br>&lt;head&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&gt;<br>&lt;/head&gt;</pre><pre>/* In styles.css file */<br>body {<br>    background-color: #f0f0f0;<br>    font-family: Arial, sans-serif;<br>}</pre><p>මෙතන, &lt;link&gt; tag එකෙන් styles.css file එක HTML එකට connect කරනවා. CSS file එකේ ලියපු styles සියලුම HTML pages වලට යෙදෙනවා.</p><p>උදාහරණයක් විදිහට, body එකට light gray background එකක් එනවා, font එක Arial වෙනවා.</p><h4>2. Internal CSS</h4><p><strong>Internal CSS</strong> කියන්නේ එක HTML page එකකට විතරක් style කරන්න ඕන වුණොත් යොදාගන්න එක. මේක HTML එකේ &lt;head&gt; එක ඇතුළේ &lt;style&gt; tag එකක ලියනවා.</p><pre>&lt;head&gt;<br>    &lt;style&gt;<br>        body {<br>            background-color: #f0f0f0;<br>            font-family: Arial, sans-serif;<br>        }<br>    &lt;/style&gt;<br>&lt;/head&gt;</pre><p>මේකෙන් ඒ page එකේ විතරක් body එකට style එක යෙදෙනවා. Small scale projects වලට මේක OK.</p><h4>3. Inline CSS</h4><p><strong>Inline CSS</strong> කියන්නේ HTML element එකකට direct විදිහට style එක දෙන එක. මෙතනදි style attribute එක යොදාගෙන කරනවා.</p><pre>&lt;p style=&quot;color: blue; font-size: 16px;&quot;&gt;This is a paragraph with inline styling.&lt;/p&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/0*bvb1mlgZq5JYkyTK" /><figcaption>With and without inline CSS</figcaption></figure><p>මෙතන, ඒ &lt;p&gt; tag එකට විතරක් text එක blue වෙලා 16px size එකෙන් පෙනෙනවා. Quick changes වලට මේක හොඳයි, ඒත් large scale project එකකට recommend කරන්නෙ නෑ. මොකද style එක HTML එක ඇතුළේම තියෙන නිසා update කරන්න අමාරුයි.</p><h4>Beginners සඳහා Best Practices</h4><p>CSS එක්ක වැඩ කරනකොට beginners ලාට මේ tips ටික follow කරන්න.</p><ul><li><strong>External CSS තෝරන්න:</strong> Maintenance සහ code organization වලට හොඳයි.</li><li><strong>Meaningful Names දෙන්න:</strong> Class/ID names දානකොට purpose එක තේරෙන විදිහට දෙන්න.</li></ul><p>උදා: header වෙනුවට site-header.</p><ul><li><strong>Comments යොදන්න:</strong> CSS එක තේරෙන්න comments ලියන්න.</li></ul><p>උදාහරණය:</p><pre>/* Style for the header*/<br>.site-header {<br>    background-color: #333;<br>    color: white;<br>}</pre><ul><li><strong>Consistent Naming:</strong> Project එක පුරාම එකම naming style එක යොදන්න.</li><li><strong>Basics එක්ක Start කරන්න:</strong> Complex layouts වලට යන්න කලින් basic properties (color, font-size) practice කරන්න.</li></ul><h3>2. CSS Basic properties</h3><p>දැන් අපි බලමු <strong>CSS හි මූලික ගුණාංග</strong> වන <strong>Text Properties</strong>, <strong>Color Properties</strong>, සහ <strong>Spacing Properties</strong> ගැන. මේවා තේරුම් ගත්තොත්, ඔයාට CSS එක්ක වැඩ කරන්න ලේසි වෙයි.</p><h3>Text Properties</h3><p>Text properties මගින් වෙබ් පිටුවේ text එක කොහොමද පෙනෙන්නේ කියලා control කරනවා. අත්යවශ්ය text properties තුනක් තියෙනවා:</p><h4>1. Font Family</h4><p>Font-family කියන්නේ text එකට යොදන අකුරු වර්ගය තෝරන එක. උදාහරණයක් විදිහට, Arial, Times New Roman, හෝ Courier New වගේ ෆොන්ට් තෝරන්න පුළුවන්. මේක ලියනකොට ඔයා handwriting style එකක් තෝරනවා වගේ.</p><pre>p {<br>    font-family: &quot;Times New Roman&quot;, serif;<br>}</pre><p><strong>Try This:</strong> &lt;p&gt; tag එකකට Arial font එක දාලා browser එකේ බලන්න. Font-family change කරලා වෙනස බලන්න!</p><h4>2. Font Size</h4><p>Font-size මගින් text එකේ size එක decide කරනවා. මේක pixels (px), em, හෝ rem වලින් දෙන්න පුළුවන්.</p><pre>p {<br>    font-size: 16px;    /* pixels භාවිතා කරමින් */<br>    font-size: 1.2em;   /* parent element එකට සාපේක්ෂව */<br>    font-size: 1.2rem;  /* root element එකට සාපේක්ෂව */<br>}</pre><ul><li><strong>px</strong> — fixed size එකක්, screen size එක වෙනස් වුණත් ඒකම තියෙනවා.</li><li><strong>em</strong> — parent element එකේ size එකට සාපේක්ෂව change වෙනවා.</li><li><strong>rem</strong> — root element (සාමාන්යයෙන් &lt;html&gt;) size එකට සාපේක්ෂව, responsive designs වලට හොඳයි.</li></ul><p><strong>Try This:</strong> &lt;p&gt; tag එකක font-size 20px කරලා බලන්න. ඊට පස්සේ 1.5em කරලා වෙනස බලන්න!</p><h4>3. Font Weight</h4><p>Font-weight මගින් text එක bold (බර) හෝ light (සිහින්) කරනවා.</p><pre>p {<br>    font-weight: normal;<br>    font-weight: bold;<br>    font-weight: 600;       /*custom*/<br>}</pre><ul><li><strong>normal</strong> — සාමාන්ය (400).</li><li><strong>bold</strong> — bold text (700).</li><li><strong>100 සිට 900</strong> — විවිධ weight levels තෝරාගන්න පුළුවන්.</li></ul><p><strong>Try This:</strong> &lt;p&gt; tag එකකට bold font-weight දාලා බලන්න. text එක බර වෙනවා!</p><h3>Color Properties</h3><p>Color properties මගින් elements වල visual appearance එක color හරහා control කරනවා.</p><h4>1. Text Color</h4><p>color property එකෙන් text එකේ වර්ණය change කරන්න පුළුවන්.</p><pre>p {<br>    color: red;<br>    color: #FF0000;<br>    color: rgb(255, 0, 0);<br>    color: rgba(255, 0, 0, 0.5);<br>}</pre><ul><li>By name — red, blue වගේ.</li><li>By Hex Code — #FF0000 (රතු).</li><li><strong>RGB</strong> — numbers වලින් (255, 0, 0).</li><li><strong>RGBA</strong> — opacity එක්ක (0–1).</li></ul><p><strong>Try This:</strong> &lt;p&gt; tag එකකට color: blue දාලා බලන්න. RGB වලින් රතු කරලත් බලන්න!</p><h4>2. Background Color</h4><p>background-color එකෙන් element එකක පසුබිමට වර්ණයක් දෙනවා.</p><pre>div {<br>    background-color: lightblue;<br>    background-color: #ADD8E6;<br>    background-color: rgb(173, 216, 230);<br>}</pre><p><strong>Try This:</strong> &lt;div&gt; එකකට background-color: yellow දාලා browser එකේ බලන්න!</p><h3>Spacing Properties</h3><p>Spacing properties මගින් elements අතර ඉඩ සහ layout එක control කරනවා.</p><h4>1. Padding</h4><p>Padding එකෙන් element එකක content එක සහ border එක අතර ඉඩ හදනවා. මේක content එකට breathing space එකක් දෙනවා වගේ.</p><pre>div {<br>    padding: 20px;                /* සියලු පැතිවලට */<br>    padding: 10px 20px;          /* උඩ/පහළ, වම/දකුණ */<br>    padding: 10px 20px 15px 25px; /* උඩ, දකුණ, පහළ, වම */<br>}</pre><ul><li><strong>value එකක්</strong> — සියලු පැතිවලට same padding එක.</li><li><strong>Value දෙකක්</strong> — උඩ/පහළ, වම/දකුණ.</li><li><strong>Value හතරක්</strong> — උඩ, දකුණ, පහළ, වම.</li></ul><h4>2. Margin</h4><p>Margin එකෙන් වෙනත් elements වලින් වෙන් කරන්න element එකේ border එකෙන් පිටත ඉඩ හදනවා,.</p><pre>div {<br>    margin: 20px;                /* සියලු පැතිවලට */<br>    margin: 10px auto;          /* උඩ/පහළ, මැදට */<br>    margin: 10px 20px 15px 25px; /* උඩ, දකුණ, පහළ, වම */<br>}</pre><ul><li>margin: 10px auto; — element එක horizontally center කරනවා.</li></ul><h4>3. Border</h4><p>Border එකෙන් element එක වටේට රේඛාවක් එකතු කරනවා.</p><pre>div {<br>    border: 1px solid black;     /* පළල, ස්ටයිල්, වර්ණය */<br>    border-radius: 5px;<br>    border-style: dashed;        /* වෙනස් බෝඩර් ස්ටයිල් */<br>}</pre><ul><li>border — width, style, color එකතු කරනවා.</li><li>border-radius — corners වටකුරු කරනවා.</li></ul><p><strong>Try This:</strong> &lt;div&gt; එකකට padding: 20px, margin: 20px, border: 2px solid red දාලා browser එකේ open කරලා බලන්න. Values change කරලා වෙනස බලන්න!</p><h3>3. CSS Background Styling</h3><p>Background properties මගින් ඔයාට elements වල background එකට වර්ණ, රූප, සහ වෙනත් effects එකතු කරන්න පුළුවන්. එන්න, අපි මේ properties එකින් එක ගැන ඉගෙන ගමු!</p><h3>1. Background Color</h3><p>background-color property එකෙන් element එකක පසුබිමට වර්ණයක් දෙනවා. මේක තමයි basic සහ ගොඩක් යොදාගන්න property එක.</p><pre>.div1 {<br>    background-color: red;                  /* වර්ණයේ නම භාවිතා කරමින් */<br>}<br>.div2 {<br>    background-color: #00ff00;              /* හෙක්ස් අගය භාවිතා කරමින් */<br>}<br>.div3 {<br>    background-color: rgb(0, 0, 255);       /* RGB අගය භාවිතා කරමින් */<br>}<br>.div4 {<br>    background-color: rgba(255, 0, 0, 0.5); /* Transparency සහිත RGBA */<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/0*An_BGxxllsE1G6v4" /><figcaption>Background Color</figcaption></figure><h3>2. Background Image</h3><p>background-image property එකෙන් element එකක පසුබිමට රූපයක් දාන්න පුළුවන්.</p><pre>.div1 {<br>    background-image: url(https://medium.com/&#39;image.jpg&#39;);<br>}<br>.div2 {<br>    /* Multiple background imagesත් දාන්න පුළුවන් */<br>    background-image: url(https://medium.com/&#39;first.jpg&#39;), url(https://medium.com/&#39;second.jpg&#39;);<br>}</pre><ul><li>url(https://medium.com/%E2%80%98image.jpg%E2%80%99) මගින් රූපයේ path එක දෙනවා.</li><li>Multiple images එකතු කරන්නත් පුළුවන්, comma එකකින් වෙන් කරලා.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/0*0DWWHItGdwd5ELvf" /><figcaption>Multiple Background Images</figcaption></figure><h3>3. Background Repeat</h3><p>background-repeat property එකෙන් background image එක repeat වෙන විදිහ control කරනවා.</p><pre>.div1 {<br>    background-image: url(https://medium.com/&#39;images/sigiriya.JPG&#39;);<br>    background-repeat: repeat; /* Default - repeats both horizontally and vertically */<br>}<br>.div2 {<br>    background-image: url(https://medium.com/&#39;images/sigiriya.JPG&#39;);<br>    background-repeat: no-repeat; /* Image appears only once */<br>}<br>.div3 {<br>    background-image: url(https://medium.com/&#39;images/sigiriya.JPG&#39;); /* Background image */<br>    background-repeat: repeat-x; /* Repeats only horizontally */<br>}<br>.div4 {<br>    background-image: url(https://medium.com/&#39;images/sigiriya.JPG&#39;); /* Background image */<br>    background-repeat: repeat-y; /* Repeats only vertically */<br>}</pre><ul><li><strong>repeat:</strong> රූපය දෙපැත්තටම repeat වෙනවා.</li><li><strong>no-repeat:</strong> රූපය එක පාරයි පෙනෙන්නේ.</li><li><strong>repeat-x:</strong> Horizontally (වම-දකුණ) repeat වෙනවා.</li><li><strong>repeat-y:</strong> Vertically (උඩ-පහළ) repeat වෙනවා.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*Jk-XJUDFrpC5bbXI" /><figcaption>Background Repeat</figcaption></figure><h3>4. Background Position</h3><p>background-position property එකෙන් background image එකේ starting position එක තීරණය කරනවා.</p><pre>.div1 {<br>    background-image: url(https://medium.com/&#39;image.jpg&#39;);<br>    background-position: center;    /* මැදට */<br>}<br>.div2 {<br>    background-image: url(https://medium.com/&#39;image.jpg&#39;);<br>    background-position: top right; /* උඩ-දකුණු කෙළවරට */<br>}<br>.div3 {<br>    background-image: url(https://medium.com/&#39;image.jpg&#39;);<br>    background-position: 50% 50%;   /* Percentage values භාවිතා කරමින් */</pre><pre>}<br>.div4 {<br>    background-image: url(https://medium.com/&#39;image.jpg&#39;);<br>    background-position: 20px 30px; /* Pixel values භාවිතා කරමින් */<br>}</pre><ul><li><strong>center:</strong> රූපය මැදට ගන්නවා.</li><li><strong>top right:</strong> උඩ-දකුණු කෙළවරට ගන්නවා.</li><li><strong>Percentage:</strong> 50% 50% මැදට ගන්නවා.</li><li><strong>Pixels:</strong> 20px 30px කියන්නේ left ඉඳලා 20px, top ඉඳලා 30px.</li></ul><h3>5. Background Attachment</h3><p>background-attachment property එකෙන් background image එක scroll වෙන විදිහ control කරනවා.</p><pre>.div1 {<br>    background-image: url(https://medium.com/&#39;image.jpg&#39;);<br>    background-attachment: scroll;  /* Content එක්ක scroll වෙනවා (default) */<br>}<br>.div2 {<br>    background-image: url(https://medium.com/&#39;image.jpg&#39;);<br>    background-attachment: fixed;   /* Scroll කරනකොට fixed තියෙනවා */<br>}<br>.div3 {<br>    background-image: url(https://medium.com/&#39;image.jpg&#39;);<br>    background-attachment: local;   /* Element එකේ content එක්ක scroll වෙනවා */<br>}</pre><ul><li><strong>scroll:</strong> Content එක්ක scroll වෙනවා.</li><li><strong>fixed:</strong> Scroll කරනකොට රූපය fixed තියෙනවා.</li><li><strong>local:</strong> Element එකේ content එක්ක scroll වෙනවා.</li></ul><h3>Shorthand Background Property</h3><p>ඔයාට ඕනනම් shorthand property එක භාවිතා කරලා background properties ඔක්කොම එක line එකකින් දෙන්න පුළුවන්.</p><pre>div {<br>    /* Order: color image repeat attachment position */<br>    background: #f0f0f0 url(https://medium.com/&#39;image.jpg&#39;) no-repeat fixed center;<br>}</pre><p>Background-color, image, repeat, attachment, position ඔක්කොම එකවර set කරනවා. ලේසියි, efficient!</p><h3>4. CSS Navigation Bar</h3><p>Navigation bar එකක් කියන්නෙ වෙබ් අඩවියක විවිධ කොටස් අතර ගමන් කිරීමට ඔයාට උපකාර වන ලේසි UI අංගයක්. CSS භාවිතයෙන් navigation bars හදන හැටි අපි ඉගෙන ගමු.</p><h3>Navigation Bar types</h3><p>Navigation bars ප්රධාන වර්ග දෙකක් තියෙනවා: Horizontal (තිරස්) සහ Vertical (සිරස්). එකින් එක බලමු.</p><h4>1. Horizontal Navigation Bar</h4><p>ගොඩක් වෙලාවට වෙබ් පිටුවක උඩින් තමයි Horizontal navigation bars තියෙන්නෙ. ඒක හදන හැටි මෙන්න:</p><pre>&lt;!-- HTML Structure --&gt;<br>&lt;nav&gt;<br>    &lt;ul&gt;<br>        &lt;li&gt;&lt;a href=&quot;#home&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;<br>        &lt;li&gt;&lt;a href=&quot;#about&quot;&gt;About&lt;/a&gt;&lt;/li&gt;<br>        &lt;li&gt;&lt;a href=&quot;#services&quot;&gt;Services&lt;/a&gt;&lt;/li&gt;<br>        &lt;li&gt;&lt;a href=&quot;#contact&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;<br>    &lt;/ul&gt;<br>&lt;/nav&gt;</pre><pre>/* CSS Styling */<br>nav {<br>    background-color: #333;<br>}</pre><pre>nav ul {<br>    list-style-type: none;<br>    margin: 0;<br>    padding: 0;<br>    overflow: hidden;<br>}</pre><pre>nav li {<br>    float: left;<br>}</pre><pre>nav li a {<br>    display: block;<br>    color: white;<br>    text-align: center;<br>    padding: 14px 16px;<br>    text-decoration: none;<br>}</pre><pre>nav li a:hover {<br>    background-color: #111;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/0*DhxQYxp4LR6QXY0p" /><figcaption>Horizontal Nav Bar</figcaption></figure><p>මේක ලේසියෙන් තේරුම් ගමු:</p><ul><li>&lt;nav&gt; එක තමයි navigation bar එකේ container එක.</li><li>&lt;ul&gt; එක ඇතුළේ &lt;li&gt; items තියෙනවා. මේවා තමයි links (Home, About වගේ).</li><li>CSS එකෙන්: background-color: #333; එකෙන් nav එකට අඳුරු පාටක් දෙනවා. float: left; එකෙන් &lt;li&gt; items එක පේළියට එනවා (horizontal විදිහට). a:hover එකෙන් mouse එක උඩින් ගියාම background එක change වෙනවා.</li></ul><p><strong>Try This:</strong> මේ code එක copy කරලා HTML file එකක දාලා browser එකේ බලන්න. Links උඩ hover කරලා color change වෙනවද බලන්න!</p><h4>2. Vertical Navigation Bar</h4><p>Vertical navigation bars ගොඩක් වෙලාවට වෙබ් පිටුවක side එකක තියෙනවා. හදන හැටි මෙන්න:</p><pre>&lt;!-- HTML Structure --&gt;<br>&lt;nav&gt;<br>    &lt;ul&gt;<br>        &lt;li&gt;&lt;a href=&quot;#home&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;<br>        &lt;li&gt;&lt;a href=&quot;#about&quot;&gt;About&lt;/a&gt;&lt;/li&gt;<br>        &lt;li&gt;&lt;a href=&quot;#services&quot;&gt;Services&lt;/a&gt;&lt;/li&gt;<br>        &lt;li&gt;&lt;a href=&quot;#contact&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;<br>    &lt;/ul&gt;<br>&lt;/nav&gt;</pre><pre>/* CSS for Vertical Navigation */<br>nav ul {<br>    list-style-type: none;<br>    margin: 0;<br>    padding: 0;<br>    width: 200px;<br>    background-color: #f1f1f1;<br>}</pre><pre>nav li a {<br>    display: block;<br>    color: #000;<br>    padding: 8px 16px;<br>    text-decoration: none;<br>}</pre><pre>nav li a:hover {<br>    background-color: #555;<br>    color: white;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/287/0*JcGmn4E6eakrvFW9" /><figcaption>Vertical Navigation Bar</figcaption></figure><p>මේකත් ලේසියි:</p><ul><li>&lt;ul&gt; එකට width: 200px; දීලා fixed width එකක් දෙනවා.</li><li>float: left; නැති නිසා items එකින් එක පහළට එනවා (vertical).</li><li>Hover කරනකොට background එක dark වෙලා text එක white වෙනවා.</li></ul><p><strong>Try This:</strong> Horizontal nav එකේ CSS එක change කරලා vertical එකක් හදලා බලන්න. float: left; එක අයින් කරලා try කරන්න!</p><h3>Navigation Bars වලට එකතු කළ යුතු Cool Features</h3><p>Navigation bar එකට තවත් ලස්සන features එකතු කරමු:</p><ul><li><strong>Responsive Design :</strong> Screen size එක අනුව navigation bar එක change වෙන්න ඕන. Media queries භාවිතා කරනවා.</li><li><strong>Dropdown Menus :</strong> Sub-menus එකතු කරන්න nested &lt;ul&gt; යොදාගන්නවා.</li><li><strong>Active State :</strong> Current page එක highlight කරන්න. වෙනස් color එකකින්.</li><li><strong>Transitions :</strong> Hover effects smooth කරන්න. CSS transitions එක්ක.</li></ul><h3>Responsive Navigation Bar එකක උදාහරණය</h3><p>Responsive design එකෙන් screen size එක change වුණාම navigation bar එකත් change වෙනවා. මෙන්න උදාහරණයක්:</p><pre>/* Responsive Navigation */<br>@media screen and (max-width: 600px) {<br>    nav li {<br>        float: none;<br>    }</pre><pre>    nav li a {<br>        text-align: left;<br>    }<br>}</pre><p>මෙතන:</p><ul><li>max-width: 600px; කියන්නේ screen එක 600px ට අඩු වුණොත් මේ CSS එක work වෙනවා.</li><li>float: none; එකෙන් horizontal items vertical වෙනවා.</li><li>Text එක left align වෙනවා.</li></ul><p><strong>Try This:</strong> Browser window එක resize කරලා nav එක vertical වෙනවද බලන්න.</p><h3>5. Handling Multimedia with CSS</h3><p>CSS කියන්නේ වෙබ් පිටුවල images, videos, animations වගේ multimedia elements හසුරවන්න ගොඩක් වැදගත් tool එකක්. අපි බලමු කොහොමද ඒවා CSS එක්ක handle කරන්නේ කියලා.</p><h3>Handling Images සහ Videos</h3><p>වෙබ් පිටුවක images සහ videos responsive විදිහට තියෙන්න ඕන. ඒ කියන්නේ screen size එක වෙනස් උනාම ඒවාත් ඒකට ගැළපෙන්න ඕන. ඔයා phone එකකින් බැලුවත්, laptop එකකින් බැලුවත්, image එක හරියට පේන්න ඕන නේ? මේකට basic CSS code එක මෙන්න:</p><pre>img {<br>    max-width: 100%;<br>    height: auto;<br>    display: block;<br>}</pre><ul><li><strong>max-width: 100%;</strong> — Image එක container එකෙන් එළියට යන්නේ නැහැ. Screen එකට ගැළපෙනවා.</li><li><strong>height: auto;</strong> — Image එකේ height එක aspect ratio එක රැකගෙන adjust වෙනවා.</li><li><strong>display: block;</strong> — Image එක block element එකක් විදිහට පෙන්වනවා.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*dlTJI9orCuUsNZVf6IGH8g.gif" /></figure><h3>CSS Transformations</h3><p>Transformations කියන්නේ multimedia elements වල look එක change කරන එක. ඒ කියන්නේ image එකක් slant කරනවා (skew), scale කරනවා, rotate කරනවා වගේ දේවල් කරන්න පුළුවන්. ඒක ටිකක් fun වැඩක්.</p><h4>1. Skew Transformations</h4><p>Skew කියන්නේ element එකක් X සහ Y axes වලට slant කරන එක. මේකෙන් image එකට වෙනස් look එකක් දෙන්න පුළුවන්.</p><pre>.element1 {<br>    transform: skew(30deg, 30deg);    /* X සහ Y axis දෙකම */<br>}<br>.element2 {<br>   transform: skewX(30deg);          /* X axis විතරක් */<br>}<br>.element3 {<br>    transform: skewY(30deg);          /* Y axis විතරක් */<br>}</pre><ul><li><strong>skew(30deg, 30deg):</strong> X සහ Y දෙකටම 30 degrees slant කරනවා.</li><li><strong>skewX(30deg):</strong> X axis එකට විතරක් slant කරනවා.</li><li><strong>skewY(30deg):</strong> Y axis එකට විතරක් slant කරනවා.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*iMSF6k9P4qF7Knj0" /><figcaption>Skew Transformation</figcaption></figure><h4>2. CSS Animations with Keyframes</h4><p>Animations එක්ක ඔයාට images වලට ජීවයක් දෙන්න පුළුවන්. Keyframes කියන්නේ animation එකේ steps define කරන එක. Smooth විදිහට වෙනස්කම් කරන්න මේක use කරනවා.</p><pre>/* From-to syntax එක */<br>@keyframes skewAnimation {<br>    from {<br>        transform: skew(0deg);<br>    }<br>    to {<br>        transform: skew(30deg);<br>    }<br>}</pre><pre>/* Percentage syntax එක */<br>@keyframes complexAnimation {<br>    0% { transform: scale(1); }<br>    50% { transform: scale(1.2); }<br>    100% { transform: scale(1); }<br>}</pre><p>Animation එක apply කරන්න මෙහෙම:</p><pre>.animated-element {<br>    animation: skewAnimation 2s ease infinite;<br>}</pre><ul><li><strong>@keyframes:</strong> Animation එකේ steps define කරනවා.</li><li><strong>animation:</strong> Element එකට animation එක දෙනවා (name, duration, timing function, iteration count).</li></ul><p><strong>Tryout:</strong> &lt;div&gt; එකකට animation apply කරලා browser එකේ බලන්න. 2s වෙනුවට 1s දාලා speed එක වෙනස් කරලත් බලන්න!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*LkP1-c2K0EYtiVAuR-x1Rw.gif" /><figcaption>Skew Animation</figcaption></figure><h4>Media Queries එක්ක Responsive Multimedia</h4><p>Media queries කියන්නේ screen size එක අනුව styles change කරන එක. Phone එකකදි video එක එක විදිහට, laptop එකකදි තව විදිහකට adjust කරන්න පුළුවන්.</p><pre>.video-container {<br>    position: relative;<br>    padding-bottom: 56.25%; /* 16:9 aspect ratio */<br>    height: 0;<br>    overflow: hidden;<br>}</pre><pre>@media screen and (max-width: 768px) {<br>    .video-container {<br>        padding-bottom: 75%; /* Small screens වලට adjust */<br>    }<br>}</pre><ul><li><strong>.video-container:</strong> Video එක responsive විදිහට embed කරනවා.</li><li><strong>@media:</strong> Screen size එක 768px ට අඩු උනොත් padding-bottom වෙනස් වෙනවා.</li></ul><p><strong>උත්සාහ කරමු:</strong> YouTube video එකක් embed කරලා, screen size change කරලා responsive ද කියලා බලන්න!</p><h3>6. Pseudo Elements</h3><p>Pseudo-elements කියන්නේ element එකක specific කොටස් style කරන්න උදවු වෙන එකක්. උදාහරණයක් විදිහට, paragraph එකක first line එක වෙනස් විදිහට style කරන්න, හෝ element එකකට content එකතු කරන්න pseudo-elements use කරනවා.</p><h3>Pseudo-Elements කියන්නේ මොකක්ද?</h3><p>Pseudo-elements කියන්නේ CSS වලින් element එකක specific කොටස් style කරන එකට use කරන tool එකක්. උදාහරණ කිහිපයක් බලමු:</p><ul><li>Text එකක <strong>first line</strong> එක.</li><li>Text එකක <strong>first letter</strong> එක.</li><li>Element එකකට <strong>content</strong> එකතු කරන එක (before හෝ after).</li><li><strong>Selected text</strong> එක style කරන එක.</li></ul><p>ඒ කියන්නේ, HTML එකේ extra tags දාන්නේ නැතුව CSS එකෙන්ම මේවා කරන්න පුළුවන්. ගොඩක් clean සහ smart විදිහක්!</p><h3>Syntax</h3><p>Pseudo-elements use කරන විදිහ ගොඩක් simple:</p><pre>selector::pseudo-element {<br>    property: value;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E2U576iKM_IrLIDgRn1-IA.png" /></figure><p><strong>Note:</strong> Pseudo-elements වලට double colon (::) use කරනවා. Pseudo-classes වලට single colon (:) use කරනවා. මේක මතක තියාගන්න!</p><h3>Common Pseudo-Elements</h3><h4>1. ::first-line</h4><p>::first-line මගින් text block එකක first line එක style කරනවා.</p><pre>p::first-line {<br>    color: blue;<br>    font-variant: small-caps;<br>    font-weight: bold;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*CvZ_0svU7OqELJEgYMbS-g.png" /></figure><p>මේකෙන් paragraph එකක first line එක blue වෙනවා, small caps වෙනවා, ටිකක් bold වෙනවා.</p><h4>2. ::first-letter</h4><p>::first-letter මගින් text එකක first letter එක style කරනවා. Articles වල drop caps (විශාල first letter) හදන්න මේක use කරනවා.</p><pre>p::first-letter {<br>    font-size: 2em;<br>    font-weight: bold;<br>    color: red;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*t92KWAhBV2wY8nbvNG4ONg.png" /></figure><p>මේකෙන් first letter එක large වෙනවා, bold වෙනවා, red වෙනවා.</p><h4>3. ::before සහ ::after</h4><p>::before සහ ::after මගින් element එකකට <strong>පෙර</strong> හෝ <strong>පසු</strong> content එකතු කරන්න පුළුවන්.</p><pre>/* Quotation marks එකතු කිරීම */<br>blockquote::before {<br>    content: &quot;❝&quot;;<br>    color: #666;<br>    font-size: 2em;<br>}<br>blockquote::after {<br>    content: &quot;❞&quot;;<br>    color: #666;<br>    font-size: 2em;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*p2RSJhhCHOiOyVJtrkrYqw.png" /></figure><p>මේකෙන් &lt;blockquote&gt; එකකට quotation marks එකතු වෙනවා.</p><h4>4. ::selection</h4><p>::selection මගින් selected text එක style කරන්න පුළුවන්.</p><pre>p::selection {<br>    background-color: yellow;<br>    color: black;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*M68M0eGvD8L9XKwJUensqg.gif" /></figure><h3>Practical Example</h3><p>Pseudo-elements use කරලා decorative heading එකක් හදමු. මේකෙන් heading එකට දෙපැත්තෙන් lines එකතු කරනවා.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;Styled Heading Example&lt;/title&gt;<br>    &lt;style&gt;<br>        body {<br>            font-family: Arial, sans-serif;<br>            background-color: #f4f4f4;<br>            margin: 0;<br>            padding: 20px;<br>        }</pre><pre>        h2 {<br>            position: relative;<br>            text-align: center;<br>            font-size: 24px;<br>            color: #333;<br>        }</pre><pre>        h2::before, h2::after {<br>            content: &quot;&quot;;<br>            display: inline-block;<br>            width: 50px; /* Line එකේ පළල */<br>            height: 2px; /* Line එකේ උස */<br>            background: #333; /* Line එකේ වර්ණය */<br>            margin: 0 10px; /* Line සහ text අතර ඉඩ */<br>            vertical-align: middle; /* Text එක්ක align කිරීම */<br>        }<br>    &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;</pre><pre>    &lt;h2&gt;Section Title&lt;/h2&gt;<br>    &lt;p&gt;This is an example paragraph below the heading. The heading has decorative lines on either side.&lt;/p&gt;</pre><pre>&lt;/body&gt;<br>&lt;/html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZLUSdsZwcWZamrc0jbNftw.png" /></figure><h3>Browser Support</h3><p>Pseudo-elements ගොඩක් modern browsers වල support කරනවා. ඒත් මේවා මතක තියාගන්න:</p><ul><li>Pseudo-elements වලට double colon (::) use කරන්න.</li><li>Some old browsers single colon (:) විතරක් support කරනවා.</li><li>විවිධ browsers වල test කරලා බලන්න.</li></ul><h3>7. CSS Box Model</h3><p>ආයුබෝවන්! අපේ <strong>Web Development for Beginners</strong> series එකේ දෙවෙනි කොටසේ හත්වෙනි ලිපියට ඔයාව සාදරයෙන් පිළිගන්නවා. මේ series එකේ පළවෙනි කොටසෙන් අපි HTML ගැන ලිපි 10ක් ලිව්වා. දෙවෙනි series එකේ එකේ පළවෙනි series එකේ අපි HTML ගැන ලිපි 10ක් ලිව්වා, දෙවෙනි series එකේ පළවෙනි ලිපියෙන් CSS හැඳින්වීමක් කළා, දෙවෙනි ලිපියෙන් <strong>CSS Basic properties</strong> ගැන, <strong>CSS Background Styling</strong> ගැන, සිව්වෙනි ලිපියෙන් <strong>CSS Navigation Bar</strong> ගැන, පස්වෙනි ලිපියෙන් <strong>Handling Multimedia with CSS</strong> ගැන, හයවෙනි එකෙන් “Pseudo Elements” ගැන කතා කළා. දැන් අපි බලමු වෙබ් පිටුවක elements වල structure එක සහ spacing එක තේරුම් ගන්න ගොඩක් වැදගත් concept එකක් වන <strong>CSS Box Model</strong> ගැන.</p><p>CSS Box Model එකෙන් ඔයාට HTML element එකක් box එකක් විදිහට හිතන්න උදවු වෙන එක. ඒ box එකේ content, padding, border, margin කියලා layers ගොඩක් තියෙනවා. එන්න, මේක ගැන ඉගෙන ගමු.</p><h3>Box Model එකේ Components</h3><p>CSS Box Model එක main components හතරකින් සමන්විතයි.</p><ul><li><strong>Content :</strong> Element එකේ actual content එක. text, images වගේ දේවල්.</li><li><strong>Padding :</strong> Content එක වටේ තියෙන clear space එක, border එක ඇතුළේ.</li><li><strong>Border :</strong> Padding එක වටේ තියෙන රේඛාව.</li><li><strong>Margin :</strong> Border එකෙන් පිටත තියෙන clear space එක.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*GEm3twfXqgnqR6hxxwBGkg.png" /></figure><p>මේක ටිකක් උදාහරණයකින් බලමු:</p><pre>div {<br>    width: 300px;             /* Content එකේ width */<br>    padding: 20px;            /* Border එක ඇතුළේ space */<br>    border: 2px solid black;  /* Border එකේ thickness සහ style */<br>    margin: 10px;             /* Border එකෙන් පිටත space */<br>}</pre><p><strong>Try this:</strong> HTML එකට &lt;div&gt; එකක් දාලා, මේ CSS එක apply කරලා browser එකෙන් Inspect කරලා box model එකේ content, padding, border, margin වෙනසවන හැටි බලන්න.</p><h3>Total Element Width Calculation</h3><p>Element එකක total width එක හදන්නේ මෙහෙම:</p><p>Total width = width + left padding + right padding + left border + right border + left margin + right margin</p><p>උදාහරණයක් විදිහට, උඩ &lt;div&gt; එකේ: Total width = 300 + 40 + 4 + 20 = 364px</p><p>ඒ කියන්නේ &lt;div&gt; එක screen එකේ 364px space එකක් ගන්නවා.</p><h3>Box-Sizing Property</h3><p>box-sizing property එකෙන් element එකේ width සහ height calculate වෙන විදිහ change කරන්න පුළුවන්. Default වශයෙන් content-box use කරනවා. ඒකෙදි width වලට padding සහ border include වෙන්නේ නැහැ. ඒත් border-box use කරනකොට width වලට padding සහ border include වෙනවා.</p><pre>/* Default box sizing */<br>.content-box {<br>    box-sizing: content-box;  /* Width/height content වලට විතරයි */<br>}</pre><pre>/* Modern box sizing */<br>.border-box {<br>    box-sizing: border-box;   /* Width/height padding සහ border include */<br>}</pre><p><strong>උදාහරණයක්:</strong> box-sizing: border-box; use කරනකොට, width 300px කියලා දුන්නම padding සහ border එකත් ඒ 300px ඇතුළේ තියෙනවා. Total width එක 300px විතරයි.</p><h3>Margin Collapse</h3><p>Box Model එකේ තව වැදගත් concept එකක් තමයි margin collapse. මේකෙදි vertical margins overlap වෙනවා.</p><ul><li>Element දෙකක vertical margins meet උනාම, ඒ දෙකෙන් ලොකු margin එක විතරක් යෙදෙනවා.</li><li>උදාහරණයක් විදිහට, එක paragraph එකක margin-bottom: 20px; සහ ඊළඟ paragraph එකක margin-top: 15px; තියෙනවා නම්, අතර ඉඩ 20px විතරයි (35px නෙවෙයි).</li></ul><pre>.first-paragraph {<br>    margin-bottom: 20px;<br>}</pre><pre>.second-paragraph {<br>    margin-top: 15px;<br>    /* අතර ඉඩ 20px විතරයි */<br>}</pre><p><strong>Try This:</strong> Paragraph දෙකක් හදලා margins දාලා inspect කරලා බලන්න. Margin collapse වෙනවද කියලා check කරන්න!</p><h3>Practice Exercise</h3><p>මේ code එකේ values change කරලා layout එක කොහොමද change වෙන්නේ කියලා බලන්න:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot; /&gt;<br>  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot; /&gt;<br>  &lt;title&gt;Box Styling Example&lt;/title&gt;<br>  &lt;style&gt;<br>    .box {<br>      width: 200px;<br>      padding: 20px;<br>      border: 5px solid blue;<br>      margin: 15px;<br>      background-color: lightgray;<br>    }<br>  &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>  &lt;h1&gt;Box Style Example&lt;/h1&gt;<br>  &lt;div class=&quot;box&quot;&gt;<br>    This is a box with a fixed width of 200px, 20px padding, a blue 5px solid border, 15px margin, and a light gray background.<br>  &lt;/div&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*ePLEWeKk2StJ6hEg8ntgkQ.gif" /></figure><p>මේක fun වැඩක්. Browser එකේ inspect කරලා box model එක බලන්න!</p><h3>Best Practices</h3><p>Box Model එක්ක වැඩ කරනකොට මේවා මතක තියාගන්න:</p><ul><li><strong>box-sizing: border-box;</strong> use කරන්න. layouts predictable වෙනවා.</li><li>vertical spacing කරනකොට <strong>Margin collapse</strong> ගැන දැනුවත් වෙන්න.</li><li><strong>Padding</strong> එක inner spacing වලට, <strong>margin</strong> එක outer spacing වලට use කරන්න.</li><li>pixels වෙනුවට <strong>Relative units</strong> (em, rem, %) use කරන්න responsive designs වලට.</li></ul><p>ඔබට CSS ගැන තව දුරටත් ඉගෙන ගන්න ප්රයෝජනවත් resources ටිකක් දෙන්නම්:</p><ol><li><a href="https://web.dev/learn/css/**">https://web.dev/learn/css</a></li><li><a href="https://www.w3schools.com/css/**">https://www.w3schools.com/css</a></li><li><a href="https://www.codecademy.com/learn/learn-css**">https://www.codecademy.com/learn/learn-css</a></li><li><a href="https://www.freecodecamp.org/news/tag/css/**">https://www.freecodecamp.org/news/tag/css</a></li></ol><p><strong>Happy coding, Sri Lanka!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ed12d6400ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTML For Beginner]]></title>
            <link>https://medium.com/@sadeepanithushika/html-for-beginner-ae6910f2dc44?source=rss-02ead828554b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae6910f2dc44</guid>
            <category><![CDATA[html5-development]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[sinhala]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Sadeepa Herath]]></dc:creator>
            <pubDate>Fri, 25 Apr 2025 13:05:31 GMT</pubDate>
            <atom:updated>2025-04-25T13:05:31.012Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SXWHZB-SzZ5rbNyTGT_xIA.jpeg" /><figcaption>HTML For Beginner</figcaption></figure><h3>HTML කියන්නේ මොකක්ද?</h3><p>HTML, එහෙමත් නැත්නම් HyperText Markup Language, තමයි web page එකක මූලික ගොඩනැඟිල්ල. සරලව කිව්වොත්, HTML තමයි web page එකක අන්තර්ගතය (content) ව්යුහගත කරලා තේරුමක් දෙන්නේ. උදාහරණයක් විදිහට, ඔයා පත්තරයක ලිපියක් කියවනකොට, මාතෘකාව, උපමාතෘකා, පරිච්ඡේද එහෙම තියෙනවා නේද? HTMLත් එහෙම තමයි, web page එකක තොරතුරු නිසි ලෙස සකස් කරනවා.</p><p>HyperText කියන්නේ මොකක්ද? ඒක තමයි එකිනෙකට සම්බන්ධ වෙබ් පිටු. උදාහරණයක් විදිහට, ඔයා “ලංකාදීප” වෙබ් අඩවියේ ලින්ක් එකක් ක්ලික් කරලා පුවත් ලිපියකට යනවා නේද? ඒ සම්බන්ධතාවය තමයි HyperText.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/0*pOkKNiwwQpFtIbYF" /><figcaption>(Hypertext ගැන idea එකක් ගන්න. රූපයේ වෙබ් පිටු කිහිපයක් එකිනෙකට ලින්ක් වෙලා තියෙන හැටි පෙන්වනවා.)</figcaption></figure><h3>HTML වැඩ කරන්නේ කොහොමද?</h3><p>HTML භාවිතා කරන්නේ tags කියන විශේෂ ලකුණු. මේ tags තමයි අන්තර්ගතය ව්යුහගත කරන්නේ. උදාහරණයක් දෙන්නම්: ඔයාට වෙබ් පිටුවක මාතෘකාවක්(heading) දාන්න ඕන නම්, &lt;h1&gt; tag එක යොදාගන්නවා. පරිච්ඡේදයක් (paragraph) ලියන්න ඕන නම් &lt;p&gt; tag එක යොදාගන්නවා. මේ tags ලියන්න රීති ටිකක් තියෙනවා, ඒවාට කියන්නේ syntax සහ semantic rules. ඒවා ගැන ගොඩක් හිතන්න එපා, අපි ටික ටික ඉගෙන ගමු.</p><h3>HTML ඉතිහාසය</h3><p>HTML ගැන කතා කරද්දී, එයාගේ ඉතිහාසයත් ටිකක් බලමු:</p><ol><li>HTML 1.0 (1993) — මුල්ම වෙබ් පිටු හැදුවේ මේකෙන්. ඉතාම සරලයි, තොරතුරු බෙදාගන්න විතරයි.</li><li>HTML 2.0 (1995) — නව විශේෂාංග එකතු වුණා, මූලික ඒවා වැඩිදියුණු කළා.</li><li>HTML 3.0 (1995)– තවත් බලවත් වුණා, නමුත් බ්රව්සර්වල වේගය අඩු වුණා.</li><li>HTML 4.01 (1999) — HTML5 එන්න කලින් ගොඩක් ජනප්රිය වුණ සංස්කරණය.</li><li>HTML 5 (2012) — HTML 4.01 වැඩිදියුණු කරපු, නවීන වෙබ් අඩවි හදන්න භාවිතා වෙන එක.</li></ol><p>HTML කියන්නේ අපේ ගෙදර හදන කෑම වගේ. කාලයත් එක්ක රස වැඩි කරලා, වඩා හොඳ ඒවා හැදුවා වගේ තමයි HTMLත් වැඩිදියුණු වුණේ.</p><h3>HTML Tags</h3><p>HTML tags කියන්නේ angle brackets (&lt; සහ &gt;) ඇතුළේ ලියන විශේෂ වචන. බොහෝ tags වල ආරම්භයක් (opening tag) සහ අවසානයක් (closing tag) තියෙනවා. උදාහරණයක් විදිහට:</p><ul><li>&lt;html&gt; සහ &lt;/html&gt; — මුළු ලේඛනයම ඇතුළත් වෙනවා.</li><li>&lt;body&gt; සහ &lt;/body&gt; — වෙබ් පිටුවේ දිස්වන අන්තර්ගතය ලියන තැන.</li></ul><p>නමුත්, සමහර tags වල අවසානයක් නැහැ. ඒවාට කියන්නේ self-closing tags. උදාහරණ:</p><ul><li>&lt;br&gt; — text බිඳීමක් (line break) දානවා.</li><li>&lt;img&gt; — රූපයක් එකතු කරනවා.</li></ul><p>මේ tags ලියනවා කියන්නේ වාක්යකට විරාම ලකුණු දානවා වගේ. ඒකෙන් තමයි වෙබ් පිටුවට හැඩයක් එන්නේ.</p><h3>HTML Attributes</h3><p>Attributes කියන්නේ tags වලට ටිකක් වැඩිපුර තොරතුරු දෙන එක. මේවා ලියන්නේ opening tag එක ඇතුළේ, name=”value” ආකාරයට. උදාහරණයක් බලමු:</p><pre>&lt;a href=&quot;&lt;https://www.uom.lk&gt;&quot;&gt;University of Moratuwa&lt;/a&gt;</pre><p>මෙතන &lt;a&gt; tag එකෙන් සබැඳියක් (link) හදනවා. href කියන්නේ attribute එකේ නම, “&lt;https://www.uom.lk&gt;&quot; කියන්නේ ඒකේ අගය (value). මේක ක්ලික් කළාම ඔයාව මොරටුව විශ්වවිද්යාලයේ වෙබ් අඩවියට ගෙනියනවා. Attributes කියන්නේ ටිකක් විස්තර එකතු කරන ලේබල් වගේ දෙයක්.</p><h3>HTML5 document එකක ව්යුහය</h3><p>දැන් අපි බලමු HTML5 ලේඛනයක් හදන්නේ කොහොමද කියලා. ඒකට මේ ටික ඕන:</p><ol><li>&lt;!DOCTYPE html&gt; — මේකෙන් කියනවා “මේක HTML5 document එකක්” කියලා.</li><li>&lt;html&gt; tag — මුළු ලේඛනයම ඇතුළත් වෙන මූලික tag එක.</li><li>&lt;head&gt; කොටස — වෙබ් පිටුව ගැන තොරතුරු (metadata), මාතෘකාව (title), styles, scripts එහෙම ලියන තැන.</li><li>&lt;body&gt; කොටස — වෙබ් පිටුවේ දිස්වන දේවල් (මාතෘකා, text, රූප) ලියන තැන.</li></ol><p>මේක ටිකක් විස්තර කරන්නම්:</p><ul><li>&lt;!DOCTYPE html&gt; ලියලා ලේඛනය ආරම්භ කරනවා.</li><li>&lt;html&gt; ඇතුළේ සියල්ල ලියනවා.</li><li>&lt;head&gt; ඇතුළේ &lt;title&gt; වගේ tags යොදලා පිටුවේ නම, තොරතුරු එකතු කරනවා.</li><li>&lt;body&gt; ඇතුළේ තමයි ඔයාට display වෙන දේවල් ලියන්නේ.</li></ul><h3>සරල HTML5 document එකකට උදාහරණයක්</h3><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>    &lt;title&gt;My First Webpage&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;h1&gt;Welcome to HTML5&lt;/h1&gt;<br>    &lt;p&gt;This is a simple HTML5 document.&lt;/p&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>මෙතන බලන්න:</p><ul><li>&lt;!DOCTYPE html&gt; එකෙන් HTML5 කියලා ප්රකාශ කරනවා.</li><li>&lt;title&gt; එකෙන් පිටුවේ නම “My First Webpage” කියලා දීලා.</li><li>&lt;body&gt; එකේ &lt;h1&gt; එකෙන් “Welcome to HTML5” කියලා මාතෘකාවක්, &lt;p&gt; එකෙන් පොඩි වාක්යයක් ලියලා.</li></ul><p>මේක තමයි ඔයාගේ පළමු වෙබ් පිටුව. ලේසියි නේද?</p><h3>අමතර සටහන්</h3><ul><li>HTML තමයි වෙබ් පිටුවේ අන්තර්ගතය ව්යුහගත කරන්නේ.</li><li>CSS තමයි වෙබ් අඩවියේ පෙනුම (වර්ණ, හැඩ) හදන්නේ. ඉදිරියේදී ඒ ගැන කතා කරමු. දැනට මේ photo දෙකෙන් idea එකක් ගන්න</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/0*CZmcYO80J0semAZL" /><figcaption>HTML සහ CSS භාවිතය අතර වෙනස</figcaption></figure><ul><li>JavaScript තමයි වෙබ් අඩවියට ක්රියාකාරකම් (functions) එකතු කරන්නේ. ඉදිරියේදී ඒ ගැන කතා කරමු.</li><li>HTML ලේඛනයක් හදද්දී &lt;html&gt; tag එකෙන් ආරම්භ කරන්න recommend කරනවා.</li><li>web site එකක් කියන්නේ වෙබ් බ්රව්සරයකින් බලන්න පුළුවන් document එකතුවක්. එකේ frontend (පෙනෙන කොටස) සහ backend (සර්වර් පැත්ත) කියලා කොටස් දෙකක් තියෙනවා.</li></ul><h3>HTML Header (&lt;header&gt;)</h3><p>දැන් අපි බලමු &lt;header&gt; tag එක ගැන. මේක තමයි වෙබ් පිටුවක ආරම්භක කොටස (introductory content) හෝ navigation links තියෙන තැන. සරලව කිව්වොත්, ඔයාගේ වෙබ් පිටුවට එන කෙනෙක් මුලින්ම දකින කොටස මෙතන තමයි.</p><p>සාමාන්යයෙන් &lt;header&gt; එකේ තියෙන්නේ:</p><ul><li>මාතෘකා (&lt;h1&gt; — &lt;h6&gt;)</li><li>ලාංඡනය (logo) හෝ ලස්සන icon එකක්</li><li>කර්තෘ තොරතුරු (authorship info)</li></ul><p>උදාහරණයක් බලමු:</p><pre>&lt;header&gt;<br>    &lt;h1&gt;My Website&lt;/h1&gt;<br>    &lt;img src=&quot;logo.png&quot; alt=&quot;Website Logo&quot;&gt;<br>    &lt;p&gt;Welcome to my website&lt;/p&gt;<br>&lt;/header&gt;</pre><p>මෙතන &lt;header&gt; එක ඇතුළේ &lt;h1&gt; එකෙන් වෙබ් අඩවියේ නම දාලා, &lt;img&gt; එකෙන් ලාංඡනයක් එකතු කරලා, &lt;p&gt; එකෙන් “ආයුබෝවන්” වගේ පණිවිඩයක් දාලා තියෙනවා. මේක අඩවියේ “මුහුණ” වගේ!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/0*H3B6dXqINu02L0Ff" /><figcaption>Example Headers</figcaption></figure><h3>HTML Footers (&lt;footer&gt;)</h3><p>දැන් අපි යමු &lt;footer&gt; tag එකට. මේක තමයි වෙබ් පිටුවේ පාදක කොටස (footer section). එහෙමත් නැත්නම්, පිටුවේ බොහොම පහළම තියෙන කොටස. මෙතන තමයි අඩවිය ගැන අවසාන තොරතුරු දෙන්නේ.</p><p>සාමාන්යයෙන් &lt;footer&gt; එකේ තියෙන්නේ:</p><ul><li>කර්තෘ තොරතුරු (author information)</li><li>ප්රකාශන හිමිකම් තොරතුරු (copyright details)</li><li>ඇමතුම් තොරතුරු (contact info)</li><li>අඩවි සිතියම (sitemap)</li><li>ඉහළට යන සබැඳි (back to top links)</li><li>ආශ්රිත ලේඛන (related documents)</li></ul><p>උදාහරණයක් බලමු:</p><pre>&lt;footer&gt;<br>    &lt;p&gt;© 2025 My Website. All Rights Reserved.&lt;/p&gt;<br>    &lt;p&gt;Contact: info@mywebsite.com&lt;/p&gt;<br>    &lt;a href=&quot;#&quot;&gt;Back to Top&lt;/a&gt;<br>&lt;/footer&gt;</pre><p>මෙතන &lt;footer&gt; එකේ ප්රකාශන හිමිකම් ගැන තොරතුරු, ඇමතුම් තොරතුරු, සහ “ඉහළට” යන ලින්ක් එකක් දාලා තියෙනවා. වෙබ් පිටුව බලලා ඉවර වෙන කොට මේකෙන් අඩවිය ගැන අවසාන තොරතුරු ලැබෙනවා.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/0*dnAJ_V2xqwEvQ8ks" /><figcaption>Example Footers</figcaption></figure><h3>HTML Headings (&lt;h1&gt; — &lt;h6&gt;)</h3><p>වෙබ් පිටුවක මාතෘකා (titles) සහ උපමාතෘකා (subtitles) දාන්න තමයි HTML headings භාවිතා කරන්නේ. මේවා ලියන්නේ &lt;h1&gt; සිට &lt;h6&gt; දක්වා tags වලින්. ඒ කියන්නේ &lt;h1&gt; තමයි වැදගත්ම, ලොකුම මාතෘකාව. &lt;h6&gt; තමයි ඒ තරම් වැදගත් නැති, පොඩිම එක.</p><p>අපි උදාහරණයක් බලමු:</p><pre>&lt;h1&gt;Heading 1&lt;/h1&gt;<br>&lt;h2&gt;Heading 2&lt;/h2&gt;<br>&lt;h3&gt;Heading 3&lt;/h3&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/0*UKEjc0wyvKAAgumY" /><figcaption>Heading Tags</figcaption></figure><p>මෙතන &lt;h1&gt; කියන්නේ ප්රධාන මාතෘකාව ලොකු අකුරෙන්, කැපිලා පෙනෙනවා. ඊළඟට &lt;h2&gt;, &lt;h3&gt; ටික ක්රමක් ක්රමයෙන් පොඩි වෙනවා. ඔයා පොතක ලොකු මාතෘකාවකට යටින් තව උපමාතෘකා ලියනවා වගේ තමයි මේකත්. ලේසි නේද?</p><p>ඔයාත් try කරලා බලන්න! &lt;h1&gt; එකකින් “My Web Page” කියලා ලියලා, &lt;h2&gt; එකකින් “Welcome” කියලා එකතු කරලා බලන්න.</p><h3>Common HTML Formatting Tags සහ උදාහරණ</h3><p>දැන් අපි බලමු text හැඩ ගන්වන්න යොදාගන්න ප්රධාන tags ටිකක්. මේවා ගොඩක් වැදගත්, ඒ නිසා හොඳට තේරුම් ගන්න.</p><h3>1. Bold සහ important text</h3><ul><li>&lt;b&gt; — text bold කරනවා, ඒත් වැඩි වැදගත්කමක් නැති විදිහට.</li><li>&lt;strong&gt; — text bold කරනවා වගේම වැදගත්කමත් එකතු කරනවා (SEO සහ screen readers මේක හඳුනාගන්නවා).</li></ul><p>උදාහරණය:</p><pre>&lt;p&gt;This is a &lt;b&gt;bold&lt;/b&gt; text.&lt;/p&gt;<br>&lt;p&gt;This is a &lt;strong&gt;very important&lt;/strong&gt; text.&lt;/p&gt;</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/0*InMTiQ7Ikj2c-ada" /><figcaption>Bold &amp; Strong</figcaption></figure><p>&lt;b&gt; එක bold විතරක් කරනවා. &lt;strong&gt; එක bold කරලා “මේක වැදගත්” කියලත් කියනවා. ඔයාට වෙනස පැහැදිලිද? Try කරලා බලන්න!</p><h3>2. Italic සහ emphasized text</h3><ul><li>&lt;i&gt; — text <em>italic</em> කරනවා (හැඩයට විතරයි).</li><li>&lt;em&gt; — text <em>italic</em> කරනවා සහ අවධාරණයත් එකතු කරනවා (SEO වලටත් හොඳයි).</li></ul><p>උදාහරණය:</p><pre>&lt;p&gt;This is &lt;i&gt;italic&lt;/i&gt; text.&lt;/p&gt;<br>&lt;p&gt;This is &lt;em&gt;emphasized&lt;/em&gt; text.&lt;/p&gt;</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/212/0*LusvodV7c2ramf5f" /><figcaption>Italic &amp; Emphasized</figcaption></figure><p>Italic කියන්නේ text ටිකක් ඇඹුල් වෙලා පෙනෙන විදිහ. &lt;i&gt; එක හැඩයට විතරයි, &lt;em&gt; එක රසයකුත් එකතු කරනවා. ඔයාත් ලියලා බලන්න!</p><h3>3. Highlight කළ text</h3><ul><li>&lt;mark&gt; — text highlight කරනවා (සාමාන්යයෙන් කහ පාටින්).</li></ul><p>උදාහරණය:</p><pre>&lt;p&gt;This is &lt;mark&gt;highlighted&lt;/mark&gt; text.&lt;/p&gt;</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/205/0*sGyZ702W3zvGmCM4" /><figcaption>highlight</figcaption></figure><p>වැදගත් කොටසක් පෙන්නන්න ඕන වුණොත් &lt;mark&gt; එක යොදාගන්න. ඔයාටත් ටිකක් highlight කරලා බලන්න!</p><h3>4. පොඩි text</h3><ul><li>&lt;small&gt; — text පොඩි අකුරෙන් පෙන්වනවා.</li></ul><p>උදාහරණය:</p><pre>&lt;p&gt;This is &lt;small&gt;smaller&lt;/small&gt; text.&lt;/p&gt;</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/169/0*BlsOJvj72q_N9hzW" /><figcaption>small text</figcaption></figure><p>Copyright වගේ ටිකක් පොඩි දෙයක් ලියන්න ඕන වුණොත් &lt;small&gt; එක පාවිච්චි කරන්න.</p><h3>5. මකා දැමූ සහ එකතු කළ text</h3><ul><li>&lt;del&gt; — මකා දැමූ text පෙන්වනවා (ඉරක් ඇඳලා).</li><li>&lt;ins&gt; — එකතු කළ text පෙන්වනවා (යටින් ඉරක් ඇඳලා).</li></ul><p>උදාහරණය:</p><pre>&lt;p&gt;This is &lt;del&gt;deleted&lt;/del&gt; text.&lt;/p&gt;<br>&lt;p&gt;This is &lt;ins&gt;inserted&lt;/ins&gt; text.&lt;/p&gt;</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/185/0*oLOohFcprQ_Qcxwt" /><figcaption>Deleted &amp; Inserted</figcaption></figure><p>පරණ එක මකලා, අලුත් එක දැම්මා කියලා පෙන්නන්න මේවා යොදාගන්නවා. ඔයාටත් මේ විදිහට ටිකක් try කරලා බලන්න පුළුවන්.</p><h3>6. Superscript සහ Subscript text</h3><ul><li>&lt;sup&gt; — Superscript (උඩු අකුරු, උදා: ගණිත exponent).</li><li>&lt;sub&gt; — Subscript (යටි අකුරු, උදා: රසායනික සූත්ර).</li></ul><p>උදාහරණය:</p><pre>&lt;p&gt;This is an exponent: 2&lt;sup&gt;3&lt;/sup&gt; = 8&lt;/p&gt;<br>&lt;p&gt;This is a chemical formula: H&lt;sub&gt;2&lt;/sub&gt;O&lt;/p&gt;</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/0*Vr49uJGCox0E1jvG" /><figcaption>Superscript &amp; Subscript</figcaption></figure><p>ගණිතයේ exponent හෝ රසායන විද්යාවේ සූත්ර ලියන්න මේවා perfect! ඔයාත් ලියලා බලන්න.</p><h3>HTML Lists</h3><p>Html lists වෙබ් පිටුවක තොරතුරු පිළිවෙලකට, ලස්සනට පෙන්වන්න lists ගොඩක් වැදගත් වෙනවා. HTML එකේ තියෙනවා lists වර්ග තුනක්: ordered lists, unordered lists, සහ description lists. මේවා යොදාගෙන ඔයාට ඕන විදිහකට තොරතුරු arrange කරන්න පුළුවන්.</p><h3>1. Ordered Lists (&lt;ol&gt;)</h3><p>Ordered lists කියන්නේ අනුපිළිවෙල වැදගත් වෙන වෙලාවට යොදාගන්න list එකක්. උදාහරණයක් විදිහට, ඔයා ගෙදර වැඩ ලිස්ට් එකක් හදනවා කියමු. මුලින් මොනවා කරන්න ඕන, ඊළඟට මොනවා කරන්න ඕන කියලා පිළිවෙලක් තියෙනවා නේද? ඒ වගේ තැන්වල ordered lists භාවිතා වෙනවා. මේ lists වල items ඉදිරියේ අංක එනවා. ඒ අංක කරන විදිහ type attribute එකෙන් වෙනස් කරන්න පුළුවන්.</p><p>Type Value අංක කරන ආකාරය උදාහරණ 1 (Default) සංඛ්යා 1, 2, 3, 4 A Capital අකුරු A, B, C, D a Simple අකුරු a, b, c, d I Capital රෝමානු අංක I, II, III, IV i Simple රෝමානු අංක i, ii, iii, iv</p><h3>උදාහරණය:</h3><pre>&lt;ol type=&quot;A&quot;&gt;<br>  &lt;li&gt;Requirement Analysis&lt;/li&gt;<br>  &lt;li&gt;Design&lt;/li&gt;<br>  &lt;li&gt;Development&lt;/li&gt;<br>  &lt;li&gt;Testing&lt;/li&gt;<br>&lt;/ol&gt;</pre><pre>&lt;ol type=&quot;i&quot;&gt;<br>  &lt;li&gt;Login Setup&lt;/li&gt;<br>  &lt;li&gt;Dashboard Implementation&lt;/li&gt;<br>  &lt;li&gt;Database Integration&lt;/li&gt;<br>&lt;/ol&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/0*R8mifrTFKytfCr0m" /><figcaption>Ordered Lists</figcaption></figure><p>ඔයාත් try කරලා බලන්න! &lt;ol&gt; tag එක යොදාගෙන list එකක් හදලා, type attribute එක වෙනස් කරලා අංක වෙනස් වෙන හැටි බලන්න.</p><h3>2. Unordered Lists (&lt;ul&gt;)</h3><p>Unordered lists යොදාගන්නේ අනුපිළිවෙල වැදගත් නැති වෙලාවට. උදාහරණයක් විදිහට, ඔයා supermarket එකට ගන්න දේවල් ලිස්ට් එකක් හදනවා කියමු. මුලින් මොනවා ගත්තත් කමක් නැහැනේ? ඒ වගේ තැන්වල unordered lists හොඳයි. මේ lists වල items ඉදිරියේ bullet points (චූටි ලකුණු) එනවා. ඒ bullet style එක CSS එකේ list-style-type property එකෙන් වෙනස් කරන්න පුළුවන්.</p><p>list-style-type Bullet Style උදාහරණ disc (Default) ● Filled රවුම ● Item 1, Item 2 circle ○ හිස් රවුම ○ Item 1, Item 2 square ■ Filled චතුරස්රය ■ Item 1, Item 2 none Bullet නැත (markers නැත)</p><h3>උදාහරණය:</h3><pre>&lt;ul style=&quot;list-style-type: square;&quot;&gt;<br>  &lt;li&gt;Project Planning&lt;/li&gt;<br>  &lt;li&gt;Task Allocation&lt;/li&gt;<br>  &lt;li&gt;Progress Monitoring&lt;/li&gt;<br>&lt;/ul&gt;</pre><pre>&lt;ul style=&quot;list-style-type: circle;&quot;&gt;<br>  &lt;li&gt;Frontend Development&lt;/li&gt;<br>  &lt;li&gt;Backend Development&lt;/li&gt;<br>  &lt;li&gt;Quality Assurance&lt;/li&gt;<br>&lt;/ul&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/0*pJhP4UlhdrSCO-z4" /><figcaption>Unordered Lists</figcaption></figure><p>ඔයාත් ගෙදරට ගන්න දේවල් ලිස්ට් එකක් &lt;ul&gt; එකකින් හදලා, list-style-type වෙනස් කරලා බලන්න. Bullet style එක වෙනස් වෙනවා බලන්න ලස්සනයි!</p><h3>3. Description Lists (&lt;dl&gt;)</h3><p>Description lists යොදාගන්නේ වචනයක් හෝ යෙදුමක් (term) එකක් සහ ඒකේ විස්තරය (description) පෙන්වන්න. උදාහරණයක් විදිහට, වචනාර්ථ දෙන glossary එකක් හදනවා වගේ. මේකේ tags දෙකක් තියෙනවා:</p><ul><li>&lt;dt&gt; — Term එක (වචනය)</li><li>&lt;dd&gt; — Description එක (විස්තරය)</li></ul><h3>උදාහරණය:</h3><pre>&lt;dl style=&quot;border: 1px solid #ccc; padding: 10px;&quot;&gt;<br>  &lt;dt&gt;&lt;strong&gt;Frontend Development&lt;/strong&gt;&lt;/dt&gt;<br>  &lt;dd style=&quot;margin-left: 20px;&quot;&gt;Focuses on the user interface and user experience of a website.&lt;/dd&gt;</pre><pre>  &lt;dt&gt;&lt;strong&gt;Backend Development&lt;/strong&gt;&lt;/dt&gt;<br>  &lt;dd style=&quot;margin-left: 20px;&quot;&gt;Handles server-side logic, database management, and application functionality.&lt;/dd&gt;<br>&lt;/dl&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/0*fesiVnoF5aVjoGEs" /><figcaption>Description Lists</figcaption></figure><p>මේකෙන් ඔයාට terms ටිකක් define කරන්න පුළුවන්. උදාහරණයක් විදිහට, ඔයාගේ වෙබ් අඩවියේ FAQ section එකක් description list එකකින් හදන්න try කරන්න.</p><h3>Nested Lists (Hierarchical Structure)</h3><p>Nested lists කියන්නේ list එකක් ඇතුළේ තව list එකක් දාන එක. මේකෙන් ඔයාට උපකාණ්ඩ (subcategories) හෝ ධූරාවලි වගේ දේවල් පෙන්වන්න පුළුවන්. උදාහරණයක් විදිහට, ඔයාගේ පාඩම් විෂයන් ලිස්ට් එකක් හදලා, ඒ යටතේ උපවිෂයන් දාන්න පුළුවන්.</p><h3>උදාහරණය:</h3><pre>&lt;ul&gt;<br>  &lt;li&gt;Web Development<br>    &lt;ul&gt;<br>      &lt;li&gt;HTML&lt;/li&gt;<br>      &lt;li&gt;CSS&lt;/li&gt;<br>      &lt;li&gt;JavaScript&lt;/li&gt;<br>    &lt;/ul&gt;<br>  &lt;/li&gt;<br>  &lt;li&gt;Software Development<br>    &lt;ul style=&quot;list-style-type: square;&quot;&gt;<br>      &lt;li&gt;Python&lt;/li&gt;<br>      &lt;li&gt;Java&lt;/li&gt;<br>      &lt;li&gt;C++&lt;/li&gt;<br>    &lt;/ul&gt;<br>  &lt;/li&gt;<br>&lt;/ul&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/0*agerahmVxqEInIAR" /><figcaption>Nested Lists</figcaption></figure><p>මේක try කරලා බලන්න! ඔයාගේ ප්රියතම subjects ලිස්ට් එකක් හදලා, ඒ යටතේ subtopics ටිකක් nested list එකක් විදිහට දාන්න.</p><p>TIP: Type එක assign නොකර list mix කර කර nested loops හදලා බලන්න bullet, numbering වෙනස් වෙන විදිහ. හැමෝම කරන්න ඕන නෑ ඉගෙනගන්න උවමනාවක් තියන අය විතරක් කරලා බලන්න!</p><h3>HTML Images</h3><p>වෙබ් පිටුවකට images එකතු කළාම ඒක ලස්සන වෙනවා වගේම, බලන අයට තොරතුරු ලේසියෙන් තේරෙනවා. HTML එකේ images දාන්නේ &lt;img&gt; tag එකෙන්, ඒකට closing tag එකක් නැහැ. Images හරියට යොදාගත්තොත්, user experience එකත්, accessibility එකත් වැඩි වෙනවා.</p><h3>1. HTML හි Image එකක් එකතු කිරීම</h3><p>වෙබ් පිටුවකට image එකක් දාන්න &lt;img&gt; tag එක යොදාගන්නවා. මේකට අවශ්ය attributes දෙකක් තියෙනවා.</p><ul><li>src (Source): Image එක තියෙන තැන (URL හෝ file path එක).</li><li>alt (Alternative Text): Image එක ගැන විස්තරයක්, image එක load වෙන්නේ නැත්තම් හෝ screen readers භාවිතා කරන අයට පෙන්වන්න.</li></ul><h3>උදාහරණය:</h3><pre>&lt;img src=&quot;image.jpg&quot; alt=&quot;A beautiful sunset over the ocean&quot;&gt;</pre><p>මෙතන:</p><ul><li>src වලින් “image.jpg” කියන image එක point කරනවා.</li><li>alt වලින් image එක ගැන කියනවා: “A beautiful sunset over the ocean”.</li></ul><p>Image එක load වෙන්නේ නැත්තම්, browser එක මෙහෙම පෙන්වනවා:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/0*P9oG-aBp3XaYrgd7" /><figcaption>alt image</figcaption></figure><p>ත් try කරලා බලන්න! ඔයාගේ computer එකේ තියෙන image එකක් &lt;img&gt; tag එකෙන් දාලා, alt text එකත් එකතු කරලා බලන්න.</p><h3>2. Image එකක ප්රමාණය වෙනස් කිරීම</h3><p>Image එකක size එක adjust කරන්න width සහ height attributes යොදාගන්නවා. මේවට values දෙන්නේ pixels (px) හෝ percentages (%) වලින්.</p><h3>උදාහරණය:</h3><pre>&lt;img src=&quot;landscape.jpg&quot; alt=&quot;Mountain landscape&quot; width=&quot;300&quot; height=&quot;200&quot;&gt;<br>&lt;img src=&quot;landscape.jpg&quot; alt=&quot;Mountain landscape&quot; width=&quot;500&quot; height=&quot;200&quot;&gt;<br>&lt;img src=&quot;landscape.jpg&quot; alt=&quot;Mountain landscape&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3qb2aW0-Z0BHaNu-" /><figcaption>Different sizes of image</figcaption></figure><h3>Best Practice:</h3><p>Image එකේ aspect ratio (ප්රමාණ අනුපාතය) රැකගන්න, width හෝ height එකක් විතරක් දෙන්න. එතකොට browser එක අනිත් එක auto adjust කරගන්නවා.</p><pre>&lt;img src=&quot;landscape.jpg&quot; alt=&quot;Mountain landscape&quot; width=&quot;300&quot;&gt;</pre><p>මෙතන width 300px විතරයි දීලා තියෙන්නේ, height එක auto adjust වෙනවා.</p><p>ඔයාත් ටිකක් අත්හදා බලන්න. Image එකක width විතරක් දීලා, height එක කොහොමද වෙනස් වෙන්නේ කියලා check කරන්න.</p><h3>3. Responsive Images (CSS එක්ක)</h3><p>Images responsive කරන්න, එහෙමත් නැත්නම් screen size එකට match වෙන්න, CSS යොදාගන්නවා.</p><h3>උදාහරණය:</h3><pre>&lt;img src=&quot;responsive.jpg&quot; alt=&quot;Responsive design example&quot; style=&quot;max-width: 100%; height: auto;&quot;&gt;</pre><ul><li>max-width: 100% මගින් image එක container එකට හරියන්න scale වෙනවා.</li><li>height: auto මගින් aspect ratio එක රැකගන්නවා.</li></ul><p>මේක mobile-friendly වෙබ් පිටු හදනකොට ගොඩක් වැදගත්.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*9NCP6vsb9PGoMVta" /><figcaption>responsive image</figcaption></figure><p>ඔයාගේ webpage එක phone එකකින් බලලා, image එක හොඳට පේනවද කියලා බලන්න. CSS එක යොදලා responsive කරලා බලන්න!</p><h3>4. Local සහ External Images</h3><p>Images එකතු කරන්න පුළුවන් දෙවිදිහකින්:</p><ul><li>Local Files: ඔයාගේ project folder එකේ තියෙන images.</li><li>External URLs: Internet එකේ වෙන server එකක තියෙන images.</li></ul><h3>උදාහරණය (Local File):</h3><pre>&lt;img src=&quot;images/logo.png&quot; alt=&quot;Company Logo&quot;&gt;</pre><h3>උදාහරණය (External URL):</h3><pre>&lt;img src=&quot;&lt;https://example.com/image.jpg&gt;&quot; alt=&quot;Online Image&quot;&gt;</pre><p>Local images යොදාගන්න එක හොඳයි, මොකද ඒවා ඉක්මනට load වෙනවා. External images යොදාගන්නකොට server එකේ issue එකක් ආවොත් image එක පෙන්නන්නේ නැහැ.</p><h3>5. Clickable Image එකක් හදමු</h3><p>Image එකකින් link එකකට යන්න පුළුවන් &lt;a&gt; tag එක යොදාගෙන.</p><h3>උදාහරණය:</h3><pre>&lt;a href=&quot;&lt;https://www.example.com&gt;&quot;&gt;<br>  &lt;img src=&quot;button.jpg&quot; alt=&quot;Click here&quot; width=&quot;150&quot;&gt;<br>&lt;/a&gt;</pre><p>මෙතන image එක click කළාම “&lt;https://www.example.com&gt;&quot; වෙත යනවා.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*iGY82yRBP_gNmeD5" /><figcaption>Hyperlink images</figcaption></figure><p>ඔයාත් try කරන්න! Image එකක් link එකක් විදිහට දාලා, උදාහරණයක් විදිහට Facebook profile එකට link කරන්න.</p><h3>6. Image Formats සහ Optimization</h3><p>වෙබ් පිටුවක images යොදාගන්නකොට format එක තෝරන එක වැදගත්. ඒකෙන් page load speed සහ quality එක තීරණය වෙනවා.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/0*KaIG3wxSd2s_iVb7" /><figcaption>Image types</figcaption></figure><p>Page load speed වැඩි කරන්න, images compress කරන්න. <a href="https://tinypng.com/">TinyPNG</a> හෝ <a href="https://squoosh.app/">Squoosh</a> වගේ tools යොදාගන්න.</p><p>ඔයාත් එකම image එක JPEG සහ PNG විදිහට save කරලා, file size එක බලන්න.</p><h3>7. Background Images (CSS එක්ක)</h3><p>Image එකක් webpage එකේ background එක විදිහට දාන්න CSS යොදාගන්නවා.</p><h3>උදාහරණය:</h3><pre>body {<br>  background-image: url(https://medium.com/&quot;background.jpg&quot;);<br>  background-size: cover;<br>  background-position: center;<br>}</pre><p>මෙතන “background.jpg” webpage එකේ background එක වෙනවා, full screen එක cover වෙන්න.</p><p>ඔයාත් background image එකක් දාලා, CSS එක change කරලා position, size එහෙම adjust කරලා බලන්න.</p><h3>8. Lazy Loading Images</h3><p>Image ගොඩක් තියෙන webpage එකක performance වැඩි කරන්න lazy loading යොදාගන්නවා. ඒකෙන් images load වෙන්නේ screen එකේ පෙනෙන විට විතරයි.</p><h3>උදාහරණය:</h3><pre>&lt;img src=&quot;large-image.jpg&quot; alt=&quot;High-resolution image&quot; loading=&quot;lazy&quot;&gt;</pre><ul><li>loading=”lazy” මගින් image එක load වෙන්නේ අවශ්ය වෙලාවට විතරයි, page load time අඩු වෙනවා.</li></ul><p>Images ගොඩක් තියෙන page එකක lazy loading try කරලා, speed එක වැඩි වෙනවද බලන්න.</p><h3>HTML Video &amp; Audio</h3><p>HTML5 එක්ක වෙබ් පිටුවලට audio සහ video එකතු කරන්න පුළුවන්. මේවා යොදාගෙන ඔයාගේ වෙබ් පිටුව තවත් ලස්සන කරගන්න ලේසි වෙනවා</p><h3>HTML හි Video</h3><p>HTML5 එක්ක &lt;video&gt; tag එක ආවා. ඒකෙන් වෙබ් පිටුවකට video එකක් directly එකතු කරන්න පුළුවන්.</p><pre>&lt;video width=&quot;320&quot; height=&quot;240&quot; controls&gt;<br>  &lt;source src=&quot;movie.mp4&quot; type=&quot;video/mp4&quot;&gt;<br>  &lt;source src=&quot;movie.ogg&quot; type=&quot;video/ogg&quot;&gt;<br>  Your browser does not support the video tag.<br>&lt;/video&gt;</pre><p>මෙම code එකෙන් වීඩියෝ format දෙකක් play කරන්න allow කරලා තියනවා. එක වීඩියෝ format එකක්වත් support නැත්තන් “Your browser does not support the video tag” එක පෙන්නවා නැතිනම් දීලා තියන අනුපිලිවෙලින් මුලින්ම support කරන වීඩියෝ එක play කරනවා.</p><h3>Video Attributes</h3><ul><li>controls: Play, pause, volume වගේ buttons පෙන්වනවා.</li><li>autoplay: Page එක load වෙනකොටම video එක play වෙනවා.</li><li>loop: Video එක ඉවර වුණාම ආයෙත් play වෙනවා.</li><li>muted: Video එකේ sound එක mute කරලා තියෙනවා.</li></ul><p>ඔයාත් &lt;video&gt; tag එක try කරන්න! ඔයාගේ computer එකේ තියෙන short video එකක් දාලා, controls එක්ක play කරලා බලන්න. autoplay attribute එක එකතු කරලා, page එක load වෙනකොටම video එක play වෙනවද බලන්න. Sound එක නැතුව ඕනෑ නම් muted දාලා try කරන්න.</p><h3>HTML හි Audio</h3><p>Audio files (songs, sounds) එකතු කරන්න &lt;audio&gt; tag එක යොදාගන්නවා.</p><pre>&lt;audio controls&gt;<br>  &lt;source src=&quot;audio.mp3&quot; type=&quot;audio/mpeg&quot;&gt;<br>  &lt;source src=&quot;audio.ogg&quot; type=&quot;audio/ogg&quot;&gt;<br>  Your browser does not support the audio element.<br>&lt;/audio&gt;</pre><p>video tag එක වගේම තමයි මෙතනත් කෝඩ් එක වැඩ කරන්නෙ. audio format දෙකක් play කරන්න allow කරලා තියනවා. එක audio format එකක්වත් support නැත්තන් “Your browser does not support the audio element” එක පෙන්නවා නැතිනම් දීලා තියන අනුපිලිවෙලින් මුලින්ම support කරන audio එක play කරනවා.</p><h3>Audio Attributes</h3><ul><li>controls: Play, stop, volume වගේ audio control buttons පෙන්වනවා.</li><li>autoplay: Page load වෙනකොටම audio එක play වෙනවා.</li><li>loop: Audio එක ඉවර වුණාම ආයෙත් play වෙනවා.</li><li>preload: Page එක load වෙනකොට audio එකත් load කරන්නද කියලා control කරනවා (auto, metadata, none).</li></ul><p>ඔයාත් &lt;audio&gt; tag එකෙන් song එකක් දාලා බලන්න! controls එක එක්ක play කරලා, loop attribute එක දාලා song එක repeat වෙනවද බලන්න. autoplay එකත් try කරලා බලන්න. page එක open වෙනකොටම song එක start වෙනවද කියලා.</p><h3>HTML Tables</h3><p>HTML Table භාවිතා වෙන්නේ දත්ත ලස්සනට arrange කරලා පෙන්නන්න. උදාහරණයක් විදිහට, ඔයාට timetable එකක්, මිල ලැයිස්තුවක්, හෝ report එකක් webpage එකක පෙන්නන්න ඕන නම්, tables තමයි best. ඒවා බලන අයට ලේසියෙන් තේරෙන විදිහට data organize කරනවා.</p><h3>1. HTML වගු තේරුම් ගනිමු</h3><p>HTML table එකක main parts තුනක් තියෙනවා:</p><ol><li>වගු පේළි (&lt;tr&gt;) — එක row එකක් හදනවා.</li><li>වගු දත්ත (&lt;td&gt;) — එක එක cells වල data තියෙනවා.</li><li>වගු ශීර්ෂ (&lt;th&gt;) — තීරුවල headings දෙනවා (bold සහ center වෙනවා).</li></ol><p>අපි බලමු basic table එකක් කොහොමද හදන්නේ කියලා.</p><pre>&lt;table border=&quot;1&quot;&gt;<br>  &lt;tr&gt;<br>    &lt;th&gt;Name&lt;/th&gt;<br>    &lt;th&gt;Age&lt;/th&gt;<br>    &lt;th&gt;Country&lt;/th&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;Alice&lt;/td&gt;<br>    &lt;td&gt;25&lt;/td&gt;<br>    &lt;td&gt;USA&lt;/td&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;Bob&lt;/td&gt;<br>    &lt;td&gt;30&lt;/td&gt;<br>    &lt;td&gt;UK&lt;/td&gt;<br>  &lt;/tr&gt;<br>&lt;/table&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/217/0*o6zNR4KNwiX6a4Ls" /><figcaption>Table with border = 1</figcaption></figure><ul><li>&lt;table&gt; tag එකෙන් table එක start කරනවා.</li><li>&lt;tr&gt; එකෙන් row එකක් හදනවා.</li><li>&lt;th&gt; එකෙන් column headings දෙනවා (bold සහ center වෙනවා automatically).</li><li>&lt;td&gt; එකෙන් data cells හදනවා.</li><li>border=”1&quot; දැම්මම table එකේ borders පේනවා.</li></ul><p>Try it: ඔයා මේ code එක copy කරලා HTML file එකක දාලා browser එකක open කරලා බලන්න. Table එක හරියට පේනවද කියලා check කරන්න!</p><h3>2. Table එකට Caption එකක් දාමු</h3><p>Table එකට title එකක් දෙන්න ඕන නම් &lt;caption&gt; tag එක යෝදාගන්නවා. ඒකෙන් data ගැන ලේසියෙන් තේරුම් ගන්න පුළුවන්.</p><pre>&lt;table border=&quot;1&quot;&gt;<br>  &lt;caption&gt;Student Information&lt;/caption&gt;<br>  &lt;tr&gt;<br>    &lt;th&gt;Name&lt;/th&gt;<br>    &lt;th&gt;Grade&lt;/th&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;John&lt;/td&gt;<br>    &lt;td&gt;A&lt;/td&gt;<br>  &lt;/tr&gt;<br>&lt;/table&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/151/0*k0fMV4yMDqhRU4sG" /><figcaption>Table with Caption</figcaption></figure><p>Caption එක table එකට උඩින් එනවා. ලස්සනයි, ලේසියි!</p><h3>3. Cells එකතු කිරීම (colspan සහ rowspan)</h3><p>අපිට table එකේ cells තිරස් අතට (horizontally) සහ සිරස් අතට (vertically) එකතු කරන්න පුළුවන්. ඒකට යෝදාගන්නේ:</p><ul><li>colspan — තීරු එකතු කරනවා.</li><li>rowspan — පේළි එකතු කරනවා.</li></ul><pre>&lt;table border=&quot;1&quot;&gt;<br>  &lt;tr&gt;<br>    &lt;th colspan=&quot;2&quot;&gt;Srudent Information&lt;/th&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;Name&lt;/td&gt;<br>    &lt;td&gt;Grade&lt;/td&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td rowspan=&quot;2&quot;&gt;Emily&lt;/td&gt;<br>    &lt;td&gt;A&lt;/td&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;B&lt;/td&gt;<br>  &lt;/tr&gt;<br>&lt;/table&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/0*rx3Q3cNz4yoJ1eiL" /><figcaption>Rowspan &amp; Colspan</figcaption></figure><ul><li>colspan=”2&quot; දැම්මම “සිසු විස්තර” heading එක තීරු 2කට යනවා.</li><li>rowspan=”2&quot; දැම්මම “Emily” cell එක පේළි 2කට යනවා.</li></ul><p>Try This: colspan හෝ rowspan value එක 3 කරලා run කරලා බලන්න. Table එක වෙනස් වෙන හැටි බලන්න</p><h3>4. CSS එක්ක Table එක Style කරමු</h3><p>Table එකට ලස්සන look එකක් දෙන්න CSS යෝදාගන්නවා. ඒකෙන් borders, colors, spacing වගේ දේවල් වෙනස් කරන්න පුළුවන්.</p><pre>&lt;style&gt;<br>  table {<br>    width: 50%;<br>    border-collapse: collapse;<br>  }<br>  th, td {<br>    border: 1px solid black;<br>    padding: 8px;<br>    text-align: center;<br>  }<br>  th {<br>    background-color: #f2f2f2;<br>  }<br>&lt;/style&gt;</pre><pre>&lt;table&gt;<br>  &lt;tr&gt;<br>    &lt;th&gt;Name&lt;/th&gt;<br>    &lt;th&gt;Score&lt;/th&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;David&lt;/td&gt;<br>    &lt;td&gt;85&lt;/td&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;Anna&lt;/td&gt;<br>    &lt;td&gt;90&lt;/td&gt;<br>  &lt;/tr&gt;<br>&lt;/table&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/0*hekjJ4wlKxeL7YFh" /><figcaption>Without CSS</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/0*iJWuiVoIsCC4AMAh" /><figcaption>With CSS</figcaption></figure><ul><li>width: 50%; — Table එකේ පළල 50% කරනවා.</li><li>border-collapse: collapse; — Borders අතර ඉඩ ඉවත් කරනවා.</li><li>padding: 8px; — Cells ඇතුළේ ඉඩ දෙනවා (ලේසියෙන් කියවන්න).</li><li>text-align: center; — Text මැදට ගන්නවා.</li><li>background-color: #f2f2f2; — Headers වලට light gray color එකක් දෙනවා.</li></ul><p>දැනට CSS ගැන දන්නැත්තම් ලොකුවට හිතන්න එපා ඉස්සරහට ඒ ගැන ඉගෙනගමු.</p><h3>5. Table එකේ Alignment සහ Width Control කරමු</h3><p>Table එකේ පළල සහ පිහිටීම වෙනස් කරන්නත් පුළුවන්.</p><pre>&lt;table border=&quot;1&quot; width=&quot;80%&quot; align=&quot;center&quot;&gt;<br>  &lt;tr&gt;<br>    &lt;th&gt;Name&lt;/th&gt;<br>    &lt;th&gt;Job&lt;/th&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;Mark&lt;/td&gt;<br>    &lt;td&gt;Engineer&lt;/td&gt;<br>  &lt;/tr&gt;<br>&lt;/table&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wQn5rA9sfgu8Mp84" /><figcaption>Table Alignment</figcaption></figure><ul><li>width=”80%” — Table එක 80% පළලට ගන්නවා. (page size එකෙන් 80%)</li><li>align=”center” — Table එක page එකේ මැදට ගන්නවා.</li></ul><p>Note: මේ attributes work වුණත්, modern web design වලදී CSS යෝදාගන්නවා තමයි best (උදා: margin: 0 auto;).</p><h3>6. Advanced Table Features</h3><h3>A. Striped Rows</h3><p>Table එක කියවන්න ලේසි වෙන්න alternate rows වලට colors දෙන්න පුළුවන්.</p><pre>&lt;style&gt;<br>      tr:nth-child(even) {<br>        background-color: #b13838;<br>      }<br>    &lt;/style&gt;</pre><p>මේකෙන් even rows වලට gray color එකක් එනවා.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*n6e7nMfEjGlg3Hri" /><figcaption>Row background color</figcaption></figure><h3>B. Hover Effect</h3><p>Mouse එක row එකක් උඩ තියනකොට color එක change වෙන්නත් පුළුවන්.</p><pre>&lt;style&gt;<br>  tr:hover {<br>    background-color: yellow;<br>  }<br>&lt;/style&gt;</pre><p>මේක run කරලා mouse එක table එක උඩ ගෙනියල බලන්න, කහ පාටට වෙනස් වෙනවා!</p><h3>7. Nested Tables (Table එකක ඇතුළේ Table එකක්)</h3><p>&lt;td&gt; cell එකක ඇතුළේ තව table එකක් දාන්න පුළුවන්.</p><pre>&lt;table border=&quot;1&quot;&gt;<br>  &lt;tr&gt;<br>    &lt;th&gt;Employee&lt;/th&gt;<br>    &lt;th&gt;Details&lt;/th&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;John&lt;/td&gt;<br>    &lt;td&gt;<br>      &lt;table border=&quot;1&quot;&gt;<br>        &lt;tr&gt;<br>          &lt;th&gt;Department&lt;/th&gt;<br>          &lt;td&gt;IT&lt;/td&gt;<br>        &lt;/tr&gt;<br>        &lt;tr&gt;<br>          &lt;th&gt;Salary&lt;/th&gt;<br>          &lt;td&gt;$5000&lt;/td&gt;<br>        &lt;/tr&gt;<br>      &lt;/table&gt;<br>    &lt;/td&gt;<br>  &lt;/tr&gt;<br>&lt;/table&gt;</pre><p>මේකෙන් “Details” cell එක ඇතුළේ mini table එකක් හදනවා.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/0*U379_eox1pUb8tN3" /><figcaption>Nested Tables</figcaption></figure><h3>HTML Table Tags Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*qTbH0mZvdHqEK4eg" /><figcaption>Summary</figcaption></figure><h3>HTML Forms</h3><p>HTML form එකක් කියන්නේ webpage එකක users ලට data input කරන්න ඉඩ දෙන කොටසක්. ඒ data server එකකට යවලා process කරන්න පුළුවන්. Forms තමයි interactive webpages හදන්න උදව් වෙන්නේ.</p><h3>Basic Form Structure</h3><p>HTML form එකක් හදන්න &lt;form&gt; tag එක යොදාගන්නවා. ඒකට action සහ method කියන attributes දෙකක් තියනවා.</p><pre>&lt;form action=&quot;/submit-form&quot; method=&quot;post&quot;&gt;<br>    &lt;!-- Form elements go here --&gt;<br>&lt;/form&gt;</pre><ul><li>action: Form එක submit කරනකොට data යවන්න ඕන URL එක (උදා: “/submit-form”).</li><li>method: Data යවන ආකාරය (GET හෝ POST).</li></ul><p>Tip: ඔයා beginner කෙනෙක් නිසා, දැනට action සහ method ගැන වැඩිපුර හිතන්න එපා. අපි ඉස්සෙල්ලා form එක හදන elements ගැන බලමු.</p><h3>Common Form Elements</h3><p>Form එකක තියෙන වැදගත් කොටස් ටිකක් බලමු. මේවා තමයි users ලට data input කරන්න උදව් වෙන්නේ.</p><h3>1. Text Input Fields</h3><ul><li>Single-line text input: &lt;input type=”text” name=”username”&gt; එක line එකක ලියන Username, email, phone number වගේ දේවල් enter කරන්න යොදාගන්නවා.</li><li>Password field: &lt;input type=”password” name=”password”&gt; Password type කරනකොට characters hide වෙනවා (උදා: ****).</li><li>Multi-line text area: &lt;textarea name=”message” rows=”4&quot; cols=”50&quot;&gt;&lt;/textarea&gt; Comments, messages වගේ ටිකක් වැඩිපුර ලියන්න ඕන තැන්වල යොදාගන්නවා.</li></ul><h3>2. Selection Elements</h3><ul><li>Radio buttons: &lt;input type=”radio” name=”gender” value=”male”&gt; එක option එකක් විතරක් select කරන්න පුළුවන් (උදා: Gender — Male/Female).</li><li>Checkboxes: &lt;input type=”checkbox” name=”vehicle” value=”bike”&gt; Multiple options select කරන්න යොදාගන්නවා (උදා: Hobbies — Coding, Reading).</li><li>Dropdown lists: &lt;select&gt; සහ &lt;option&gt; tags යොදාගෙන. උදාහරණයක්:</li></ul><pre>&lt;select name=&quot;country&quot;&gt;<br>    &lt;option value=&quot;sl&quot;&gt;Sri Lanka&lt;/option&gt;<br>    &lt;option value=&quot;in&quot;&gt;India&lt;/option&gt;<br>    &lt;option value=&quot;uk&quot;&gt;UK&lt;/option&gt;<br>&lt;/select&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/155/0*3mgX05GptnoU-qiw" /><figcaption>selection element</figcaption></figure><h3>3. Buttons</h3><ul><li>Submit button: &lt;input type=”submit” value=”Submit”&gt; Form එක submit කරන්න යොදාගන්නවා.</li><li>Reset button: &lt;input type=”reset” value=”Reset”&gt; Form එකේ ලියපු data ඔක්කොම clear කරන්න.</li></ul><p>Try This: HTML file එකක් හදලා text input එකක්, radio button එකක්, checkbox එකක්, සහ submit button එකක් දාලා browser එකේ open කරලා බලන්න. Form එක fill කරලා submit එක ඔබලා බලන්න මොකද වෙන්නේ කියලා!</p><h3>Example of a Complete Form</h3><p>full form එකක් කොහොමද හදන්නේ කියලා අපි බලමු . මේකෙන් ඔයාට හොඳ අදහසක් ගන්න පුළුවන්.</p><pre>&lt;form action=&quot;/submit&quot; method=&quot;post&quot;&gt;<br>    &lt;label for=&quot;fname&quot;&gt;First Name:&lt;/label&gt;<br>    &lt;input type=&quot;text&quot; id=&quot;fname&quot; name=&quot;fname&quot;&gt;&lt;br&gt;</pre><pre>    &lt;label for=&quot;email&quot;&gt;Email:&lt;/label&gt;<br>    &lt;input type=&quot;email&quot; id=&quot;email&quot; name=&quot;email&quot;&gt;&lt;br&gt;</pre><pre>    &lt;label&gt;Gender:&lt;/label&gt;<br>    &lt;input type=&quot;radio&quot; name=&quot;gender&quot; value=&quot;male&quot;&gt; Male<br>    &lt;input type=&quot;radio&quot; name=&quot;gender&quot; value=&quot;female&quot;&gt; Female&lt;br&gt;</pre><pre>    &lt;label&gt;Interests:&lt;/label&gt;<br>    &lt;input type=&quot;checkbox&quot; name=&quot;interest&quot; value=&quot;coding&quot;&gt; Coding<br>    &lt;input type=&quot;checkbox&quot; name=&quot;interest&quot; value=&quot;reading&quot;&gt; Reading&lt;br&gt;</pre><pre>    &lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&gt;<br>&lt;/form&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/0*VQNfASyxAOcou7Rl" /><figcaption>Example Form</figcaption></figure><p>මේ form එකේ:</p><ul><li>First name සහ email එක text inputs වලින් ගන්නවා.</li><li>Gender එක radio buttons වලින් select කරනවා.</li><li>Interests ටික checkboxes වලින් තෝරනවා.</li><li>Submit button එකෙන් form එක යවනවා.</li></ul><h3>Important Form Attributes</h3><p>Form එකක තියෙන elements වල name attribute එක ගොඩක් වැදගත්. ඒකෙන් server එකට data යවනවා.</p><p>උදා: &lt;input type=”text” name=”username”&gt; — “username” කියන name එකෙන් තමයි data යවන්නෙ.</p><ul><li>action: Form data යවන්න ඕන තැන (URL එක).</li><li>method: Data යවන විදිහ (GET හෝ POST).</li><li>required: Field එක fill කරන්නම ඕන කියලා දෙනවා. උදා: &lt;input type=”text” required&gt;.</li></ul><h3>Form Validation</h3><p>HTML5 එක්ක built-in validation තියෙනවා.</p><ul><li>required attribute එකෙන් field එක mandatory කරනවා.</li><li>type=”email”, type=”number”, type=”url” වගේ inputs automatically check වෙනවා (උදා: email format එක හරිද කියලා).</li></ul><p>Form එක submit කරනකොට required fields fill කරලා නැත්තම්, browser එක “Please fill out this field” වගේ message එකක් පෙන්නනවා.</p><h3>Best Practices</h3><p>Forms හදනකොට මේ ටික මතක තියාගන්න:</p><ul><li>Labels යොදාගන්න: &lt;label for=”id”&gt; — Accessibility වැඩි වෙනවා, users ලට ලේසි වෙනවා.</li><li>Fieldsets යොදාගන්න: Related fields group කරන්න &lt;fieldset&gt; tag එක යොදාගන්න. උදා:</li></ul><pre>&lt;fieldset&gt;<br>    &lt;legend&gt;Personal Info&lt;/legend&gt;<br>    &lt;label for=&quot;fname&quot;&gt;First Name:&lt;/label&gt;<br>    &lt;input type=&quot;text&quot; id=&quot;fname&quot; name=&quot;fname&quot;&gt;<br>&lt;/fieldset&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/0*kRu2Ae9urZKFHjf8" /><figcaption>Field set</figcaption></figure><ul><li>Validation හරියට කරන්න: Required fields, correct formats (email, number) check කරන්න.</li><li>Clear instructions දෙන්න: Users ලට තේරෙන්න instructions සහ error messages දෙන්න.</li></ul><h3>HTML Content Model කියන්නේ මොකක්ද?</h3><p>ඔබ ගෙයක් හදනවා කියලා හිතන්න. ගෙදරක වහලය හදන්නේ බිත්ති හදලා ඉවර වුණාට පස්සේ නේද? ඒ වගේම HTML වලදීත්, එක එක elements එක එක තැන්වල යෙදෙන්නේ නිශ්චිත රීති ටිකක් අනුව. HTML Content Model කියන්නේ ඒ රීති ටික. මේකෙන් තමයි අපිට තේරෙන්නේ මොන element එකක් කොහේ පාවිච්චි කරන්න ඕනේද, ඒවා එකිනෙකට ගැලපෙන්නේ කොහොමද කියලා.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*MRK4_VJvSvMxL06b" /><figcaption>HTML Content Model</figcaption></figure><h3>Traditional Content Models</h3><p>අපි මුලින්ම බලමු HTML වල තිබුණු පැරණි රීති ටික. elements දෙවිදියකට බෙදුණා:</p><h3>1. Block Elements</h3><ul><li>අලුත් line එකකින් පටන් ගන්නවා.</li><li>තියෙන ඉඩ පුළුල්ව පුරවනවා.</li><li>උදාහරණ: &lt;div&gt; , &lt;p&gt; , &lt;h1&gt;</li></ul><h3>2. Inline Elements</h3><ul><li>ටෙක්ස්ට් එක්ක එකට ගලාගෙන යනවා.</li><li>අවශ්ය තරම් විතරක් ඉඩ ගන්නවා.</li><li>උදාහරණ: &lt;span&gt; , &lt;a&gt; , &lt;strong&gt;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/0*nliPVTxJel72GOKY" /><figcaption>Block elements and Inline elements</figcaption></figure><h3>New HTML5 Content Models</h3><p>HTML5 ආවට පස්සේ මේ රීති ටික වඩාත් නිශ්චිත වුණා. දැන් තියෙන්නේ කැටගරි හතක් (7). මේ එක එක එක ගැන ලේසියෙන් බලමු:</p><h3>1. Metadata Content</h3><ul><li>ගෙදර blueprint එකක් වගේ. ගෙදර ගැන තොරතුරු දෙනවා, ඒත් බලන්න බෑ.</li><li>උදාහරණ: &lt;title&gt; , &lt;link&gt; , &lt;meta&gt;, &lt;style&gt;</li></ul><h3>2. Flow Content</h3><ul><li>ගෙදර මුළු බඩුම ටික වගේ. බොඩි එකේ තියෙන ගොඩක් එලිමන්ට් මේකට ඇතුළත් වෙනවා.</li><li>උදාහරණ: Text elements, Structural elements, Interactive elements</li></ul><h3>3. Sectioning Content</h3><ul><li>ගෙදර වෙන වෙනම කාමර වගේ. වෙබ් පිටුව කොටස් කරනවා.</li><li>උදාහරණ: &lt;article&gt; , &lt;section&gt;, &lt;nav&gt; , &lt;aside&gt;</li></ul><h3>4. Heading Content</h3><ul><li>කාමරවල දොරකඩේ තියෙන නම්පුවරු වගේ.</li><li>උදාහරණ: &lt;h1&gt; සිට &lt;h6&gt; , &lt;hgroup&gt;</li></ul><h3>5. Phrasing Content</h3><ul><li>බිත්තියේ ලියලා තියෙන වචන වගේ. text සහ text level element.</li><li>උදාහරණ: Text, &lt;span&gt;, &lt;img&gt;, &lt;input&gt;.</li></ul><h3>6. Embedded Content</h3><ul><li>ජනේල වගේ, එළියෙන් බඩු ගේනවා.</li><li>උදාහරණ: &lt;img&gt;, &lt;video&gt;, &lt;audio&gt;, &lt;iframe&gt;.</li></ul><h3>7. Interactive Content</h3><ul><li>button සහ switch වගේ, ඔබට එක්ක ගනින්න පුළුවන්.</li><li>උදාහරණ: &lt;button&gt;, &lt;a&gt;, &lt;select&gt;, form alignment.</li></ul><p>special: එක එලිමන්ට් එකකට category කිහිපයකටම අයිති වෙන්න පුළුවන්. උදාහරණයක් විදිහට &lt;a&gt; කියන්නේ flow සහ interactive දෙකටම අයිති එකක්.</p><h3>Best Practices</h3><ul><li>එලිමන්ට් ඒවායේ අරමුණටම භාවිතා කරන්න. උදා: &lt;div&gt; වෙනුවට &lt;section&gt; ඕනෑ තැන ඒක යොදන්න.</li><li>Content Model රීති අනුව නිවැරදිව nest කරන්න. උදා: inline එකකටblovk එකක් දාන්න එපා.</li><li>Accessibility ගැන හිතන්න. semantic elementsයොදලා screen readers වලට උදව් කරන්න.</li></ul><h3>Hyperlinks කියන්නේ මොකක්ද?</h3><p>Hyperlinks කියන්නේ clickable වචන හෝ රූප. ඒවා මත click කළාම, ඔබව වෙනත් වෙබ් පිටුවකට හෝ එකම පිටුවේ වෙනත් කොටසකට ගෙනියනවා. මේක වෙබ් redirect කරන මූලිකම ක්රමයක්!</p><h3>Basic Link Syntax</h3><p>HTML වලදී, hyperlinks හදන්නේ &lt;a&gt; (anchor) ටැග් එකෙන්. ඒකට තියෙන්නේ ප්රධාන කොටස් දෙකයි:</p><ul><li>href attribute: linkඑකෙන් යන්න ඕන තැන (URL හෝ ගොනුව).</li><li>Link text: බලන අයට පේන, click කරන්න පුළුවන් වචන.</li></ul><pre>&lt;a href=&quot;&lt;https://example.com&gt;&quot;&gt;Visit Example Website&lt;/a&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*7QPKTkyLkDMztLgr" /><figcaption>Text එක මත click කළාම,</figcaption></figure><h3>Target Attribute</h3><p>target attribute එකෙන් linkඑක open වෙන විදිහ තෝරන්න පුළුවන්:</p><ul><li>_self: එකම window හෝ tab එකේ open වෙනවා (default).</li><li>_blank: අලුත් window හෝ tab එකක open වෙනවා.</li><li>_parent: Parent frame එකේ open වෙනවා (frame ගැන පසුව ඉගෙන ගමු).</li><li>_top: Full window එකේ open වෙනවා.</li></ul><pre>&lt;a href=&quot;&lt;https://example.com&gt;&quot; target=&quot;_blank&quot;&gt;Open in New Tab&lt;/a&gt;</pre><p>Play</p><p>මෙතන click කළාම, linkඑක අලුත් ටැබ් එකක open වෙනවා. ඔබේ වෙබ් අඩවියත් ඒ විදිහට විවෘතව තියෙනවා!</p><h3>Link Types</h3><h3>1. Absolute URLs</h3><p>මේවා protocol (http:// හෝ <a href="https://)/">https://)</a> එක්ක එන සම්පූර්ණ ලිපිනයන්. වෙනත් වෙබ් අඩවිවලට යන්න මේවා යොදාගන්නවා.</p><pre>&lt;a href=&quot;&lt;https://www.example.com/page&gt;&quot;&gt;Full URL&lt;/a&gt;</pre><h3>2. Relative URLs</h3><p>එකම වෙබ් අඩවියේ ඇතුළත තියෙන පිටුවලට යන්න. Protocol ඕන නෑ.</p><pre>&lt;a href=&quot;/about/contact.html&quot;&gt;Contact Page&lt;/a&gt;</pre><h3>3. Email Links</h3><p>මේවා click කළාම ඔබේ ඊමේල් app එක open වෙලා, recipient එකත් fill වෙලා එනවා.</p><pre>&lt;a href=&quot;mailto:example@email.com&quot;&gt;Send Email&lt;/a&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*s_SnROglRjoBVTre" /><figcaption>Mailto</figcaption></figure><h3>Best Practices</h3><ul><li>Text එක විස්තරාත්මකව යොදන්න: “Click here” වෙනුවට “Go to the example website” වගේ ලියන්න.</li><li>External links අලුත් ටැබ් එකක open කරන්න: target=”_blank” යොදන්න.</li><li>Security වෙනුවෙන් rel=”noopener” එකත් යොදන්න: _blank එක්ක යොදනකොට මේකත් එකතු කරන්න.</li><li>link වැඩ කරනවද බලන්න: Broken links තියෙන්න එපා.</li><li>linkstyle එක සමානව තියන්න: වෙබ් අඩවිය පුරාම එකම look එක තියෙන්න ඕන.</li></ul><h3>💡 Pro Tip</h3><p>linkඑකක් _blank එක්ක open කරනකොට, බලන අයට ඒ ගැන කියන්න. උදාහරණයක් විදිහට, “අලුත් ටැබ් එකකින් විවෘත වෙනවා” කියලා ලියන්න හෝ icon එකක් යොදන්න. එතකොට users ලට surprise එකක් වෙන්නේ නෑ!</p><h3>Styling Links</h3><p>CSS එක්ක linkවල විවිධ states වෙනස් කරන්න පුළුවන්:</p><ul><li>a:link — සාමාන්ය link(බලලා නැති ඒවා).</li><li>a:visited — visited ලින්ක්.</li><li>a:hover — mouse එක උඩ තියනකොට.</li><li>a:active — click කරන මොහොතේ.</li></ul><pre>a:link {<br>    color: blue;<br>}<br>a:visited {<br>    color: purple;<br>}<br>a:hover {<br>    color: red;<br>}<br>a:active {<br>    color: yellow;<br>}</pre><p>එහෙනම් අපි HTML ගැන කතා කරලා ඉවරයි. ඊළග ලිපියේ ඉදන් අපි CSS ගැන කතා කරමු. තවදුරටත් ඉගෙනගන්න උවමනාවක් තියන අය මේ resources try කරලා බලන්න!.</p><ol><li><a href="https://www.w3schools.com/html/">W3Schools</a></li><li><a href="http://html.com/">HTML.com</a></li><li><a href="https://www.khanacademy.org/computing/computer-programming/html-css">Khan Academy</a></li><li><a href="https://scrimba.com/t0html">Scrimba</a></li><li><a href="https://www.freecodecamp.org/news/html-crash-course/">freeCodeCamp</a></li></ol><p>Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae6910f2dc44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTML Hyperlink]]></title>
            <link>https://medium.com/@sadeepanithushika/html-hyperlink-0c52103e39a8?source=rss-02ead828554b------2</link>
            <guid isPermaLink="false">https://medium.com/p/0c52103e39a8</guid>
            <category><![CDATA[hyperlink]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Sadeepa Herath]]></dc:creator>
            <pubDate>Thu, 24 Apr 2025 12:48:25 GMT</pubDate>
            <atom:updated>2025-04-24T12:48:25.767Z</atom:updated>
            <content:encoded><![CDATA[<p>ආයුබෝවන්! ඔයාලා අපේ Web Development for Beginners article series එකේ අටවෙනි ලිපියට ආවා. මේ series එකේ <a href="https://medium.com/@sadeepanithushika/html-basics-%E0%B6%94%E0%B6%B6%E0%B7%9A-%E0%B6%B4%E0%B7%85%E0%B6%B8%E0%B7%94-%E0%B7%80%E0%B7%99%E0%B6%B6%E0%B7%8A-%E0%B6%B4%E0%B7%92%E0%B6%A7%E0%B7%94%E0%B7%80-%E0%B7%83%E0%B7%8F%E0%B6%AF%E0%B6%B8%E0%B7%94-72a3df022b29">පළමු ලිපියෙන්</a> අපි HTML ගැන ඉගෙන ගත්තා, <a href="https://medium.com/@sadeepanithushika/header-%E0%B7%83%E0%B7%84-footer-tags-6158a9216dae">දෙවෙනි ලිපියෙන්</a> Header සහ Footer tags ගැන, <a href="https://medium.com/@sadeepanithushika/html-text-formatting-5e1de60fc3b1">තුන්වෙනි ලිපියෙන්</a> HTML text formatting ගැන, <a href="https://medium.com/@sadeepanithushika/html-lists-e25b79c49a7c">සිව්වෙනි ලිපියෙන් </a>HTML Lists ගැන, <a href="https://medium.com/@sadeepanithushika/html-images-7f3e2a1e90ee">පස්වෙනි ලිපියෙන්</a> HTML Images ගැන ඉගෙන ගත්තා, <a href="https://medium.com/@sadeepanithushika/html-video-audio-963050690660">හයවෙනි ලිපියෙන්</a> අපි Video &amp; Audio tags ගැන, <a href="https://medium.com/@sadeepanithushika/html-tables-7ef61d95a3c6">හත්වෙනි ලිපියෙන්</a> HTML Tables ගැන, <a href="https://medium.com/@sadeepanithushika/html-forms-5926e781b88e">අටවෙනි ලිපියෙන්</a> HTML Forms ගැන, <a href="https://medium.com/@sadeepanithushika/html-content-model-1807e80e4885">නවවන ලිපියෙන්</a> content model ගැන කතා කළා. අද අපි බලමු HTML Hyperlinks ගැන. මේවා තමයි වෙබ් අඩවියක එක පිටුවක ඉඳලා තවත් පිටුවකට යන්න උදව් වෙන්නේ. එන්න, අපි ඒ ගැන ඉගෙන ගමු!</p><h3>Hyperlinks කියන්නේ මොකක්ද?</h3><p>Hyperlinks කියන්නේ clickable වචන හෝ රූප. ඒවා මත click කළාම, ඔබව වෙනත් වෙබ් පිටුවකට හෝ එකම පිටුවේ වෙනත් කොටසකට ගෙනියනවා. මේක වෙබ් redirect කරන මූලිකම ක්රමයක්!</p><h3>Basic Link Syntax</h3><p>HTML වලදී, hyperlinks හදන්නේ &lt;a&gt; (anchor) ටැග් එකෙන්. ඒකට තියෙන්නේ ප්රධාන කොටස් දෙකයි:</p><ul><li>href attribute: linkඑකෙන් යන්න ඕන තැන (URL හෝ ගොනුව).</li><li>Link text: බලන අයට පේන, click කරන්න පුළුවන් වචන.</li></ul><pre>&lt;a href=&quot;&lt;https://example.com&gt;&quot;&gt;Visit Example Website&lt;/a&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*_nHVvQzJ_JfV3Aul" /></figure><h3>Target Attribute</h3><p>target attribute එකෙන් linkඑක open වෙන විදිහ තෝරන්න පුළුවන්:</p><ul><li>_self: එකම window හෝ tab එකේ open වෙනවා (default).</li><li>_blank: අලුත් window හෝ tab එකක open වෙනවා.</li><li>_parent: Parent frame එකේ open වෙනවා (frame ගැන පසුව ඉගෙන ගමු).</li><li>_top: Full window එකේ open වෙනවා.</li></ul><pre>&lt;a href=&quot;&lt;https://example.com&gt;&quot; target=&quot;_blank&quot;&gt;Open in New Tab&lt;/a&gt;</pre><p>මෙතන click කළාම, linkඑක අලුත් ටැබ් එකක open වෙනවා. ඔබේ වෙබ් අඩවියත් ඒ විදිහට විවෘතව තියෙනවා!</p><h3>Link Types</h3><h3>1. Absolute URLs</h3><p>මේවා protocol (http:// හෝ <a href="https://)/">https://)</a> එක්ක එන සම්පූර්ණ ලිපිනයන්. වෙනත් වෙබ් අඩවිවලට යන්න මේවා යොදාගන්නවා.</p><pre>&lt;a href=&quot;&lt;https://www.example.com/page&gt;&quot;&gt;Full URL&lt;/a&gt;</pre><h3>2. Relative URLs</h3><p>එකම වෙබ් අඩවියේ ඇතුළත තියෙන පිටුවලට යන්න. Protocol ඕන නෑ.</p><pre>&lt;a href=&quot;/about/contact.html&quot;&gt;Contact Page&lt;/a&gt;</pre><h3>3. Email Links</h3><p>මේවා click කළාම ඔබේ ඊමේල් app එක open වෙලා, recipient එකත් fill වෙලා එනවා.</p><pre>&lt;a href=&quot;mailto:example@email.com&quot;&gt;Send Email&lt;/a&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*ffEUtt_S2gMPM6kz" /><figcaption>Mailto</figcaption></figure><h3>Best Practices</h3><ul><li>Text එක විස්තරාත්මකව යොදන්න: “Click here” වෙනුවට “Go to the example website” වගේ ලියන්න.</li><li>External links අලුත් ටැබ් එකක open කරන්න: target=”_blank” යොදන්න.</li><li>Security වෙනුවෙන් rel=”noopener” එකත් යොදන්න: _blank එක්ක යොදනකොට මේකත් එකතු කරන්න.</li><li>link වැඩ කරනවද බලන්න: Broken links තියෙන්න එපා.</li><li>linkstyle එක සමානව තියන්න: වෙබ් අඩවිය පුරාම එකම look එක තියෙන්න ඕන.</li></ul><h3>💡 Pro Tip</h3><p>linkඑකක් _blank එක්ක open කරනකොට, බලන අයට ඒ ගැන කියන්න. උදාහරණයක් විදිහට, “අලුත් ටැබ් එකකින් විවෘත වෙනවා” කියලා ලියන්න හෝ icon එකක් යොදන්න. එතකොට users ලට surprise එකක් වෙන්නේ නෑ!</p><h3>Styling Links</h3><p>CSS එක්ක linkවල විවිධ states වෙනස් කරන්න පුළුවන්:</p><ul><li>a:link — සාමාන්ය link(බලලා නැති ඒවා).</li><li>a:visited — visited ලින්ක්.</li><li>a:hover — mouse එක උඩ තියනකොට.</li><li>a:active — click කරන මොහොතේ.</li></ul><pre>a:link {<br>    color: blue;<br>}<br>a:visited {<br>    color: purple;<br>}<br>a:hover {<br>    color: red;<br>}<br>a:active {<br>    color: yellow;<br>}</pre><h3>📌 පොදුවේ HTML Hyperlinks ගැන ඇසෙන ප්රශ්න</h3><p>1.link එකක් click කළාම එකම ටැබ් එකේ open වෙන්නේ ඇයි?</p><ul><li>Default වශයෙන් target=”_self” විදිහට තමයි එන්නේ. අලුත් ටැබ් එකකට ඕන නම් _blank යොදන්න.</li></ul><p>2. Absolute URLs සහ Relative URLs වෙනස මොකක්ද?</p><ul><li>Absolute URLs එකේ protocol (https://) එක්ක full address එක එනවා. Relative URLs එකම වෙබ් අඩවියේ ඇතුළත පිටුවලට යොමු වෙනවා.</li></ul><p>3. Email links කොහොමද වැඩ කරන්නේ?</p><ul><li>mailto: එක්ක linkඑක හදනකොට, ඔබේ ඊමේල් app එක open වෙලා recipient එක fill වෙලා එනවා.</li></ul><p>4. Link එකේ text එක වැදගත්ද?</p><ul><li>ඔව්! “Click here” වගේ ලියනවට වඩා “See about us” වගේ විස්තරාත්මක text එකක් යොදන්න. එතකොට users ලට තේරෙනවා link එකෙන් යන්නේ කොහෙද කියලා.</li></ul><p>ඔයාට තව ප්රශ්න තියෙනවා නම්, comment එකක් දාන්න. මම උදව් කරන්නම්!</p><p>එහෙනම් මේ series එකෙ අපි HTML ගැන කතා කරලා ඉවරයි. ඊළග ලිපියේ ඉදන් අපි CSS ගැන කතා කරමු. තවදුරටත් ඉගෙනගන්න උවමනාවක් තියන අය මේ resources try කරලා බලන්න!.</p><ol><li><a href="https://www.w3schools.com/html/">W3Schools</a></li><li><a href="http://html.com/">HTML.com</a></li><li><a href="https://www.khanacademy.org/computing/computer-programming/html-css">Khan Academy</a></li><li><a href="https://scrimba.com/t0html">Scrimba</a></li><li><a href="https://www.freecodecamp.org/news/html-crash-course/">freeCodeCamp</a></li></ol><p>Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0c52103e39a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTML Content Model]]></title>
            <link>https://medium.com/@sadeepanithushika/html-content-model-1807e80e4885?source=rss-02ead828554b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1807e80e4885</guid>
            <category><![CDATA[sinhala-articles]]></category>
            <category><![CDATA[content-model]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Sadeepa Herath]]></dc:creator>
            <pubDate>Wed, 23 Apr 2025 12:20:24 GMT</pubDate>
            <atom:updated>2025-04-23T12:20:24.907Z</atom:updated>
            <content:encoded><![CDATA[<p>ආයුබෝවන්! ඔයාලා අපේ Web Development for Beginners article series එකේ අටවෙනි ලිපියට ආවා. මේ series එකේ <a href="https://medium.com/@sadeepanithushika/html-basics-%E0%B6%94%E0%B6%B6%E0%B7%9A-%E0%B6%B4%E0%B7%85%E0%B6%B8%E0%B7%94-%E0%B7%80%E0%B7%99%E0%B6%B6%E0%B7%8A-%E0%B6%B4%E0%B7%92%E0%B6%A7%E0%B7%94%E0%B7%80-%E0%B7%83%E0%B7%8F%E0%B6%AF%E0%B6%B8%E0%B7%94-72a3df022b29">පළමු ලිපියෙන්</a> අපි HTML ගැන ඉගෙන ගත්තා, <a href="https://medium.com/@sadeepanithushika/header-%E0%B7%83%E0%B7%84-footer-tags-6158a9216dae">දෙවෙනි ලිපියෙන්</a> Header සහ Footer tags ගැන, <a href="https://medium.com/@sadeepanithushika/html-text-formatting-5e1de60fc3b1">තුන්වෙනි ලිපියෙන්</a> HTML text formatting ගැන, <a href="https://medium.com/@sadeepanithushika/html-lists-e25b79c49a7c">සිව්වෙනි ලිපියෙන් </a>HTML Lists ගැන, <a href="https://medium.com/@sadeepanithushika/html-images-7f3e2a1e90ee">පස්වෙනි ලිපියෙන්</a> HTML Images ගැන ඉගෙන ගත්තා, <a href="https://medium.com/@sadeepanithushika/html-video-audio-963050690660">හයවෙනි ලිපියෙන්</a> අපි Video &amp; Audio tags ගැන, <a href="https://medium.com/@sadeepanithushika/html-tables-7ef61d95a3c6">හත්වෙනි ලිපියෙන්</a> HTML Tables ගැන, <a href="https://medium.com/@sadeepanithushika/html-forms-5926e781b88e">අටවෙනි ලිපියෙන්</a> HTML Forms ගැන කතා කළා. අද අපි ඉගෙන ගන්නේ HTML Content Model ගැන. මේක ටිකක් technical වගේ පේන්න පුළුවන්, ඒත් මම ඒක ලේසි කරලා, රසවත් විදිහට ඉදිරිපත් කරන්නම්!</p><h4>HTML Content Model කියන්නේ මොකක්ද?</h4><p>ඔබ ගෙයක් හදනවා කියලා හිතන්න. ගෙදරක වහලය හදන්නේ බිත්ති හදලා ඉවර වුණාට පස්සේ නේද? ඒ වගේම HTML වලදීත්, එක එක elements එක එක තැන්වල යෙදෙන්නේ නිශ්චිත රීති ටිකක් අනුව. HTML Content Model කියන්නේ ඒ රීති ටික. මේකෙන් තමයි අපිට තේරෙන්නේ මොන element එකක් කොහේ පාවිච්චි කරන්න ඕනේද, ඒවා එකිනෙකට ගැලපෙන්නේ කොහොමද කියලා.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*bs_ZFtcavqMr5DlE" /><figcaption>HTML Content Model</figcaption></figure><h3>Traditional Content Models</h3><p>අපි මුලින්ම බලමු HTML වල තිබුණු පැරණි රීති ටික. elements දෙවිදියකට බෙදුණා:</p><h3>1. Block Elements</h3><ul><li>අලුත් line එකකින් පටන් ගන්නවා.</li><li>තියෙන ඉඩ පුළුල්ව පුරවනවා.</li><li>උදාහරණ: &lt;div&gt; , &lt;p&gt; , &lt;h1&gt;</li></ul><h3>2. Inline Elements</h3><ul><li>ටෙක්ස්ට් එක්ක එකට ගලාගෙන යනවා.</li><li>අවශ්ය තරම් විතරක් ඉඩ ගන්නවා.</li><li>උදාහරණ: &lt;span&gt; , &lt;a&gt; , &lt;strong&gt;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/0*_woXbF-cy09dyYIM" /><figcaption>Block elements and Inline elements</figcaption></figure><h3>New HTML5 Content Models</h3><p>HTML5 ආවට පස්සේ මේ රීති ටික වඩාත් නිශ්චිත වුණා. දැන් තියෙන්නේ කැටගරි හතක් (7). මේ එක එක එක ගැන ලේසියෙන් බලමු:</p><h3>1. Metadata Content</h3><ul><li>ගෙදර blueprint එකක් වගේ. ගෙදර ගැන තොරතුරු දෙනවා, ඒත් බලන්න බෑ.</li><li>උදාහරණ: &lt;title&gt; , &lt;link&gt; , &lt;meta&gt;, &lt;style&gt;</li></ul><h3>2. Flow Content</h3><ul><li>ගෙදර මුළු බඩුම ටික වගේ. බොඩි එකේ තියෙන ගොඩක් එලිමන්ට් මේකට ඇතුළත් වෙනවා.</li><li>උදාහරණ: Text elements, Structural elements, Interactive elements</li></ul><h3>3. Sectioning Content</h3><ul><li>ගෙදර වෙන වෙනම කාමර වගේ. වෙබ් පිටුව කොටස් කරනවා.</li><li>උදාහරණ: &lt;article&gt; , &lt;section&gt;, &lt;nav&gt; , &lt;aside&gt;</li></ul><h3>4. Heading Content</h3><ul><li>කාමරවල දොරකඩේ තියෙන නම්පුවරු වගේ.</li><li>උදාහරණ: &lt;h1&gt; සිට &lt;h6&gt; , &lt;hgroup&gt;</li></ul><h3>5. Phrasing Content</h3><ul><li>බිත්තියේ ලියලා තියෙන වචන වගේ. text සහ text level element.</li><li>උදාහරණ: Text, &lt;span&gt;, &lt;img&gt;, &lt;input&gt;.</li></ul><h3>6. Embedded Content</h3><ul><li>ජනේල වගේ, එළියෙන් බඩු ගේනවා.</li><li>උදාහරණ: &lt;img&gt;, &lt;video&gt;, &lt;audio&gt;, &lt;iframe&gt;.</li></ul><h3>7. Interactive Content</h3><ul><li>button සහ switch වගේ, ඔබට එක්ක ගනින්න පුළුවන්.</li><li>උදාහරණ: &lt;button&gt;, &lt;a&gt;, &lt;select&gt;, form alignment.</li></ul><p>special: එක එලිමන්ට් එකකට category කිහිපයකටම අයිති වෙන්න පුළුවන්. උදාහරණයක් විදිහට &lt;a&gt; කියන්නේ flow සහ interactive දෙකටම අයිති එකක්.</p><h3>Best Practices</h3><ul><li>එලිමන්ට් ඒවායේ අරමුණටම භාවිතා කරන්න. උදා: &lt;div&gt; වෙනුවට &lt;section&gt; ඕනෑ තැන ඒක යොදන්න.</li><li>Content Model රීති අනුව නිවැරදිව nest කරන්න. උදා: inline එකකටblovk එකක් දාන්න එපා.</li><li>Accessibility ගැන හිතන්න. semantic elementsයොදලා screen readers වලට උදව් කරන්න.</li></ul><h3>💡 Pro Tip</h3><p>Content Models හොඳින් තේරුම් ගත්තම ඔබේ වෙබ් පිටු හොඳින් organize වෙනවා, පවත්වාගෙන යන්න ලේසියි, සහ සෑම දෙනාටම access කරන්න පුළුවන් විදිහට හදන්න පුළුවන්. Element ගැන සැකයක් ඇති වුණොත් HTML specifications බලන්න!</p><h3>📌 පොදුවේ HTML Content Model ගැන ඇසෙන ප්රශ්න</h3><ol><li>Content Models වෙන්න ඕනේ ඇයි?</li></ol><ul><li>Element එකක behavior එක තේරුම් ගන්නත්, HTML වඩා හොඳින් organize කරන්නත් උදව් වෙනවා.</li></ul><p>2. එක එලිමන්ට් එකකට කැටගරි කිහිපයකට අයිති වෙන්න පුළුවන්ද?</p><ul><li>ඔව්! උදාහරණයක් විදිහට &lt;a&gt; කියන්නේ flow සහ interactive දෙකටම අයිතියි.</li></ul><p>3. Flow Content සහ Phrasing Content අතර වෙනස මොකක්ද?</p><ul><li>Flow කියන්නේ body එකේ තියෙන ගොඩක් element ඇතුළත් වෙන පුළුල් category එකක්. Phrasing කියන්නේ text සහ text level element විතරයි.</li></ul><p>4. Content Models Accessibility වලට බලපාන්නේ කොහොමද?</p><ul><li>නිවැරදි එලිමන්ට් (උදා: &lt;section&gt;) යොදනකොට screen readers වලට පිටුවේ structure එක තේරෙනවා. ඒකෙන් වෙබ් පිටුව සෑම දෙනාටම access කරන්න ලේසි වෙනවා. ඔයාට තව ප්රශ්න තියෙනවා නම්, comment එකක් දාන්න. මම උදව් කරන්නම්!</li></ul><p>ඊළඟ ලිපියෙන් අපි hyperlink ගැන ටිකක් ඉගෙන ගමු. ඒ වෙනකන් Content Model එක්ක play කරලා බලන්න.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1807e80e4885" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTML Forms]]></title>
            <link>https://medium.com/@sadeepanithushika/html-forms-5926e781b88e?source=rss-02ead828554b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5926e781b88e</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[web-forms]]></category>
            <dc:creator><![CDATA[Sadeepa Herath]]></dc:creator>
            <pubDate>Tue, 22 Apr 2025 07:41:45 GMT</pubDate>
            <atom:updated>2025-04-23T12:17:05.820Z</atom:updated>
            <content:encoded><![CDATA[<p>ආයුබෝවන්! ඔයාලා අපේ Web Development for Beginners article series එකේ අටවෙනි ලිපියට ආවා. මේ series එකේ <a href="https://medium.com/@sadeepanithushika/html-basics-%E0%B6%94%E0%B6%B6%E0%B7%9A-%E0%B6%B4%E0%B7%85%E0%B6%B8%E0%B7%94-%E0%B7%80%E0%B7%99%E0%B6%B6%E0%B7%8A-%E0%B6%B4%E0%B7%92%E0%B6%A7%E0%B7%94%E0%B7%80-%E0%B7%83%E0%B7%8F%E0%B6%AF%E0%B6%B8%E0%B7%94-72a3df022b29">පළමු ලිපියෙන්</a> අපි HTML ගැන ඉගෙන ගත්තා, <a href="https://medium.com/@sadeepanithushika/header-%E0%B7%83%E0%B7%84-footer-tags-6158a9216dae">දෙවෙනි ලිපියෙන්</a> Header සහ Footer tags ගැන, <a href="https://medium.com/@sadeepanithushika/html-text-formatting-5e1de60fc3b1">තුන්වෙනි ලිපියෙන්</a> HTML text formatting ගැන, <a href="https://medium.com/@sadeepanithushika/html-lists-e25b79c49a7c">සිව්වෙනි ලිපියෙන් </a>HTML Lists ගැන, <a href="https://medium.com/@sadeepanithushika/html-images-7f3e2a1e90ee">පස්වෙනි ලිපියෙන්</a> HTML Images ගැන ඉගෙන ගත්තා, <a href="https://medium.com/@sadeepanithushika/html-video-audio-963050690660">හයවෙනි ලිපියෙන්</a> අපි Video &amp; Audio tags ගැන, <a href="https://medium.com/@sadeepanithushika/html-tables-7ef61d95a3c6">හත්වෙනි ලිපියෙන්</a> HTML Tables ගැන කතා කළා. අද අපි බලමු HTML Forms ගැන. HTML form එකක් කියන්නේ webpage එකක users ලට data input කරන්න ඉඩ දෙන කොටසක්. ඒ data server එකකට යවලා process කරන්න පුළුවන්. Forms තමයි interactive webpages හදන්න උදව් වෙන්නේ. එන්න, අපි බලමු මේක කොහොමද හදන්නේ කියලා!</p><h3>Basic Form Structure</h3><p>HTML form එකක් හදන්න &lt;form&gt; tag එක යොදාගන්නවා. ඒකට action සහ method කියන attributes දෙකක් තියනවා.</p><pre>&lt;form action=&quot;/submit-form&quot; method=&quot;post&quot;&gt;<br>    &lt;!-- Form elements go here --&gt;<br>&lt;/form&gt;</pre><ul><li>action: Form එක submit කරනකොට data යවන්න ඕන URL එක (උදා: “/submit-form”).</li><li>method: Data යවන ආකාරය (GET හෝ POST).</li></ul><p>Tip: ඔයා beginner කෙනෙක් නිසා, දැනට action සහ method ගැන වැඩිපුර හිතන්න එපා. අපි ඉස්සෙල්ලා form එක හදන elements ගැන බලමු.</p><h3>Common Form Elements</h3><p>Form එකක තියෙන වැදගත් කොටස් ටිකක් බලමු. මේවා තමයි users ලට data input කරන්න උදව් වෙන්නේ.</p><h3>1. Text Input Fields</h3><ul><li>Single-line text input: &lt;input type=”text” name=”username”&gt; එක line එකක ලියන Username, email, phone number වගේ දේවල් enter කරන්න යොදාගන්නවා.</li><li>Password field: &lt;input type=”password” name=”password”&gt; Password type කරනකොට characters hide වෙනවා (උදා: ****).</li><li>Multi-line text area: &lt;textarea name=”message” rows=”4&quot; cols=”50&quot;&gt;&lt;/textarea&gt; Comments, messages වගේ ටිකක් වැඩිපුර ලියන්න ඕන තැන්වල යොදාගන්නවා.</li></ul><h3>2. Selection Elements</h3><ul><li>Radio buttons: &lt;input type=”radio” name=”gender” value=”male”&gt; එක option එකක් විතරක් select කරන්න පුළුවන් (උදා: Gender — Male/Female).</li><li>Checkboxes: &lt;input type=”checkbox” name=”vehicle” value=”bike”&gt; Multiple options select කරන්න යොදාගන්නවා (උදා: Hobbies — Coding, Reading).</li><li>Dropdown lists: &lt;select&gt; සහ &lt;option&gt; tags යොදාගෙන. උදාහරණයක්:</li></ul><pre>&lt;select name=&quot;country&quot;&gt;<br>    &lt;option value=&quot;sl&quot;&gt;Sri Lanka&lt;/option&gt;<br>    &lt;option value=&quot;in&quot;&gt;India&lt;/option&gt;<br>    &lt;option value=&quot;uk&quot;&gt;UK&lt;/option&gt;<br>&lt;/select&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/155/0*A7qNpQACxrYy72O6" /><figcaption>selection element</figcaption></figure><h3>3. Buttons</h3><ul><li>Submit button: &lt;input type=”submit” value=”Submit”&gt; Form එක submit කරන්න යොදාගන්නවා.</li><li>Reset button: &lt;input type=”reset” value=”Reset”&gt; Form එකේ ලියපු data ඔක්කොම clear කරන්න.</li></ul><p>Try This: HTML file එකක් හදලා text input එකක්, radio button එකක්, checkbox එකක්, සහ submit button එකක් දාලා browser එකේ open කරලා බලන්න. Form එක fill කරලා submit එක ඔබලා බලන්න මොකද වෙන්නේ කියලා!</p><h3>Example of a Complete Form</h3><p>full form එකක් කොහොමද හදන්නේ කියලා අපි බලමු . මේකෙන් ඔයාට හොඳ අදහසක් ගන්න පුළුවන්.</p><pre>&lt;form action=&quot;/submit&quot; method=&quot;post&quot;&gt;<br>    &lt;label for=&quot;fname&quot;&gt;First Name:&lt;/label&gt;<br>    &lt;input type=&quot;text&quot; id=&quot;fname&quot; name=&quot;fname&quot;&gt;&lt;br&gt;</pre><pre>    &lt;label for=&quot;email&quot;&gt;Email:&lt;/label&gt;<br>    &lt;input type=&quot;email&quot; id=&quot;email&quot; name=&quot;email&quot;&gt;&lt;br&gt;</pre><pre>    &lt;label&gt;Gender:&lt;/label&gt;<br>    &lt;input type=&quot;radio&quot; name=&quot;gender&quot; value=&quot;male&quot;&gt; Male<br>    &lt;input type=&quot;radio&quot; name=&quot;gender&quot; value=&quot;female&quot;&gt; Female&lt;br&gt;</pre><pre>    &lt;label&gt;Interests:&lt;/label&gt;<br>    &lt;input type=&quot;checkbox&quot; name=&quot;interest&quot; value=&quot;coding&quot;&gt; Coding<br>    &lt;input type=&quot;checkbox&quot; name=&quot;interest&quot; value=&quot;reading&quot;&gt; Reading&lt;br&gt;</pre><pre>    &lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&gt;<br>&lt;/form&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/0*em4hFaZY1nBMnlM-" /><figcaption>Example Form</figcaption></figure><p>මේ form එකේ:</p><ul><li>First name සහ email එක text inputs වලින් ගන්නවා.</li><li>Gender එක radio buttons වලින් select කරනවා.</li><li>Interests ටික checkboxes වලින් තෝරනවා.</li><li>Submit button එකෙන් form එක යවනවා.</li></ul><h3>Important Form Attributes</h3><p>Form එකක තියෙන elements වල name attribute එක ගොඩක් වැදගත්. ඒකෙන් server එකට data යවනවා.</p><p>උදා: &lt;input type=”text” name=”username”&gt; — “username” කියන name එකෙන් තමයි data යවන්නෙ.</p><ul><li>action: Form data යවන්න ඕන තැන (URL එක).</li><li>method: Data යවන විදිහ (GET හෝ POST).</li><li>required: Field එක fill කරන්නම ඕන කියලා දෙනවා. උදා: &lt;input type=”text” required&gt;.</li></ul><h3>Form Validation</h3><p>HTML5 එක්ක built-in validation තියෙනවා.</p><ul><li>required attribute එකෙන් field එක mandatory කරනවා.</li><li>type=”email”, type=”number”, type=”url” වගේ inputs automatically check වෙනවා (උදා: email format එක හරිද කියලා).</li></ul><p>Form එක submit කරනකොට required fields fill කරලා නැත්තම්, browser එක “Please fill out this field” වගේ message එකක් පෙන්නනවා.</p><h3>Best Practices</h3><p>Forms හදනකොට මේ ටික මතක තියාගන්න:</p><ul><li>Labels යොදාගන්න: &lt;label for=”id”&gt; — Accessibility වැඩි වෙනවා, users ලට ලේසි වෙනවා.</li><li>Fieldsets යොදාගන්න: Related fields group කරන්න &lt;fieldset&gt; tag එක යොදාගන්න. උදා:</li></ul><pre>&lt;fieldset&gt;<br>    &lt;legend&gt;Personal Info&lt;/legend&gt;<br>    &lt;label for=&quot;fname&quot;&gt;First Name:&lt;/label&gt;<br>    &lt;input type=&quot;text&quot; id=&quot;fname&quot; name=&quot;fname&quot;&gt;<br>&lt;/fieldset&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/0*B6tXl495uiC2cg8M" /><figcaption>Field set</figcaption></figure><ul><li>Validation හරියට කරන්න: Required fields, correct formats (email, number) check කරන්න.</li><li>Clear instructions දෙන්න: Users ලට තේරෙන්න instructions සහ error messages දෙන්න.</li></ul><h3>ඔයාත් Try කරලා බලන්න!</h3><p>දැන් ඔයාට HTML forms ගැන හොඳ idea එකක් තියෙනවා. අපි ටිකක් fun විදිහට ඉගෙන ගමු:</p><ol><li>Exercise 1: Simple registration form එකක් හදන්න: Fields: Name, Email, Password Submit button එක Name සහ Email required කරන්න.</li><li>Exercise 2: Survey form එකක් හදන්න: Question: “Favorite Color” Options: Red, Blue, Green (radio buttons) Submit button එක.</li></ol><p>Browser එකේ form එක fill කරලා submit කරලා බලන්න. Action URL එකක් නැති නිසා page එක refresh වෙයි, ඒත් ඔයාට practice කරන්න පුළුවන්.</p><h3>📌 පොදුවේ HTML Forms ගැන ඇසෙන ප්රශ්න</h3><ol><li>Form එක submit කරනකොට data යන්නේ කොහෙද? action attribute එකේ දීල තියෙන URL එකට (උදා: “/submit”).</li><li>GET සහ POST methods වල වෙනස මොකක්ද? GET: Data URL එකට append වෙනවා (visible), search වගේ ඒවට හොඳයි. POST: Data body එකේ යවනවා, secure, passwords වගේ ඒවට හොඳයි.</li><li>Required fields validate වෙන්නේ කොහොමද? Browser එක automatically check කරලා empty නම් message එකක් පෙන්නනවා.</li><li>Labels වැදගත් ඇයි? Accessibility වැඩි වෙනවා. Screen readers වලට උදව් වෙනවා, users ලට ලේසි වෙනවා.</li><li>Form එක reset කරන්නේ කොහොමද? &lt;input type=”reset”&gt; button එකෙන් form එක clear කරන්න පුළුවන්.</li></ol><p>ඔයාට තව ප්රශ්න තියෙනවා නම්, comment එකක් දාන්න. මම උදව් කරන්නම්!</p><p>HTML forms තමයි webpage එකකට interactive vibe එක එන්නේ. මේවා හරියට යොදාගත්තොත්, ඔයාගේ website එක user-friendly වෙනවා. ඊළඟ ලිපියෙන් අපි Content Model ගැන ටිකක් ඉගෙන ගමු. ඒ වෙනකන් forms එක්ක play කරලා බලන්න.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5926e781b88e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTML Tables]]></title>
            <link>https://medium.com/@sadeepanithushika/html-tables-7ef61d95a3c6?source=rss-02ead828554b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ef61d95a3c6</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[table]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[html5]]></category>
            <dc:creator><![CDATA[Sadeepa Herath]]></dc:creator>
            <pubDate>Sun, 20 Apr 2025 14:43:47 GMT</pubDate>
            <atom:updated>2025-04-22T07:43:36.150Z</atom:updated>
            <content:encoded><![CDATA[<p>ආයුබෝවන්! ඔයාලා අපේ Web Development For Beginner article series එකේ හයවෙනි පියවරට ආවා. මේ series එකේ <a href="https://medium.com/@sadeepanithushika/html-basics-%E0%B6%94%E0%B6%B6%E0%B7%9A-%E0%B6%B4%E0%B7%85%E0%B6%B8%E0%B7%94-%E0%B7%80%E0%B7%99%E0%B6%B6%E0%B7%8A-%E0%B6%B4%E0%B7%92%E0%B6%A7%E0%B7%94%E0%B7%80-%E0%B7%83%E0%B7%8F%E0%B6%AF%E0%B6%B8%E0%B7%94-72a3df022b29">පළමු ලිපියේදී</a> අපි HTML ගැන ඉගෙන ගත්තා, <a href="https://medium.com/@sadeepanithushika/header-%E0%B7%83%E0%B7%84-footer-tags-6158a9216dae">දෙවෙනි ලිපියේදී</a> Header සහ Footer tags ගැන, <a href="https://medium.com/@sadeepanithushika/html-text-formatting-5e1de60fc3b1">තුන්වෙනි ලිපියේදී</a> HTML text formatting ගැන, <a href="https://medium.com/@sadeepanithushika/html-lists-e25b79c49a7c">සිව්වෙනි ලිපියේදී</a> HTML Lists ගැන, <a href="https://medium.com/@sadeepanithushika/html-images-7f3e2a1e90ee">පස්වෙනි ලිපියෙන්</a> HTML Images ගැන ඉගෙන ගත්තා, හයවෙනි ලිපියේදී අපි Video &amp; Audio tags ගැන ඉගෙන ගත්තා. අද අපි කතා කරමු HTML Tables ගැන. HTML Table භාවිතා වෙන්නේ දත්ත ලස්සනට arrange කරලා පෙන්නන්න. උදාහරණයක් විදිහට, ඔයාට timetable එකක්, මිල ලැයිස්තුවක්, හෝ report එකක් webpage එකක පෙන්නන්න ඕන නම්, tables තමයි best. ඒවා බලන අයට ලේසියෙන් තේරෙන විදිහට data organize කරනවා.</p><h3>1. HTML වගු තේරුම් ගනිමු</h3><p>HTML table එකක main parts තුනක් තියෙනවා:</p><ol><li>වගු පේළි (&lt;tr&gt;) — එක row එකක් හදනවා.</li><li>වගු දත්ත (&lt;td&gt;) — එක එක cells වල data තියෙනවා.</li><li>වගු ශීර්ෂ (&lt;th&gt;) — තීරුවල headings දෙනවා (bold සහ center වෙනවා).</li></ol><p>අපි බලමු basic table එකක් කොහොමද හදන්නේ කියලා.</p><pre>&lt;table border=&quot;1&quot;&gt;<br>  &lt;tr&gt;<br>    &lt;th&gt;Name&lt;/th&gt;<br>    &lt;th&gt;Age&lt;/th&gt;<br>    &lt;th&gt;Country&lt;/th&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;Alice&lt;/td&gt;<br>    &lt;td&gt;25&lt;/td&gt;<br>    &lt;td&gt;USA&lt;/td&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;Bob&lt;/td&gt;<br>    &lt;td&gt;30&lt;/td&gt;<br>    &lt;td&gt;UK&lt;/td&gt;<br>  &lt;/tr&gt;<br>&lt;/table&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/217/0*O0y9yBTlYtL55iZh" /><figcaption>Table with border = 1</figcaption></figure><ul><li>&lt;table&gt; tag එකෙන් table එක start කරනවා.</li><li>&lt;tr&gt; එකෙන් row එකක් හදනවා.</li><li>&lt;th&gt; එකෙන් column headings දෙනවා (bold සහ center වෙනවා automatically).</li><li>&lt;td&gt; එකෙන් data cells හදනවා.</li><li>border=”1&quot; දැම්මම table එකේ borders පේනවා.</li></ul><p>Try it: ඔයා මේ code එක copy කරලා HTML file එකක දාලා browser එකක open කරලා බලන්න. Table එක හරියට පේනවද කියලා check කරන්න!</p><h3>2. Table එකට Caption එකක් දාමු</h3><p>Table එකට title එකක් දෙන්න ඕන නම් &lt;caption&gt; tag එක යෝදාගන්නවා. ඒකෙන් data ගැන ලේසියෙන් තේරුම් ගන්න පුළුවන්.</p><pre>&lt;table border=&quot;1&quot;&gt;<br>  &lt;caption&gt;Student Information&lt;/caption&gt;<br>  &lt;tr&gt;<br>    &lt;th&gt;Name&lt;/th&gt;<br>    &lt;th&gt;Grade&lt;/th&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;John&lt;/td&gt;<br>    &lt;td&gt;A&lt;/td&gt;<br>  &lt;/tr&gt;<br>&lt;/table&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/151/0*iTbmThXx5T3pPT0g" /><figcaption>Table with Caption</figcaption></figure><p>Caption එක table එකට උඩින් එනවා. ලස්සනයි, ලේසියි!</p><h3>3. Cells එකතු කිරීම (colspan සහ rowspan)</h3><p>අපිට table එකේ cells තිරස් අතට (horizontally) සහ සිරස් අතට (vertically) එකතු කරන්න පුළුවන්. ඒකට යෝදාගන්නේ:</p><ul><li>colspan — තීරු එකතු කරනවා.</li><li>rowspan — පේළි එකතු කරනවා.</li></ul><pre>&lt;table border=&quot;1&quot;&gt;<br>  &lt;tr&gt;<br>    &lt;th colspan=&quot;2&quot;&gt;Srudent Information&lt;/th&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;Name&lt;/td&gt;<br>    &lt;td&gt;Grade&lt;/td&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td rowspan=&quot;2&quot;&gt;Emily&lt;/td&gt;<br>    &lt;td&gt;A&lt;/td&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;B&lt;/td&gt;<br>  &lt;/tr&gt;<br>&lt;/table&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/0*tHht6g6wA3fiyAsr" /><figcaption>Rowspan &amp; Colspan</figcaption></figure><ul><li>colspan=”2&quot; දැම්මම “සිසු විස්තර” heading එක තීරු 2කට යනවා.</li><li>rowspan=”2&quot; දැම්මම “Emily” cell එක පේළි 2කට යනවා.</li></ul><p>Try This: colspan හෝ rowspan value එක 3 කරලා run කරලා බලන්න. Table එක වෙනස් වෙන හැටි බලන්න</p><h3>4. CSS එක්ක Table එක Style කරමු</h3><p>Table එකට ලස්සන look එකක් දෙන්න CSS යෝදාගන්නවා. ඒකෙන් borders, colors, spacing වගේ දේවල් වෙනස් කරන්න පුළුවන්.</p><pre>&lt;style&gt;<br>  table {<br>    width: 50%;<br>    border-collapse: collapse;<br>  }<br>  th, td {<br>    border: 1px solid black;<br>    padding: 8px;<br>    text-align: center;<br>  }<br>  th {<br>    background-color: #f2f2f2;<br>  }<br>&lt;/style&gt;</pre><pre>&lt;table&gt;<br>  &lt;tr&gt;<br>    &lt;th&gt;Name&lt;/th&gt;<br>    &lt;th&gt;Score&lt;/th&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;David&lt;/td&gt;<br>    &lt;td&gt;85&lt;/td&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;Anna&lt;/td&gt;<br>    &lt;td&gt;90&lt;/td&gt;<br>  &lt;/tr&gt;<br>&lt;/table&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/0*vir1SHOmxrRTWWIy" /><figcaption>without CSS</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/0*J2f9Fx5z466e6p2z" /><figcaption>With CSS</figcaption></figure><p>width: 50%; — Table එකේ පළල 50% කරනවා.</p><ul><li>border-collapse: collapse; — Borders අතර ඉඩ ඉවත් කරනවා.</li><li>padding: 8px; — Cells ඇතුළේ ඉඩ දෙනවා (ලේසියෙන් කියවන්න).</li><li>text-align: center; — Text මැදට ගන්නවා.</li><li>background-color: #f2f2f2; — Headers වලට light gray color එකක් දෙනවා.</li></ul><p>දැනට CSS ගැන දන්නැත්තම් ලොකුවට හිතන්න එපා ඉස්සරහට ඒ ගැන ඉගෙනගමු.</p><h3>5. Table එකේ Alignment සහ Width Control කරමු</h3><p>Table එකේ පළල සහ පිහිටීම වෙනස් කරන්නත් පුළුවන්.</p><pre>&lt;table border=&quot;1&quot; width=&quot;80%&quot; align=&quot;center&quot;&gt;<br>  &lt;tr&gt;<br>    &lt;th&gt;Name&lt;/th&gt;<br>    &lt;th&gt;Job&lt;/th&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;Mark&lt;/td&gt;<br>    &lt;td&gt;Engineer&lt;/td&gt;<br>  &lt;/tr&gt;<br>&lt;/table&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pMtRh4pKNQwQl30Z" /><figcaption>Table Alignment</figcaption></figure><ul><li>width=”80%” — Table එක 80% පළලට ගන්නවා. (page size එකෙන් 80%)</li><li>align=”center” — Table එක page එකේ මැදට ගන්නවා.</li></ul><p>Note: මේ attributes work වුණත්, modern web design වලදී CSS යෝදාගන්නවා තමයි best (උදා: margin: 0 auto;).</p><h3>6. Advanced Table Features</h3><h3>A. Striped Rows</h3><p>Table එක කියවන්න ලේසි වෙන්න alternate rows වලට colors දෙන්න පුළුවන්.</p><pre>&lt;style&gt;<br>      tr:nth-child(even) {<br>        background-color: #b13838;<br>      }<br>    &lt;/style&gt;</pre><p>මේකෙන් even rows වලට gray color එකක් එනවා.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*v2nfmc7egsUrjBth" /><figcaption>Row background color</figcaption></figure><h3>B. Hover Effect</h3><p>Mouse එක row එකක් උඩ තියනකොට color එක change වෙන්නත් පුළුවන්.</p><pre>&lt;style&gt;<br>  tr:hover {<br>    background-color: yellow;<br>  }<br>&lt;/style&gt;</pre><p>මේක run කරලා mouse එක table එක උඩ ගෙනියල බලන්න, කහ පාටට වෙනස් වෙනවා!</p><h3>7. Nested Tables (Table එකක ඇතුළේ Table එකක්)</h3><p>&lt;td&gt; cell එකක ඇතුළේ තව table එකක් දාන්න පුළුවන්.</p><pre>&lt;table border=&quot;1&quot;&gt;<br>  &lt;tr&gt;<br>    &lt;th&gt;Employee&lt;/th&gt;<br>    &lt;th&gt;Details&lt;/th&gt;<br>  &lt;/tr&gt;<br>  &lt;tr&gt;<br>    &lt;td&gt;John&lt;/td&gt;<br>    &lt;td&gt;<br>      &lt;table border=&quot;1&quot;&gt;<br>        &lt;tr&gt;<br>          &lt;th&gt;Department&lt;/th&gt;<br>          &lt;td&gt;IT&lt;/td&gt;<br>        &lt;/tr&gt;<br>        &lt;tr&gt;<br>          &lt;th&gt;Salary&lt;/th&gt;<br>          &lt;td&gt;$5000&lt;/td&gt;<br>        &lt;/tr&gt;<br>      &lt;/table&gt;<br>    &lt;/td&gt;<br>  &lt;/tr&gt;<br>&lt;/table&gt;</pre><p>මේකෙන් “Details” cell එක ඇතුළේ mini table එකක් හදනවා.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/0*YsoMaUX_TcNffUNG" /><figcaption>Nested Tables</figcaption></figure><h3>HTML Table Tags Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*IGqBMbUoq6snAJD1" /><figcaption>Summary</figcaption></figure><h3>ඔයාත් Try කරලා බලන්න!</h3><p>දැන් ඔයාට HTML tables ගැන හොඳ idea එකක් තියෙනවා. අපි ටිකක් fun විදිහට ඉගෙන ගමු:</p><ul><li>Exercise 1: ඔයාගේ favorite movies ලැයිස්තුව table එකක දාන්න. තීරු 3ක් යෝදාගන්න:</li></ul><p>| Movie Name | Director | Year Released |</p><p>Code එක HTML file එකක දාලා browser එකේ open කරලා බලන්න.</p><ol><li>Exercise 2: CSS එක්ක table එක style කරන්න: Headers වලට blue color එකක් දෙන්න. Cells වලට padding එකතු කරන්න. Borders solid කරන්න.</li></ol><p>Tip එක: Browser එකේ right-click කරලා “Inspect” ගහලා බලන්න table එකේ structure එක. ලේසියෙන් තේරෙයි!</p><h3>📌 පොදුවේ HTML Tables ගැන ඇසෙන ප්රශ්න</h3><p>1. වගුවේ borders පෙන්නන්නේ කොහොමද?</p><ul><li>HTML වල border attribute එක යෝදාගන්නවා, උදා: &lt;table border=”1&quot;&gt;. CSS වලදී border: 1px solid black; යෝදාගන්නවා.</li></ul><p>2. Cells merge කරන්නේ කොහොමද?</p><ul><li>තිරස් අතට colspan, සිරස් අතට rowspan. උදා: &lt;td colspan=”2&quot;&gt;.</li></ul><p>3. Table එකේ size එක වෙනස් කරන්නේ කොහොමද?</p><ul><li>width attribute එකෙන්, උදා: &lt;table width=”50%”&gt;. CSS වල table { width: 50%; }.</li></ul><p>4. Table එක මැදට ගන්නේ කොහොමද?</p><ul><li>HTML වල align=”center”. CSS වල table { margin: 0 auto; }.</li></ul><p>5. Headers bold සහ center වෙන්නේ ඇයි?</p><ul><li>&lt;th&gt; tag එක default වශයෙන් bold සහ center කරනවා. Change කරන්න ඕන නම් CSS යෝදාගන්න.</li></ul><p>ඔයාට තව ප්රශ්න තියෙනවා නම්, comment එකක් දාන්න. මම උදව් කරන්නම්!</p><p>Pro Tip: Table හදන්න විතරක් නෙමෙයි page layout වලටත් table tag එක use කරනවා. හැමදේම කියල දුන්නම තේරුමකුත් නෑනෙ. ඉගෙනගන්න කැමති අය විතරක් හොයලා try කරලා බලන්න.</p><p>HTML tables ගැන දැන් ඔයාට හොඳ තේරුමක් ඇති. මේවා යෝදාගෙන ලස්සන web pages හදන්න පටන් ගන්න! ඊළඟ ලිපියෙන් HTML Form ගැන තව ටිකක් ඉගෙන ගමු. ඒ වෙනකන් tables එක්ක play කරලා බලන්න.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ef61d95a3c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>